Updated on 2026-08-10 GMT+08:00

Uploading and Downloading a PyPI Package on the Client

CodeArts Artifact can connect to local PyPI clients. You may upload your private packages from your local PyPI client to self-hosted repos and share them with others, who can download these PyPI packages through their clients.

PyPI Package

The Python Package Index (PyPI) is the official third-party software repository for the Python community. Through PyPI, developers can publish and distribute Python packages.

Constraints

The repository password for a self-hosted repo is account-specific. If you are prompted for a password while using a different account, download the configuration file from the repository's Tutorial tab to obtain it.

Prerequisites

Uploading a PyPI Package from the Client

  1. Access self-hosted repos using your Huawei Cloud account.
  2. Select the target PyPI repository on the self-hosted repo page.
  3. Click Tutorial on the right of the page.
  4. In the displayed dialog box, click Download Configuration File to download the pypirc file, and save it as the .pypirc file.

  5. Copy the file to the user directory. In Linux, the path is ~/.pypirc. In Windows, the path is C:\Users\<UserName>\.pypirc.
  6. Go to the Python project directory and run the following command to compress the Python project into a .whl package.

    python setup.py bdist_wheel

  7. Upload the file to the repository.

    python -m twine upload -r pypi dist/*

    If a certificate error is reported during the upload, run the following command (use Git Bash on Windows) to set environment variables to skip certificate verification (skip this step if you are using Twine 3.8.0 or earlier and Requests 2.27 or earlier.)
    export CURL_CA_BUNDLE=""

    The environment variables will be reset if you log in to the server again, switch users, or open a new bash window. Be sure to set the environment variables before each upload.

Downloading a PyPI Package to the Client

  1. Access self-hosted repos using your Huawei Cloud account.
  2. Select the target PyPI repository on the self-hosted repo page.
  3. Click Tutorial on the right of the page.
  4. In the displayed dialog box, set Select purpose to Download and click Download Configuration File.
  5. Download the pip.ini file from the self-hosted repo page and copy the file to the user directory. In Linux, the path is ~/.pip/pip.conf (C:\Users\<UserName>\pip\pip.ini on Windows)

  6. Install the Python package.

    pip install {package name}