GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — poetry show <package> now also shows which packages depend on it by snejus · Pull Request #2351 · python-poetry/poetry

Conversation

@snejus

@snejus snejus commented Apr 26, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Pull Request Check List

Partly resolves: #1906

  • Added tests for changed code.
  • Updated documentation for changed code.

#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 the poetry 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:

  • 15 lines of business logic in commands/show.py
  • A test for poetry show <package> command - realised a test for this command didn't exist, so it tests both the default output and my changes
  • Documentation update and a little typo fix, where dependencies isn't supposed to have a colon at the end.

Please see the screenshot below for a little teaser:
image

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

lucasrijllart, tueda, alejandro-angulo, 1ace, and rino0601 reacted with thumbs up emoji
All reactions
  • 👍 5 reactions
@snejus

snejus commented Apr 26, 2020

Copy link
Copy Markdown
Contributor Author

image

Can include this as an extra if anyone's keen ;)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@snejus snejus mentioned this pull request Apr 26, 2020
Display why package was installed #1906
Closed
2 tasks done
@seansfkelley

seansfkelley commented Apr 26, 2020

Copy link
Copy Markdown

Looks neat! Does this traverse the ancestry all the way to the root pyproject.toml, or just one level up from the specified package?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@snejus

snejus commented Apr 26, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

@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 pip show <parent-package> command available otherwise.

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. poetry install -vvv -> sees a dodgy package -> ah where did this come from? -> runs poetry show --tree --reverse <dodgy-package> (or --why, as in the PR above) -> sees a nice overview of what's going on.

Actually, pipdeptree has implemented it in a way, see a screenshot below for six usage within poetry:
image

And then poetry show six - obviously it's an unfair comparison considering the looks 😅
image

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@snejus

snejus commented Apr 26, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

image
Forgot to mention - pip implements the show command too - though since good looking or dependency management aren't exactly the keywords usually associated with pip, it's only useful as a backup.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@seansfkelley

seansfkelley commented Apr 27, 2020

Copy link
Copy Markdown

Great, thank you for the explanation! pipdeptree looks quite handy.

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@snejus

snejus commented Sep 13, 2020

Copy link
Copy Markdown
Contributor Author

@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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@finswimmer finswimmer added area/cli Related to the command line kind/feature Feature requests/implementations area/ux Features and improvements related to the user experience labels Sep 15, 2020
@finswimmer
finswimmer requested a review from a team September 15, 2020 18:13
@K900

K900 commented Jan 28, 2021

Copy link
Copy Markdown
Contributor

Just another bump/upvote for this. Very interested in this.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@finswimmer

finswimmer commented Jul 6, 2021

Copy link
Copy Markdown
Member

Hello @snejus,

I really like this one. Would you find some time to rebase your PR onto master?

fin swimmer

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@snejus
snejus force-pushed the fix-issue-1906 branch from e9cbbe7 to 0b6abe4 Compare July 6, 2021 22:07
@sonarqubecloud

sonarqubecloud Bot commented Jul 7, 2021

Copy link
Copy Markdown

SonarCloud Quality Gate failed.

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
9.6% 9.6% Duplication

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@finswimmer
finswimmer changed the base branch from develop to master July 7, 2021 04:31
@finswimmer
finswimmer requested review from a team and removed request for a team July 7, 2021 04:32
@snejus

snejus commented Jul 12, 2021

Copy link
Copy Markdown
Contributor Author

@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?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@finswimmer

finswimmer commented Sep 15, 2021

Copy link
Copy Markdown
Member

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?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@snejus

snejus commented Sep 15, 2021

Copy link
Copy Markdown
Contributor Author

of course! :)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

snejus and others added 6 commits September 15, 2021 19:53
@snejus
Add required_by list to pip show <package> command
a62f03d
@snejus
Update poetry show pendulum documentation
5241921
@snejus
Handle package name discrepancies
f872682
@snejus
Lets not force typing then
7b67cbe
@snejus
issue-1906 Add the test back after rebase
77d3954
@snejus
issue-1906 Ignore trailing spaces in the tests
0460088
@snejus
snejus force-pushed the fix-issue-1906 branch from 79233c9 to 0460088 Compare September 15, 2021 18:53
finswimmer
finswimmer approved these changes Sep 19, 2021
View reviewed changes

@finswimmer finswimmer left a comment

Copy link
Copy Markdown
Member

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 👍

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@finswimmer
finswimmer merged commit 3519d2b into python-poetry:master Sep 19, 2021
@spirit-q2

spirit-q2 commented Oct 26, 2021

Copy link
Copy Markdown
Contributor

@snejus, @finswimmer, I wonder, what are the reasons for not putting this feature into 1.1.11?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

1nF0rmed pushed a commit to 1nF0rmed/poetry that referenced this pull request Nov 15, 2021
@snejus @1nF0rmed
poetry show <package> now also shows which packages depend on it (pyt…
97fc0eb
…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
@snejus
snejus deleted the fix-issue-1906 branch November 27, 2021 02:34
@finswimmer finswimmer mentioned this pull request Mar 6, 2022
Release 1.2.0b1 #5280
Merged
@nicolassanmar nicolassanmar mentioned this pull request Feb 15, 2024
poetry show $DEPENDENCY should also list the user defined dependencies that cause the inclusion of this $DEPENDENCY #8975
Open
2 tasks done
@github-actions

github-actions Bot commented Feb 29, 2024

Copy link
Copy Markdown

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

@finswimmer finswimmer finswimmer approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

area/cli Related to the command line area/ux Features and improvements related to the user experience kind/feature Feature requests/implementations

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Display why package was installed

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@snejus @seansfkelley @K900 @finswimmer @spirit-q2
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.