pdm-project / pdm

A modern Python package and dependency manager supporting the latest PEP standards
https://pdm-project.org
MIT License
7.86k stars 392 forks source link

Allow installing packages without changing pyproject.toml #2907

Open SamoylovMD opened 4 months ago

SamoylovMD commented 4 months ago

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.

pawamoy commented 4 months ago

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.

sanmai-NL commented 2 months ago

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).

ramnes commented 3 weeks ago

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 👋 )