-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pip install --dry-run {package}
#8032
Comments
This sounds like a good feature request and one I have been pondering about too. A slightly different way to frame it is to say "--dry-run" should output the list of transactions that pip install would apply to the database of installed distributions (PEP 376). I.e. which packages would be added, upgraded, and possibly left unchanged. A machine readable output would enable higher level use cases such as the creation of a lockfile from a list of top level requirements (à la Such a use case does not necessarily require building of all dependencies (only obtaining their metadata). So full build of dependencies could be an option. |
A problem with |
@uranusjr Building source and sdist should definitely be part of a proper "dry run". If it fails, it means that the dry run fails meaning that an actual "wet" installation would also fail. This is highly valuable information though I'd also agree with @sbidoul that it could be made optional (e.g. |
I'm pretty sure there's an existing issue for this feature request. |
Okay, housekeeping done. If someone thinks what I did there was inappropriate, please holler here. :P |
What's the problem this feature will solve?
In certain scenarios I want to know whether pip could actually install a package and its dependencies - without modifying my Python installation at all.
Some of the related questions:
Describe the solution you'd like
I want to be able to run
pip install --dry-run {package}
. The exit code of the process should indicate "should work" or "probably does not work". The output should provide detailed information.Ideally, pip performs every operation necessary to install the package - except ultimately changing the current environment. It may (and should) therefore download dependencies, build wheels where applicable, etc.
Real world uses: Similar to plenty of other package management tools which do implement this feature, I see the primary use in head-less, automated installs - i.e. where pip is not triggered by a user but by other tools and software packages. This feature would allow a much more graceful (in advance) handling of failures.
Alternative Solutions
There are plenty of bad and/or risky and/or notoriously unreliable and/or resource-intensive workarounds. Examples:
pip-sync -n
(i.e. a third party tool) which has a few massive limitations herepip freeze | grep -f requirements.txt | sort | diff -y --suppress-common-lines - <(sort requirements.txt)
which assume that you have arequirements.txt
file available - again plenty of problems and unsolvable edge casesAdditional context
This topic is not new. For reference:
pip install --no-install
/pip install --no-download
The text was updated successfully, but these errors were encountered: