Publish¶
Publish package to GitLab Package Registry¶
Requirements¶
Python >= 3.9
Network access granted to:
the GitLab instance
a deploy token with
read_package_registry
andwrite_package_registry
scope
Configuration¶
Fill the .pypirc
file with the credentials.
From here, we use the deploy token:
; deploy for project using group deploy token
; see: https://gitlab.gpf-tech.ign.fr/groups/geoplateforme/scripts-verification/-/settings/repository
[gitlab-gpf-prj-dt]
repository = https://gitlab.gpf-tech.ign.fr/api/v4/projects/176/packages/pypi
username =
password =
Build and upload with twine¶
Install/upgrade twine:
python3 -m pip install -U "twine<5"
Clean previous builds:
rm -R dist/
Build the new version:
python setup.py sdist bdist_wheel
Alternatively:
python -m pip install -U build python -m build --sdist --wheel --outdir dist/ .
Upload it to the package registry:
HTTPS_PROXY=socks5://127.0.0.1:8645 twine upload --repository-url https://gitlab.gpf-tech.ign.fr/api/v4/projects/214/packages/pypi/ --verbose dist/*
Proxy support¶
Socks5 proxy¶
Install PySocks:
pip install -U "PySocks<2"
Example with a proxy on 127.0.0.1:8645
:
HTTPS_PROXY=socks5://127.0.0.1:8645 twine upload --config-file .pypirc --repository gitlab-gpf-checks-dt --verbose dist/*
See: Twine documentation