Does PyCharm support PDM / PEP 582?

Answered

Greetings,

While looking at Pipenv performance issues a colleague pointed me to PDM [1] a project that aims to use PEP 582 [2], which defines a mechanism for finding packages in a project's `__pypackages__` directory.  When opening a small test project in PyCharm, PDM is not automatically detected, nor are the local packages found and made available to the IDE.

Is there any way to configure PyCharm to include the local packages for use in a project?

Thank you!

-Roberto.

[1] https://pypi.org/project/pdm/

[2] https://www.python.org/dev/peps/pep-0582/#specification

1
2 comments

PyCharm doesn't have a feature for configuring it automatically yet. I filed a feature request to our issue tracker about proper PDM support https://youtrack.jetbrains.com/issue/PY-49588, feel free to vote for it to help us better prioritize it.

Any directory, including the one containing those local packages, can be added to your Interpreter Paths https://www.jetbrains.com/help/pycharm/installing-uninstalling-and-reloading-interpreter-paths.html

which will make them available to PyCharm's code insight.

0

Sergey Karpov thank you for filing the feature request for PDM support, hopefully JetBrains will consider and implement soon.

The __pypackages__ directory can be added to the interpreter paths — in the case of using PDM the interpreter will be a 'base' Python interpreter, not a virtual environment, so it would be that each projects' specific __pypackages__ directory would be listed in the base interpreter, is that so? This may cause issues between projects.

The other, per project, option (which is mentioned on the PDM website https://pdm.fming.dev/#pycharm) is to add it as a sources root.

Preferences >> Project >> Project Structure 

Mark __pypackages__/<major.minor>/lib as 'Sources'.

I have found that that works cleanly and packages installed by PDM outside of PyCharm are then immediately found in the UI.

 

0

Please sign in to leave a comment.