豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

fix python fetching when environment markers present#14559

Merged
jakecoffman merged 3 commits intomainfrom
fix-fetching-env-markers
Mar 27, 2026
Merged

fix python fetching when environment markers present#14559
jakecoffman merged 3 commits intomainfrom
fix-fetching-env-markers

Conversation

@jakecoffman
Copy link
Copy Markdown
Member

@jakecoffman jakecoffman commented Mar 27, 2026

What are you trying to accomplish?

Fixes an error in Python projects when there is a semicolon present near a path-based dependency.

Semicolons unsed in this way are environment markers defined in PEP-508 so we just needed to add them to the regex to strip them out.

Anything you want to highlight for special attention from reviewers?

How will you know you've accomplished your goal?

I tested this against a repo that was failing and it's working now. Unit test also passes.

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.

@jakecoffman jakecoffman mentioned this pull request Mar 27, 2026
5 tasks
@jakecoffman jakecoffman marked this pull request as ready for review March 27, 2026 16:22
@jakecoffman jakecoffman requested a review from a team as a code owner March 27, 2026 16:22
Copilot AI review requested due to automatic review settings March 27, 2026 16:22
@jakecoffman
Copy link
Copy Markdown
Member Author

The failing test is unrelated and fixed by #14562

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes Python requirements file fetching when path-based dependencies include PEP-508 environment markers (semicolon syntax), preventing Dependabot from mis-parsing the path and incorrectly erroring on missing local wheel/sdist artifacts.

Changes:

  • Update requirements path-dependency regexes to stop path capture at ; (environment marker delimiter).
  • Add a GitHub API fixture for a requirements.txt containing a local .whl dependency with an environment marker.
  • Add an RSpec case ensuring environment markers don’t cause path-dependency fetch failures.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
python/lib/dependabot/python/shared_file_fetcher.rb Adjusts path-dependency scanning regexes to exclude ; so env markers aren’t treated as part of the path.
python/spec/dependabot/python/file_fetcher_spec.rb Adds coverage for a local wheel path with env markers to ensure fetching doesn’t raise.
python/spec/fixtures/github/requirements_with_whl_env_marker.json Adds a fixture requirements content including a wheel path plus a PEP-508 marker.

Copy link
Copy Markdown
Contributor

@brrygrdn brrygrdn left a comment

Choose a reason for hiding this comment

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

Nice find 👍🏻

@jakecoffman jakecoffman merged commit 7b76ada into main Mar 27, 2026
93 checks passed
@jakecoffman jakecoffman deleted the fix-fetching-env-markers branch March 27, 2026 17:16
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.

3 participants