Hi all
I've opened a pull request on pip: https://github.com/pypa/pip/pull/1001 and I'd appreciate your thoughts, since I'm proposing a new top-level command.
I'd like to add a `pip check` command that verifies that all the current installed packages have all the dependencies they need. This command should verify that all required dependencies are present, and that those dependencies have compatible versions.
Rationale: it's very easy to write a requirements.pip file that installs packages with broken dependencies: https://github.com/pypa/pip/issues/775 -- this has occurred to me in practice.
pip also doesn't warn you if you manually uninstall a dependency, or manually install an incompatible version of a package.
It might be nice to make pip stricter, but it would be extremely helpful to have some way to verify that the current state of installed packages is correct.
I hope this isn't too controversial a suggestion. I'd really appreciate any thoughts you have on this, or ways it could be improved.
Realised I missed this email, sorry for the delay.
> How should the output look like? Can you paste example with command line and output on real system?$ pip check
$ pip install flask==0.10.1
$ pip install jinja2==2.3
Flask 0.10.1 has requirement Jinja2>=2.4, but you have Jinja2 2.3.
> So, the exact thing that you really want to do (original use case) is to validate if given requirements.txt doesn't conflict with requirements for already installed packages.I just want to verify that my environments are in a consistent state. Verifying a requirements.txt is much more complex.
Consider the following packages:A v1.0 depends on B v1.0+B v1.0 depends on C v1.0B v2.0 depends on C v2.0Now consider the following requirements.txt:A==1.0C>1.0To verify these requirements are feasible, we'd have to look at all the possible versions of B that could satisfy A in order to find a version that works with the requirement for C. This is much more complex, and I believe pip does not do this checking anywhere.
Checking the currently installed packages is a much simpler task, as we only need to consider the dependencies as they are currently installed.It would be good to fix this too. Inconsistent environments already exist in the wild, I thought the first step would be help users fix their environments. I'm not sure if the maintainers are interested in merging this feature though, or if there are any additional changes I need to make.
> Good catch. I think [manual install/uninstall breaking packages] should be fixed in `pip` first. Is there any ticket for that?