JetBrains Space Help

Get Python Packages

The typical way of getting a Python package is installing it using the pip, Pipenv or Poetry tools.

  1. Connect to the repository in Space:

    1. Add a repository link to the pip config file. For example:

      [global] extra-index-url = https://pypi.pkg.jetbrains.space/mycompany/p/my-python-project/mypypi/simple
    2. Generate a personal token.

    3. 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 Anna

      When asked for a password, provide the generated token.

      An alternative to the keyring tool would be storing the token in the pip config file. Note that this way is less secure. For example, if your username is Anna and the token is abc1234:

      [global] extra-index-url = Anna:abc1234@https://pypi.pkg.jetbrains.space/mycompany/p/my-python-project/mypypi/simple
  2. Install a Python package with one of the following ways:

    • Add a dependency to the requirements.txt file.

    • Use the pip command-line tool: mypackage:

      pip install package-name
  1. Connect to the repository in Space:

    1. Add a repository link to the Pipfile file. For example:

      [[source]] url = "https://$USERNAME:$PASSWORD@https://pypi.pkg.jetbrains.space/mycompany/p/my-python-project/mypypi/simple" verify_ssl = false name = "space-mypypi"
    2. Generate a personal token.

    3. Specify your Space username and the generated token in the .env file. For example, if your username is Anna and the token is abc1234:

      USERNAME=Anna PASSWORD=abc1234
  2. Load the .env file by running:

    pipenv shell
  3. If the required package is specified in the Pipfile, run:

    pipenv install

    If you want to add a new dependency, run:

    pipenv install package-name
  1. Connect to the repository in Space using the poetry config command:

    1. Add the package source to the pyproject.toml file:

      [[tool.poetry.source]] name = "space-mypypi" url = "https://pypi.pkg.jetbrains.space/mycompany/p/my-python-project/mypypi/"
    2. Generate a personal token.

    3. Use the poetry config command to store credentials for your repository. For example, if your Space username is Anna:

      poetry config http-basic.space-mypypi Anna token_goes_here
  2. Use the poetry add command to create a dependency in your project:

    poetry add package_name
Last modified: 23 November 2022