Skip to content

PyPI uploads, indexes, and pip installs ​

Create a PyPI Hosted repository named python-hosted. Point the python-mirror Proxy at a mirror root that serves both simple/<project>/ and packages/…, such as https://mirror.example.org/repository/python-hosted/ on another Arka instance. Arka rewrites upstream links to local packages/… paths and fetches those paths relative to the upstream root. If the upstream uses different hosts for its index and wheels, verify a wheel install from a cold cache. Add Hosted before Proxy in the python-public Group.

Use PyPA build and Twine in the build directory. Inject the service account’s ARKA_USER and ARKA_TOKEN from the CI secret store. The account needs write on Hosted.

bash
python -m build
TWINE_USERNAME="$ARKA_USER" TWINE_PASSWORD="$ARKA_TOKEN" \
  python -m twine upload --non-interactive \
  --repository-url https://packages.example.org/repository/python-hosted/ dist/*

pip reads metadata from the Group’s PEP 503 Simple Index. Configure the following in the user’s pip.conf.

ini
[global]
index-url = https://packages.example.org/repository/python-public/simple/

For a private index, provision a temporary CI home directory with a .netrc file for pip authentication. Grant the reading account read on Group and relevant members first.

bash
(
  set -eu
  umask 077
  pip_home=$(mktemp -d)
  trap 'rm -rf "$pip_home"' EXIT
  printf 'machine packages.example.org login %s password %s\n' "$ARKA_USER" "$ARKA_TOKEN" >"$pip_home/.netrc"
  NETRC="$pip_home/.netrc" python -m pip install --no-cache-dir --index-url https://packages.example.org/repository/python-public/simple/ example-package==1.0.0
)

Upload to the Hosted root and install from the /simple/ path. For 404s, check the version, Python and platform wheel tags, Group order and permissions, and the normalized project name. For TLS errors, install your organization’s CA. For the local HTTP Quickstart only, add --trusted-host 127.0.0.1 to the pip command.

Released under the Apache 2.0 License.