Publish Python Packages
Suppose you have a Python package that you want to publish to your Python Package Index in Space using the Twine tool.
Publish packages using the Twine command-line tool
Connect to the repository in Space:
Add a repository link to the .pypirc file. For example:
[distutils] index-servers = space-mypypi [space-mypypi] repository = https://pypi.pkg.jetbrains.space/mycompany/p/my-python-project/mypypi/legacyHere
index-servers
is an identifier of our Space repository. You can specify any name for it.Use the keyring tool to save the generated token. For example, if your Space username is
Anna
:keyring set https://pypi.pkg.jetbrains.space/mycompany/p/my-python-project/mypypi/simple AnnaWhen asked for a password, provide the generated token.
An alternative to the
keyring
tool would be storing the token in the.pypirc
file. Note that this way is less secure. For example, if your username isAnna
and the token isabc1234
:[distutils] index-servers = space-mypypi [space-mypypi] repository = https://pypi.pkg.jetbrains.space/mycompany/p/my-python-project/mypypi/legacy username = Anna password = abc1234
Upload the package to the repository using the
twine
tool. For example, we suppose that the package is located in the./dist
directory:twine upload -r space-mypypi dist/*