Skip to content

pip: recognize requirements layers from nested graph scans - #16972

Draft
Ahmed3lmallah wants to merge 1 commit into
mainfrom
copilot/pip-graph-requirements-path
Draft

Ahmed3lmallah wants to merge 1 commit into
mainfrom
copilot/pip-graph-requirements-path

Conversation

@Ahmed3lmallah

@Ahmed3lmallah Ahmed3lmallah commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

What are you trying to accomplish?

A pip graph job scoped to /requirements sees base.txt rather than requirements/base.txt and can drop it. Classify requirements by repository path in filtering, layer grouping, and single-manifest selection.

Anything you want to highlight for special attention from reviewers?

This only changes pip graphing. Ordinary update file discovery and snapshot identities are unchanged. Scheduling a refresh for overlapping parent snapshots is separate.

How will you know you've accomplished your goal?

New regression examples cover root and child scopes, -r references, and a single-file child scope. ruby -c on the changed Ruby files and git diff --check passed. A focused local harness using the actual requirements parser reproduced the empty child output on main and passed for root, child, and single-file cases with this patch. Full RSpec and end-to-end graph validation are pending.

Checklist

  • I have run the complete test suite to ensure all tests and linters pass.
  • I have thoroughly tested my code changes to ensure they work as expected, including adding additional tests for new functionality.
  • I have written clear and descriptive commit messages.
  • I have provided a detailed description of the changes in the pull request, including the problem it addresses, how it fixes the problem, and any relevant details about the implementation.
  • I have ensured that the code is well-documented and easy to understand.

Keep requirements classification consistent across root and nested scans without changing ordinary pip update discovery.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 18, 2026 19:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The helper rename leaves 21 examples raising NoMethodError, while a misplaced multi-layer expectation also causes the single-layer spec context to fail.

2 open issues
What changed in this PR

This PR makes pip dependency graphing recognize requirements layers by repository path, so nested scans retain files such as /requirements/base.txt. Ordinary update discovery and snapshot identities remain unchanged.

Changes:

  • Use repository paths consistently for requirements filtering, layer grouping, and single-manifest selection.
  • Add regression examples for root and nested scans, -r references, and single-layer scopes.
File Description
python/​spec/​dependabot/​python/​dependency_grapher_spec.rb Adds nested-scan and requirements-layer regression examples.
python/​lib/​dependabot/​python/​dependency_grapher/​requirements_layers.rb Classifies requirements files using their repository paths.
python/​lib/​dependabot/​python/​dependency_grapher.rb Applies the classifier to filtering and single-manifest selection.

Review effort: Balanced

def self.manifest_txt_filename?(path)
# Use the repository path so `requirements/base.txt` is classified the same from either scan directory.
sig { params(file: Dependabot::DependencyFile).returns(T::Boolean) }
def self.manifest_txt_file?(file)
end
end

include_examples "graphs the same requirements files"

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants