You need to enable JavaScript to run this app.
Container Registry

Container Registry

Copy page
Download PDF
Getting started
Upload and download PyPI packages
Copy page
Download PDF
Upload and download PyPI packages
The artifact repository supports hosting artifacts, allowing users to create artifact repositories and upload and download artifacts. This article explains how to quickly use the artifact repository to upload and download PyPI-format packages.​
Prerequisites​
  • To enable IAM users to operate the artifact repository, ensure that the relevant artifact repository policies and role authorizations have been completed. For specific operating instructions, refer to Permission Management.​
  • Python, pip, twine, and setuptools have already been installed in the local environment (Linux/Mac).​
Procedure​
Step 1: Create an instance​
  1. Log in to the Artifact repository console.​
  1. In the left navigation bar, click Instances. Then, in the Instances area on the right page, click Create a Basic Edition Instance.​
  1. Configure the instance parameters.​
  • ​
    Parameter​
    Description​
    Instance Name​
    The name of the instance, which cannot be modified.​
    Repository Domain Name​
    The domain name for accessing the repository, which is automatically generated by the system and cannot be modified.​
    Billing method​
    The billing method of the instance. Currently, only Pay-as-you-go is supported and cannot be modified.​
    ​
  1. Click Confirm to navigate to the Confirm Order interface.​
  1. After confirming the configuration details, billing type, purchase quantity, and price in the order, if there are no issues, check the box for I have read and agreed to the "Service Terms for the Basic Edition of Artifact Repository".​
  1. Click confirm and wait for the system to complete instance creation.​
Step 2: Create a repository​
  1. In the left navigation bar, select Instances. In the Instances area on the right page, click to enter the artifact repository instance.​
  1. At the top of the left navigation bar, select the PyPl package format, and then in the menu bar, choose Repository Management and click on New Repository to enter the repository configuration page.​
  1. Configure the parameters of the artifact repository.​
  1. Click Confirm.​
Step 3: Configure repository credentials​
  1. In the dropdown menu at the top of the left navigation bar, select the PyPI package format, and in the menu bar, select registry management.​
  1. In the repository management list, click Set permanent credentials.​
  1. Configure the credentials of the artifact repository.​
Step 4: Upload package​
  1. Log in to your local environment (MAC/Linux) and execute the following command to configure the .pypirc file.​
​
vi .pypirc​
​
  1. Add the repository information of the artifact repository to the .pypirc file.​
​
[distutils]​
index-servers = PyPI​
[PyPI]​
repository ={repo path}/legacy/​
username ={username}​
password ={password}​
​
​
Parameter​
Description​
index-servers​
Specifies the name of the artifact repository in the local configuration file. In this example, it is PyPI.​
{repo path}​
The URL address of the artifact repository. For details, please refer to Managing Repository.​
{username}​
The username for the artifact repository, e.g., user_demo@2100012345.​
{password}​
The password for accessing the artifact repository, e.g., cf83200******.​
​
  1. Run the following command to upload the package.​
​
twine upload -r PyPI /PATH/TO/FILES​
​
tip​
In the command for uploading a package, PyPI is the name of the index-servers configured in Step 2. In practice, please modify according to your configuration.​
Step 5: Download package​
tip​
  • In Linux systems, the pip.conf configuration file is typically located in the user's root directory, i.e., ~/.pip/pip.conf.​
  • If this directory does not exist in your environment, you can create it using the mkdir.pip command in the root directory.​
  1. Log in to your local environment (MAC/Linux) and execute the following command to configure the pip.conf file.​
​
vi .pip/pip.conf​
​
  1. Add the repository information of the artifact repository to the pip.conf file.​
​
[global]​
index-url = https://{username}:{password}@{repo path}/simple/​
trusted-host ={domain}​
​
​
Parameter​
Description​
{username}:{password}​
The artifact repository's username and password, for example: user_demo@2100012345:cf83200******.​
{repo path}​
The URL address of the artifact repository. For details, please refer to Managing Repository.​
trusted-host ={domain}​
To configure a trusted domain name, simply set it as the domain name of the artifact repository. For example, artifact-beijing.volces.com.​
​
  1. Execute the following command to download packages.​
​
pip install {package name}​
​
​
Parameter​
Description​
{repo path}​
The name of the package to be downloaded.​
​
View results​
Log in to the artifact repository. In the corresponding repository, you can view the list of packages that have been correctly uploaded.​
​
Last updated: 2025.10.24 11:20:36