Skip to content

PR #132 and additional commits on top of it#138

Closed
naiquevin wants to merge 13 commits intomainfrom
idiot-z-add_extra_require
Closed

PR #132 and additional commits on top of it#138
naiquevin wants to merge 13 commits intomainfrom
idiot-z-add_extra_require

Conversation

@naiquevin
Copy link
Copy Markdown
Contributor

No description provided.

Lorric Ziegler and others added 9 commits October 12, 2020 10:49
This handles the case where the same package is part of 2 different
extra_require profiles for eg.

  {'rsa': ['cryptography'],
   'signals': ['blinker'],
   'signedtoken': ['cryptography', 'pyjwt>=1.0.0']}

The above is the extra_require dict for oauthlib. Since 'cryptography'
is an extra require in multiple profiles, this caused duplicate
ReqPackage objects to be present in the tree.

As a result of deduplicating, no additional filtering is required in
presentation logic (ie. 'render_text' and 'dump_graphviz' functions).
If a package is specified using the '-p' option and it also happens to
be one of the dependencies of another package (also specified as part
of '-p' option), then the top level package itself is skipped from the
output.

For eg. consider following call

  $ pipdeptree -p 'abc,tox'

Now if 'tox' also happens to be the dependency of 'abc', then it's not
shown in the output unless '-a' flag (show all) is also specified.

This seems to be an old bug that has surfaced now with support for
extra requirements. There are cases where a package can be a dependent
of itself via extra requirements eg. tox depends on pluggy and
pluggy[dev] also depends on tox.
@naiquevin naiquevin force-pushed the idiot-z-add_extra_require branch from 108ca75 to beacb88 Compare November 8, 2020 18:37
A lot of code has been refactored in this commit
* master:
  Fix github checks due to set-env deprecation
  Shield newline symbol when generating labels for graphviz
@gaborbernat
Copy link
Copy Markdown
Member

Seems we'll no longer proceed with this.

@gaborbernat gaborbernat closed this Sep 4, 2022
@naiquevin
Copy link
Copy Markdown
Contributor Author

@gaborbernat This PR was for #107.

IIRC, this code was mostly working but as it is an intrusive change I wanted to do a beta release first. Never got to it. It's unlikely that I'll be working on it any time soon but JFYI because the PR is closed whereas issue #107 is still open. If anyone wants to pursue the functionality, this PR can be a good starting point.

@lo-zed
Copy link
Copy Markdown

lo-zed commented Sep 5, 2022

I am sorry, I would like to help, but I no longer need this functionality and I have no time to continue working on it.

@gaborbernat gaborbernat deleted the idiot-z-add_extra_require branch September 8, 2022 07:21
gaborbernat added a commit that referenced this pull request Mar 7, 2026
`pipdeptree` has long ignored extra/optional dependencies defined via
PEP 508 `extra` markers. When a user installs a package with extras
(e.g. `pip install jira[signedtoken]`), the extra dependencies appear as
unrelated top-level packages instead of showing up as children in the
dependency tree. This has been a recurring pain point since issue #107
was opened, and previous attempts (#132, #138) were never merged.

The new `--extras` / `-x` flag enables transitive resolution of extras
in the dependency tree. 🔍 It works by collecting extras from requirement
specifiers (e.g. `oauthlib[signedtoken]`), evaluating PEP 508 markers
with the correct extras context via `marker.evaluate({"extra": name})`,
and iterating until no new extras are discovered. Root packages (those
not depended on by anything else) automatically include all their
provided extras where the dependency is actually installed. Each extra
dependency is annotated with its extra name across all output formats —
text shows `extra: signedtoken`, JSON includes an `"extra"` field, and
graphviz/mermaid prefix edge labels with `[signedtoken]`.

The flag is off by default to preserve backward compatibility. No
existing behavior changes when `--extras` is not passed. The `from_pkgs`
constructor gained a keyword-only `include_extras` parameter, and the
extras resolution runs as a separate pass after the base DAG is built,
keeping the core construction logic clean.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants