Skip to content

Preserve pip patch markers and hash checks - #237

Open
Mikola Lysenko (mikolalysenko) wants to merge 1 commit into
mainfrom
codex/pip-vendor-marker
Open

Mikola Lysenko (mikolalysenko) wants to merge 1 commit into
mainfrom
codex/pip-vendor-marker

Conversation

@mikolalysenko

@mikolalysenko Mikola Lysenko (mikolalysenko) commented Sep 14, 2026

Copy link
Copy Markdown
Collaborator

LLM Description written by Codex:gpt-6-astra

Pip ignores an environment marker placed after a per-requirement --hash option. Vendored requirements now put the marker before the hash, so python_version < "2" skips the wheel on Python 3 and a matching marker installs it.

Hosted requirements now remove inline comments before preserving the marker. Previously, django==3.2.3 ; python_version >= "2" # explanation became a URL whose generated --hash was inside the comment, disabling the intended hash check. Reruns remain stable.

Validation:

  • 34 existing PyPI requirements wiring and revert tests pass.
  • Both hosted marker rewrite tests pass, including the inline-comment regression and rerun check.
  • A new integration test runs the actual CLI and real pip with true/false markers, checks patched six bytes, and verifies byte-for-byte revert.
  • Live hosted CLI output installs Django 3.2.3 with pip 26.2.1 and --require-hashes after the comment fix.

These bugs were found while backtesting hosted and vendored pip annotations in https://github.com/SocketDev/depscan/pull/26138. The completed matrix checks all 16 published pip majors; supported installs verify the patched Django file hashes.

Keep environment markers ahead of hash options in vendored
requirements. Strip hosted inline comments before appending hashes
so pip enforces them. Cover marker evaluation with real installs.

Assisted-by: Codex:gpt-6-astra
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.

2 participants