Skip to content
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

Graphs does not include locally optional, but globally mandatory dependency #415

Closed
dilyanpalauzov opened this issue Sep 29, 2024 · 1 comment
Labels

Comments

@dilyanpalauzov
Copy link

What pipdeptree version are you using?

2.23.4

Are you running pipdeptree in a virtual environment?

Yes

Describe the problem

In my virtualenv I want to see which package is required from where, so that I can remove not needed anymore packages. That is, I want to check only on the top level, if I need the package and if I do not want it, I can assume that no package needs it, and it can be removed. Here a simplified example:

$ pipdeptree --python=/home/mailmanweb/bin-host/python

cmarkgfm==2024.1.14
└── cffi [required: >=1.15.0, installed: 1.17.1]
    └── pycparser [required: Any, installed: 2.22]
postorius==1.3.13
└── readme_renderer [required: Any, installed: 44.0]
    ├── docutils [required: >=0.21.2, installed: 0.21.2]
    ├── nh3 [required: >=0.2.14, installed: 0.2.18]
    └── Pygments [required: >=2.5.1, installed: 2.18.0]

I have installed postorius, I have not installed cmarkgm, so the above output suggests, that I can remove cmarkgfm. But I cannot:

postorius’ pyproject.toml contains:

dependencies = [
   "readme_renderer[md]",
   "other_requirements"
]

and readme_renderer’s pyproject.toml includes:

[project.optional-dependencies]
md = ["cmarkgfm>=0.8.0"]

So cmarkgfm is an indirect dependency of postorius, but this is not shown in the graph of pipdeptree. In this case it is a global mandatory dependency, as it as a must to have according to Postorius.

The installed ~/lib/python3.10/site-packages/postorius-1.3.13.dist-info/METADATA does contain Requires-Dist: readme_renderer[md] and the installed ~/lib/python3.10/site-packages/readme_renderer-44.0.dist-info/METADATA has Provides-Extra: md Requires-Dist: cmarkgfm >=0.8.0 ; extra == 'md'. So the dependency information is there, but is not utilized by pipdeptree.

@dilyanpalauzov dilyanpalauzov added bug tobeconfirmed To be confirmed after more investigation labels Sep 29, 2024
@kemzeb
Copy link
Collaborator

kemzeb commented Sep 29, 2024

Thanks for the bug report. Currently pipdeptree does not play well with extras and this particular issue is being tracked in #107. This issue has been up for some time, but (somewhat) recently we now have the capability to actually parse and work with extras due to some internal API changes we made. I am interested in seeing this worked on and will look into it when I get the time.

@kemzeb kemzeb closed this as completed Sep 29, 2024
@kemzeb kemzeb removed the tobeconfirmed To be confirmed after more investigation label Sep 29, 2024
@kemzeb kemzeb closed this as not planned Won't fix, can't repro, duplicate, stale Sep 29, 2024
@dilyanpalauzov dilyanpalauzov changed the title Graps does not include locally optional, but globally mandatory dependency Graphs does not include locally optional, but globally mandatory dependency Sep 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants