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
- You have installed Python and Twine.
- You have created a PyPI repository.
- You have the Download/View permission on the current repository. For details about how to obtain this permission, see Configuring Repository Permissions.
Uploading a PyPI Package from the Client
- Access self-hosted repos using your Huawei Cloud account.
- Select the target PyPI repository on the self-hosted repo page.
- Click Tutorial on the right of the page.
- In the displayed dialog box, click Download Configuration File to download the pypirc file, and save it as the .pypirc file.

- Copy the file to the user directory. In Linux, the path is ~/.pypirc. In Windows, the path is C:\Users\<UserName>\.pypirc.
- 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
- 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
- Access self-hosted repos using your Huawei Cloud account.
- Select the target PyPI repository on the self-hosted repo page.
- Click Tutorial on the right of the page.
- In the displayed dialog box, set Select purpose to Download and click Download Configuration File.
- 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)

- Install the Python package.
pip install {package name}
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot