mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #4525] [Other] lock_wheels.py reads markers through the host's OS: it can delete a needed transitive, and cannot add the target's own pin #2038
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#2038
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @TheHubUser4860938 on GitHub (Oct 28, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4525
Problem: packaging/lock_wheels.py handles environment markers from the host's point of view, and that is wrong in both directions for a cross-OS lock. The archive installs its lock with
pip install --require-hashes --no-deps --only-binary=:all:, so a package missing from the lock is simply missing at runtime - nothing resolves it later.(a) A marker-excluded direct pin prunes a transitive that the target does need.
_dropped_for_target()(packaging/lock_wheels.py:65-90) returns the direct requirements whose marker is false for the target - its docstring says "Direct requirements whose environment marker is false for the target".build_lock()then skips every resolved wheel whose name is in that set (line 107 and 120-122), butwheelsis the whole resolved set, direct and transitive alike. Measured here: with one line added to requirements.txt,typing-extensions==4.16.0; sys_platform == "win32", runningpython packaging/lock_wheels.py --target linux-x86_64wrote a lock with no typing-extensions at all - while requirements-monitor.txt pinstextual==8.2.8, and textual declarestyping-extensions<5.0.0,>=4.4.0with no marker (PyPI metadata for that version), so the Linux archive lost a module its TUI needs. Without the marker the same run keeps it, which is what the committed lock shows today.(b) The target's own OS-conditional pins cannot arrive. pip evaluates the requirement files' markers for the host that runs the script (the docstring of the same function says so), so on a Linux host a Windows-only pin is never downloaded and the tool has no step that adds it back. Measured here: regenerating
--target windows-x86_64on this Linux box removedcolorama==0.4.6from the Windows lock - the package the committed lock carries - and a newly addedpixeltable-pgserverpin (sys_platform == "win32") could not be added by the run either, and--checkon the same host cannot see the difference because it compares against what that same host produced.Environment:
Strata Version: 0.2.7.1 (source checkout at tag v0.2.7.1, commit
46c152a1; the files discussed are upstream's own, unmodified by this fork)OS: Linux x86-64 - Runtime: Python 3.14 host, pip 26.2.1, locks regenerated for all four targets
Expected: (a) the prune applies only to names that are direct requirements, so a transitive that survives pip's resolution stays in the lock; (b) a target's OS-conditional direct pins are fetched with that target's platform tags, or the tool says plainly that a lock must be built on a host of that OS (and
--checkreports which pins the host could not see) instead of writing a lock that silently lost them.Suggested one-line shape for (a): intersect the prune with the direct names -
if name in drop and name in direct_names. For (b) the cheap fix is a warning naming the direct pins whose marker is true for the target but false for the host.Reproduction status: measured on this box for both symptoms (one
lock_wheels.py --target …run each, hashes compared against PyPI's digests for the platform wheels - the cross-OS wheels that pip could see were the right ones). The runtime consequence in a built archive is read from the install flags in the lock header; it was NOT tested by booting a built archive. Workaround this fork took: pin typing-extensions unconditionally, which is what the committed Linux/darwin locks already needed.Note:
STRATA_DEFAULTSand the like are not involved; this is the packaging tool, no default changed.@Niko1221 commented on GitHub (Nov 5, 2026):
Thanks for taking the time to report this.
Strata has changed a lot since this was opened, and 0.2.11 is out now, so many older reports no longer apply. We're closing issues older than a week that have had no new reports in the last week. Closed here does not mean rejected.
To reopen it takes about two minutes:
/reopen. A check runs and either reopens the issue or lists what is still missing.The rules are in CONTRIBUTING.md.