pdm icon indicating copy to clipboard operation
pdm copied to clipboard

Allow installing packages without changing pyproject.toml

Open SamoylovMD opened this issue 1 year ago • 3 comments

I want to migrate my team to PDM as a default build manager. We use PyCharm as IDE with remote debug server, which works upon installation of pydevd-pycharm package for the specific PyCharm version (more info). Each member of my team uses different version of PyCharm, however pyproject.toml is shared across the team so I cannot add my own version there because it won't work for the rest of the team.

I didn't find a way to install a package into project virtualenv without modifying pyproject.toml. Did I miss something, or is this feature not implemented? If it's not — I propose to add some option to pdm add command to avoid modification of pyproject.toml, much alike there is an option --no-lock for pdm add. Alternatively, maybe there is a way to allow pdm install accept package definitions as argument so it would install not from lockfile but a direct package into environment?

tldr: allow package installation to environment without adding it to shared files.

SamoylovMD avatar May 28 '24 12:05 SamoylovMD

It might be possible to use a hook such as post_install to run a pip install command inside the venv (or outside, but targetting the venv's site-packages with the -t option). If you can detect the version of PyCharm currently installed on the system, then maybe you can automatically compute which version of pydevd-pycharm to install from the hook.

pawamoy avatar May 28 '24 14:05 pawamoy

Is pdm add --global usable for you? This should be part of provisioning the workstations of your team members, rather than part of working on a specific software product (pyproject.toml).

sanmai-NL avatar Jul 08 '24 12:07 sanmai-NL

Not usable in my use case, because we version our devtools (with mise) and want to provide standard developer environments. Ended up managing the virtualenv with Python itself and installing pdm within the virtualenv, so that pip install ipython (for example) can be used.

(PS: coucou @pawamoy 👋 )

ramnes avatar Sep 11 '24 14:09 ramnes