-
Notifications
You must be signed in to change notification settings - Fork 2.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
poetry show <package> now also shows which packages depend on it #2351
Conversation
Looks neat! Does this traverse the ancestry all the way to the root pyproject.toml, or just one level up from the specified package? |
@seansfkelley - it's the latter, it only specifies direct dependencies. I guess the reverse-tree approach would be more suitable for the traversal, which personally I find a bit too noisy, at least for the workflow I'm used to (maybe I just haven't tried a good solution though) - there's actually a PR open that aims to do it: #2086, though it has been stale for a while, so it'd be great if people could have a look at it since it looks quite promising. The required by in poetry show removes the noise and simply tells the dev hey, that's the list of libraries that use it and they specify these constraints - and yeah, now you see which one of those constraints restricts you from bringing that new feature in. I find it very useful whenever I need to integrate a minor/major bump coming from 3rd party dependency - I see whether it's supported or blocked in a simple way. I found that I'm usually aware of my project dependencies enough to kind of know where they're coming from considering higher levels - it's the versions that cause pain :) There's always an extra The reverse-tree, I guess, has a different use case. One I could think of would be analysing bigger open source projects that devs are new to. Actually, And then |
Great, thank you for the explanation! My usual use-case for needing to answer this question is that I've traced an issue through debugging to a particular package, and I want to know which of the dependencies I've declared is bringing it in so I can take (indirect) action to resolve the problem, usually by picking a better version for my dependency or seeing if I can just remove it. All that is to say -- it doesn't come up during version upgrades, so I don't have anything else to narrow down which packages are suspicious. In any case, this change would already make my life easier, even if it's not exactly what I'm looking for. |
@sdispater could this by any chance go in, considering that it's very small and has virtually no impact on the rest of the codebase? It's been a couple of months now that me and most of the people around who use Poetry, patching the releases with this - I even have a little bash function that does it. It's extremely useful for bigger projects. |
Just another bump/upvote for this. Very interested in this. |
Hello @snejus, I really like this one. Would you find some time to rebase your PR onto master? fin swimmer |
SonarCloud Quality Gate failed. 0 Bugs No Coverage information |
@finswimmer sorry, was a bit in a rush and forgot to switch the base branch. Is there anything else that's required from my side? |
I'm very sorry to ping you again @snejus. For some reasons the SonarCloud Code Analysis failed. We removed this check for now. So could you rebase once more? |
of course! :) |
79233c9
to
0460088
Compare
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.
Great 👍
@snejus, @finswimmer, I wonder, what are the reasons for not putting this feature into |
…hon-poetry#2351) * Add required_by list to pip show <package> command * Update poetry show pendulum documentation * Handle package name discrepancies * Lets not force typing then * issue-1906 Add the test back after rebase * issue-1906 Ignore trailing spaces in the tests
…hon-poetry#2351) * Add required_by list to pip show <package> command * Update poetry show pendulum documentation * Handle package name discrepancies * Lets not force typing then * issue-1906 Add the test back after rebase * issue-1906 Ignore trailing spaces in the tests
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Pull Request Check List
Partly resolves: #1906
#1906 Requested an ability to know why packages are required. Even though the suggestion outlined a reverse-tree based approach, I believe that this can also be solved using a more simple approach: by providing the
required by
information in thepoetry show <package>
output - done with just 15 lines of code.I had this patch applied locally since a couple of weeks ago and I found it extremely useful - there's no need to do
poetry show --tree | ag <package> -C 20
anymore just to find out where some 3rd party dependencies come from.Summary of what's been done:
commands/show.py
poetry show <package>
command - realised a test for this command didn't exist, so it tests both the default output and my changesdependencies
isn't supposed to have a colon at the end.Please see the screenshot below for a little teaser: