[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

Closed
opened 2026-11-04 01:56:10 +07:00 by bsakaguchi · 1 comment
Owner

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), but wheels is 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", running python packaging/lock_wheels.py --target linux-x86_64 wrote a lock with no typing-extensions at all - while requirements-monitor.txt pins textual==8.2.8, and textual declares typing-extensions<5.0.0,>=4.4.0 with 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_64 on this Linux box removed colorama==0.4.6 from the Windows lock - the package the committed lock carries - and a newly added pixeltable-pgserver pin (sys_platform == "win32") could not be added by the run either, and --check on 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 --check reports 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_DEFAULTS and the like are not involved; this is the packaging tool, no default changed.

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), but `wheels` is 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"`, running `python packaging/lock_wheels.py --target linux-x86_64` wrote a lock with **no typing-extensions at all** - while requirements-monitor.txt pins `textual==8.2.8`, and textual declares `typing-extensions<5.0.0,>=4.4.0` with 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_64` on this Linux box **removed `colorama==0.4.6`** from the Windows lock - the package the committed lock carries - and a newly added `pixeltable-pgserver` pin (`sys_platform == "win32"`) could not be added by the run either, and `--check` on 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 `--check` reports 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_DEFAULTS` and the like are not involved; this is the packaging tool, no default changed.
Author
Owner

@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:

  1. Re-test on 0.2.11. It may already be fixed. Write down what you see.
  2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other].
  3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system.
  4. Comment /reopen. A check runs and either reopens the issue or lists what is still missing.

The rules are in CONTRIBUTING.md.

<!-- gh-comment-id:6660598830 --> @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: 1. Re-test on 0.2.11. It may already be fixed. Write down what you see. 2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other]. 3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system. 4. Comment `/reopen`. A check runs and either reopens the issue or lists what is still missing. The rules are in [CONTRIBUTING.md](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#2038
No description provided.