PyCharm 2024.2 Help

Use pyproject.toml

You can specify the project dependencies in the pyproject.toml file inside the project directory. You can create pyproject.toml manually or configure a Poetry environment, so that it's created automatically.

PyCharm provides code completion for packages names, and a quick-fix to install the missing dependencies.

Specify project dependencies

  1. Open pyproject.toml in the editor.

  2. Locate or create the [project] section.

  3. Specify the names of the required packages as strings in the dependencies array.

    When you start typing the package name, PyCharm provides completion options:

    Code completion for packages names in pyproject.toml

    Press Enter to insert the suggestion.

You can also provide the optional dependencies of the project in the [project.optional-dependencies] section or specify the build-time dependencies in [build-system.requires].

If the name of the package is highlighted, it means that this package has not been installed for the current Python interpreter.

Install missing packages

  1. Place the caret at the highlighted package name and press Alt+Enter.

  2. Click Install package.

Quick-fixes for installing packages in pyproject.toml
Last modified: 11 February 2024