Publish Python Packages
Suppose you have a Python package that you want to publish to your Python Package Index in Space using one of the tools:
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/legacy 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/*
Publish packages using the Poetry command-line tool
Connect to the repository in Space:
Add a repository link using the poetry config command:
poetry config repositories.space-python https://pypi.pkg.jetbrains.space/mycompany/p/my-python-project/mypypi/legacyUse the poetry config command to store credentials for your repository. For example, if your Space username is
Anna
:poetry config http-basic.space-python Anna token_goes_here
Publish the package to the repository using the poetry publish command:
poetry publish --repository=space-python