-
Notifications
You must be signed in to change notification settings - Fork 3.1k
'pip freeze PKG' outputs the installed version of PKG and its dependencies #1946
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 freeze PKG' outputs the installed version of PKG and its dependencies #1946
Conversation
…and its recursive dependencies.
I created this pull request as a proof-of-concept. I didn't took too much care of the tests or the code style. Because I guess the feature/usage has to be discussed/accepted first. And then obviously I would do my best to make this pull-request mergeable. |
for dep in dist.requires(): | ||
dependencies.add(dep.project_name) | ||
dependencies.update(recursive_dependencies([dep.project_name])) | ||
except KeyError: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This except could be moved at line 412 to not catch exception from anywhere else.
…endencies()' to 'pip.util.get_recursive_dependencies()'. This function now takes a list of positional arguments (was a list as first positional argument).
The Travis build looks nearly good, except some timeout error: https://travis-ci.org/pypa/pip/builds/30765608 |
Restarted |
Thanks @Ivoz :) The latest py27 build failed with errors (including some timeout errors). Still, I think errors are not related to the changes I introduced... or I cannot figure out how they are related. Any idea? |
\o/ the build passed! Looks like this pull-request does not break current features. If it is accepted, I guess the docs (and perhaps more tests) have to be updated too! I am okay to do it, but I'd like some feedback about the concept before I put more efforts in the docs. |
Any comments about this feature? Should I ask the question on another channel? |
@thedrow: do you have examples about these tests? What should they check? |
#1308 is similar but simpler. Maybe an option --with-dependencies could reconciliate the two propositions... The addition of "Requires recursive" to pip show is a nice idea though. |
#858 is an other one |
@thedrow: Added functional tests in tests/functional/test_freeze.py @xavfernandez: I changed the feature to look like #1308:
|
:( I updated the pull-request on top of recent "develop" branch... perhaps it was not a good idea. |
…es recursive' in 'pip show'.
@megies: does this pull-request match yours? |
Note: just discovered pipdeptree by @naiquevin. |
Mine can just be dropped, this looks way more advanced.. ;) |
Note: updated top-level description of ticket, to reflect pull-request's latest changes. |
I do not understand the build error :( On my computer, I have other errors, including errors related to pypa/pip-test-package... I do not know why the results are not the same as told by Travis. That said, I do not understand the relationship with this PR. |
Just updated the branch on top of "develop" and the tests are ok! |
I would want to compare this to pipdeptree (https://pypi.python.org/pypi/pipdeptree), which I've used in the past. This PR shows a flat view. pipdeptree shows a tree. But this PR has some interesting ways of invoking it. Maybe combine the two? |
Can you explain your vision of such a combination? What would you change in this PR? (so that I can update this PR accordingly) At the moment, I think I'm not against updating the format of recursive dependencies displayed by What about an additional |
Yes! ready for another round of review :) |
This has merge conflicts because my PR #2173 was merged. I can take a stab at fixing it. |
…edux Conflicts: pip/commands/freeze.py pip/commands/show.py tests/functional/test_show.py
Thanks @msabramo for the update! |
This one needs another look from a code contributor |
Any objections? |
I think the silence means that @pfmoore should merge this. 😄 |
As it's a behaviour change, I'd like to see a bit more than silence from the other devs... :-) Also, my comment above was meant to imply that I have no objections to someone doing the work to merge it (i.e., review the code, check the corner cases, ensure test coverage is OK, etc) not that I have done that work myself. I'll try to get some time to look at this a bit more deeply, but I don't have a need for it myself (I don't use pip freeze at all) so it may be a while before I get the chance. |
Hmmm. Well I'd feel bad about making you take time to review something that you have no vested interest in. Maybe someone else is more interested in this feature? |
Maybe a core contributor (other than @pfmoore who already looked a bit) look at what's proposed, if not the code? If the idea is not sound, then it can be closed and if it is, it can hopefully get reviewed and merged before it becomes outdated. |
Accidentally closed this, reopening. Sorry! |
Hello! As part of an effort to ease the contribution process and adopt a more standard workflow pip has switched to doing development on the If you do nothing, this Pull Request will be automatically closed by @BrownTruck since it cannot be merged. If this pull request is still valid, please rebase it against If you choose to rebase/merge and resubmit this Pull Request, here is an example message that you can copy and paste:
|
This Pull Request was closed because it cannot be automatically reparented to the Please feel free to re-open it or re-submit it if it is still valid and you have rebased it onto |
Too bad. This seems useful. |
This pull-request is a proposal around "recursive dependencies listing":
pip freeze PKG
outputs only version of PKG (a subset ofpip freeze
)pip freeze --recursive PKG
outputs versions of PKG and its (recursive) dependenciespip show PKG
also outputs "Require recursive: " which contains PKG's recursive dependencies (not PKG itself)My motivation (i.e. my use case) is to get a known good set of versions for a project.
As a developer, in order to get the known good set of versions of a project,
Given a Python environment (typically a virtualenv) where my project is installed,
Given I made sure project works in this environment (i.e. validated the "known good" set of versions)
Given the environment contains other projects and developer tools (such as bpython, pytest, tox, ...)
I want to get the versions of PKG and its dependencies only, i.e. ignore everything in the environment not required by my project.
An example... Let's install bpython, Sphinx and Fabric:
$ pip install bpython Sphinx Fabric
pip freeze
works as always:pip freeze bpython
shows only versions of bpython:pip freeze --recursive bpython
and its recursive dependencies, a.k.a. versions of everything related to bpython in the current Python environment:Same idea for
pip freeze Sphinx
andpip freeze --recursive Sphinx
:pip freeze bpython Sphinx
displays frozen versions for both bpython and Sphinx:pip show bpython Sphinx
has additional "Requires recursive: " items: