pipenv icon indicating copy to clipboard operation
pipenv copied to clipboard

`pipenv install --system <pkg>` and `pipenv update --system`

Open bblanchon opened this issue 2 years ago • 9 comments

Hi,

Thank you very much for pipenv; I love this tool ❤️

Is your feature request related to a problem? Please describe.

I'm using pipenv to install Python dependencies in Docker containers. I don't want to use virtual environments because Docker already provides this isolation. Therefore, I call pipenv install --system to install the packages globally. So far, so good.

However, every time I need to add a new dependency, I need to run two commands:

pipenv install <pkg>
pipenv install --system

Similarly, every time I need to update the dependencies, I must do:

pipenv update
pipenv install --system

Describe the solution you'd like

Allow --system to be combined with package installation, like so:

pipenv install --system <pkg>

Similarly, allow --system with the update command like so:

pipenv update --system

This feature should work transparently with PIPENV_SYSTEM so that one can run regular pipenv commands without worrying if in a container or a virtual environment.

Describe alternatives you've considered

I'm currently using the two-command solution described above. They work but are error-prone and create an unused virtual environment.

Additional context

I'm using Docker, not only for production but also for development, using devcontainers. That's why I need to update and install packages frequently.

bblanchon avatar Jan 30 '23 17:01 bblanchon

PS: I forgot to include the error messages I get with pipenv 2022.12.19.

$ pipenv install --system pkg
Loading .env environment variables...
Warning: --system is intended to be used for Pipfile installation, not installation of specific packages. Aborting.
Usage: pipenv install [OPTIONS] [PACKAGES]...

ERROR:: See also: {} --deploy flag

$ pipenv update --system
Loading .env environment variables...
Usage: pipenv update [OPTIONS] [PACKAGES]...
Try 'pipenv update -h' for help.

Error: No such option: --system

bblanchon avatar Feb 01 '23 09:02 bblanchon

@bblanchon you might be interested in my very recent work on an pipenv upgrade command -- https://github.com/pypa/pipenv/pull/5617

Its my answer to getting rid of --keep-outdated and --selective-upgrade and probably replaces pipenv update with a more powerful functionality. Would love to get some feedback.

matteius avatar Feb 19 '23 23:02 matteius

@matteius, I'm OK with update's behaviors; I just want to remove the restriction with the --system flag. Sure, I could do pipenv upgrade && pipenv install --system, but it's not as convenient as pipenv update --system. Moreover, I love the simplicity of pipenv, so I prefer we don't add new commands.

bblanchon avatar Feb 20 '23 07:02 bblanchon

@bblanchon pipenv update does something very different from what pipenv upgrade does, and I am not convinced to replace update with the functionality of upgrade yet so hence prototyping a new command. It's working towards fixing bugs and providing the right set of functionality, which is more important than any perceived simplicity, since under the hood its very not simple at all to maintain, the goal is to reach more maintainable code paths. We have added other new commands such as pipenv requirements in the last year which greatly helped to reduce complexity and bugs in the much overloaded code paths by removing the pipenv lock -r flag.

matteius avatar Feb 20 '23 07:02 matteius

Plus that branch removes one of the flawed validation checks on the --system flag . What is it that the update command does that is desirable? Its one of the few commands I just haven't made much use of, so any insights there would be helpful.

matteius avatar Feb 20 '23 07:02 matteius

I've taken a stab at updating the update command as well -- it doesn't yet address your concerns about the --system flag but its heading in the right direction towards making that happen.

matteius avatar Feb 20 '23 08:02 matteius

Hi @matteius, Any progress on this feature?

bblanchon avatar Aug 02 '23 08:08 bblanchon

@bblanchon not really -- revisiting the system flag is one of the next big things on the list though after releasing the refactor away from requirementslib which is out for PR and solves a number of edge cases with extras installs.

matteius avatar Aug 03 '23 01:08 matteius

OK, no problem; I'll continue calling pipenv twice. Let me know if there is anything I can do.

bblanchon avatar Aug 03 '23 07:08 bblanchon