JetBrains Space Help

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

  1. Connect to the repository in Space:

    • Add a repository link to the .pypirc file. For example:

      [distutils] index-servers = space-mypypi [space-mypypi] repository =

      Here index-servers is an identifier of our Space repository. You can specify any name for it.

    • Generate a personal token.

    • Use the keyring tool to save the generated token. For example, if your Space username is Anna:

      keyring set Anna

      When 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 is Anna and the token is abc1234:

      [distutils] index-servers = space-mypypi [space-mypypi] repository = username = Anna password = abc1234
  2. 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/*
Last modified: 01 July 2022