Skip to main content
Harness Artifact Registry provides full support for Python packages, compatible with pip, allowing you to host private Python libraries.

Overview

Python registry features:
  • PyPI-compatible repository protocol
  • Support for wheel (.whl) and source distributions (.tar.gz)
  • Folder uploads for multiple distribution files
  • Version management
  • Integration with pip, poetry, and other Python package managers

Pushing Python packages

Use the hc artifact push python command:
hc artifact push python <registry-name> <package-path> \
  --pkg-url <pkg-url>

Supported formats

Binary distribution format:
hc artifact push python my-registry ./dist/mypackage-1.0.0-py3-none-any.whl \
  --pkg-url https://app.harness.io/registry/pkg

Building Python packages

1

Prepare your package

Ensure you have a proper setup.py or pyproject.toml:
setup.py
from setuptools import setup, find_packages

setup(
    name="mypackage",
    version="1.0.0",
    packages=find_packages(),
    install_requires=[],
)
2

Build distributions

Build wheel and source distributions:
# Install build tools
pip install build

# Build both wheel and sdist
python -m build
3

Upload to registry

Push the distributions:
hc artifact push python my-registry ./dist/ \
  --pkg-url https://app.harness.io/registry/pkg

Installing Python packages

Configure pip to use your Harness registry:

Using pip configuration

Create or edit ~/.pip/pip.conf (Linux/macOS) or %APPDATA%\pip\pip.ini (Windows):
[global]
index-url = https://<username>:<token>@<registry-url>/simple

Using environment variables

export PIP_INDEX_URL=https://<username>:<token>@<registry-url>/simple
pip install mypackage

Per-command authentication

pip install mypackage --index-url https://<username>:<token>@<registry-url>/simple

Examples

# Build and push a wheel
python -m build --wheel
hc artifact push python my-registry ./dist/mypackage-1.0.0-py3-none-any.whl \
  --pkg-url https://app.harness.io/registry/pkg

Using Poetry

Configure Poetry to use your Harness registry:
# Add repository
poetry config repositories.harness https://<registry-url>/simple

# Set credentials
poetry config http-basic.harness <username> <token>

# Publish
poetry build
poetry publish --repository harness
Or use the CLI:
poetry build
hc artifact push python my-registry ./dist/ \
  --pkg-url https://app.harness.io/registry/pkg

Package naming conventions

Python package filenames follow strict conventions:

Wheel format

{distribution}-{version}[-{build}]-{python}-{abi}-{platform}.whl
Example: mypackage-1.0.0-py3-none-any.whl

Source distribution format

{distribution}-{version}.tar.gz
Example: mypackage-1.0.0.tar.gz

CI/CD integration

- name: Build and publish
  run: |
    pip install build
    python -m build
    hc artifact push python my-registry ./dist/ \
      --pkg-url https://app.harness.io/registry/pkg
  env:
    HARNESS_API_KEY: ${{ secrets.HARNESS_API_KEY }}

Troubleshooting

Only .whl and .tar.gz files are supported:
# ❌ Wrong
hc artifact push python my-registry ./mypackage.zip

# ✅ Correct
python -m build  # Generates .whl and .tar.gz
hc artifact push python my-registry ./dist/
Ensure your wheel/sdist follows Python naming conventions:
# Verify build output
python -m build --sdist --wheel --outdir dist/
ls -la dist/
Check your index URL includes credentials:
# Test access
curl -u username:token https://<registry-url>/simple/

See also

Build docs developers (and LLMs) love