Publish

Publish package to GitLab Package Registry

Requirements

  • Python >= 3.10

  • Network access granted to:

  • a deploy token with read_package_registry and write_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

  1. Install/upgrade twine:

    python3 -m pip install -U "twine<5"
    
  2. Clean previous builds:

    rm -R dist/
    
  3. Build the new version:

    python setup.py sdist bdist_wheel
    

    Alternatively:

    python -m pip install -U build
    python -m build --sdist --wheel --outdir dist/ .
    
  4. 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/*