The content of this page has been automatically translated by AI. If you encounter any problems while reading, you can view the corresponding content in Chinese.

PyPI

Last updated: 2026-04-03 17:17:44

This document describes how to store PyPI artifacts in CODING-AR for centralized artifact management and version control. The following sections introduce how to create an artifact, configure authentication, and pull and push artifacts.
Note:
To read this document, prepare the following:
Install Python3.
Basic Operations—Create a project.
Select PyPI as the repository type.

Initialization

1. Create a demo directory as the address for the local PyPI package. Run the command in the terminal to create the demo project folder.
mkdir -p demo/example_pkg/__init__.py
2. Go to the demo directory and create a setup.py file.
cd demo && touch setup.py
3. Paste the configuration into the setup.py file.
import setuptools
setuptools.setup(
name="example-pkg-YOUR-USERNAME-HERE", # Replace with your own username
version="0.0.1",
author="Example Author",
author_email="author@example.com",
description="A small example package",
url="https://github.com/pypa/sampleproject",
packages=setuptools.find_packages(),
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
python_requires='>=3.6',
)
4. Install setuptools and wheel tools.
python3 -m pip install --user --upgrade setuptools wheel
5. Package the project.
python3 setup.py sdist bdist_wheel
After packaging the project, the following two files will be generated in the /dist directory for pushing to the artifact repository.
└─dist
├─example_pkg_YOUR_USERNAME_HERE-0.0.1-py3-none-any.whl
├─example_pkg_YOUR_USERNAME_HERE-0.0.1.tar.gz

Configure artifact repository authentication information

Before pushing to the CODING artifact repository, you need to add the corresponding authentication information in the local file. You can authenticate through either automatic configuration or manual configuration. Before proceeding, please use the command cd / to go to the root directory and enter ls -a to check if the .pypirc and pip.conf files exist.
If not, enter the following commands to create the two files.
touch .pypirc && touch pip.conf

Automatic configuration

1. Click on the website to generate a personal token as credentials, and the system will automatically generate access credentials for you. To view the personal token, go to Account Settings > Access Tokens for management.



2. Enter your login password to confirm and obtain the configuration.
Copy the configuration content into the root directory's .pypirc and pip.conf files.

Push an Artifact

Enter the project directory, such as the previously created Demo directory, copy the command from the website and execute it in the terminal to push all artifacts in the Demo/dist directory to the artifact repository.
twine upload -r coding-pypi dist/*



After the artifact is pushed successfully, refresh the page to view the latest artifacts.

Pull

Based on the specific artifact retrieval guidelines in the PyPI artifact repository, you can execute pip install to retrieve artifacts.
pip install <artifact name>




Configure a Proxy

If you try to pull an artifact that does not exist in the CODING private repository, the system will try to pull from the configured proxy. You can add a third-party artifact source to obtain artifacts from the specific repository. Without the need for configuration, CODING will retrieve artifacts in sequence from top to bottom.



Use the command generated on the webpage, replace <package> with the package name to complete the pull. The artifact and its dependencies will be successfully pulled to the local machine and synchronized to the CODING Artifact Repository. The package source will be shown on the details page.
For detailed information about proxy settings, please refer to Artifact Repository Proxy.