Skip to content

Conversation

@dhellmann
Copy link
Member

@dhellmann dhellmann commented Sep 6, 2025

Add a new --reduce flag to the graph to-dot command that filters the
dependency graph to only include nodes with fromager customizations
(overrides, settings, patches, plugins, or pre-built wheels).

The reduced graph preserves dependency relationships by creating direct
edges between customized nodes, skipping intermediate nodes without
customizations. Original requirement specifications are tracked and
displayed in edge labels for better clarity.

Key changes:

  • Add --reduce command line option to to-dot command
  • Implement has_customizations() to identify nodes with customizations
  • Implement reduce_graph() to build filtered dependency relationships
  • Track original requirement strings for proper edge labeling
  • Use req_type.is_build_requirement property for build dependency checks

This feature helps visualize which packages in a dependency tree actually
have fromager customizations while maintaining essential dependency
relationships.

Fixes #715

Cursor chat transcript: https://gist.github.com/dhellmann/e362954e00a7270dcc71037382f53853

Add a new --reduce flag to the graph to-dot command that filters the
dependency graph to only include nodes with fromager customizations
(overrides, settings, patches, plugins, or pre-built wheels).

The reduced graph preserves dependency relationships by creating direct
edges between customized nodes, skipping intermediate nodes without
customizations. Original requirement specifications are tracked and
displayed in edge labels for better clarity.

Key changes:
- Add --reduce command line option to to-dot command
- Implement has_customizations() to identify nodes with customizations
- Implement reduce_graph() to build filtered dependency relationships
- Track original requirement strings for proper edge labeling
- Use req_type.is_build_requirement property for build dependency checks

This feature helps visualize which packages in a dependency tree actually
have fromager customizations while maintaining essential dependency
relationships.

Cursor chat transcript: https://gist.github.com/dhellmann/e362954e00a7270dcc71037382f53853

Co-authored-by: Claude 3.5 Sonnet (Anthropic AI Assistant)
Signed-off-by: Doug Hellmann <[email protected]>
@dhellmann dhellmann requested a review from a team as a code owner September 6, 2025 21:54
@dhellmann
Copy link
Member Author

Here are a few sample output files showing the difference between a full graph and a reduced graph:

docling-graph.json.dot.pdf
docling-graph.json-reduced.dot.pdf
torch-cuda-graph.json.dot.pdf
torch-cuda-graph.json-reduced.dot.pdf

@LalatenduMohanty
Copy link
Member

@dhellmann can you pass a graph file which has packages with customization, so that it would be easier for me to test the PR?

Rename the --reduce command line option to --overrides-only to better
reflect its purpose of filtering the dependency graph to show only nodes
with fromager overrides.

Update the help text to clarify that it includes nodes with settings,
patches, or plugins, removing the redundant mention of "customizations"
and "overrides" in the same description.

Co-authored-by: Claude 3.5 Sonnet (Anthropic AI Assistant)
Signed-off-by: Doug Hellmann <[email protected]>
@dhellmann
Copy link
Member Author

@dhellmann can you pass a graph file which has packages with customization, so that it would be easier for me to test the PR?

The graph file itself doesn't record which packages had customizations, though we could add that. I'll upload the graph files I used to produce the PDFs but you'll have to run fromager with the context from our downstream configuration repo to get the same output.

docling-graph.json

torch-cuda-graph.json

Simplify the logic for reducing a graph by moving the check into the
PackageBuildInfo class.
Copy link
Contributor

@rd4398 rd4398 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good! I see there are few comments on MR so I will wait for them to be resolved before I hit approve

Copy link
Contributor

@rd4398 rd4398 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@LalatenduMohanty LalatenduMohanty merged commit e0681a3 into python-wheel-build:main Oct 29, 2025
111 of 112 checks passed
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.

simplified graph mode

4 participants