Add inline-script cache and interpreter utilities (PEP 723 PR 5b/16)#1655
Draft
StellaHuang95 wants to merge 2 commits into
Draft
Add inline-script cache and interpreter utilities (PEP 723 PR 5b/16)#1655StellaHuang95 wants to merge 2 commits into
StellaHuang95 wants to merge 2 commits into
Conversation
StellaHuang95
marked this pull request as ready for review
July 23, 2026 23:36
StellaHuang95
marked this pull request as draft
July 23, 2026 23:41
Cross-process file lock, venv Python-path helper, cancellation-safe process runner, and createWithProgress tracking options that inline-script environment creation builds on. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 39dcc6a3-0fbd-4f36-9d0f-68677de49c27
Cache-key tail normalization, cache-layout ownership/status checks with typed sidecar reads, and interpreter-constraint trimming that inline-script environment creation builds on. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 39dcc6a3-0fbd-4f36-9d0f-68677de49c27
StellaHuang95
force-pushed
the
pep723-pr5b-cache-utils
branch
from
July 24, 2026 00:13
09b7664 to
7363231
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Roadmap context
This is the second slice of PR 5 of 16. See #1651 for the full roadmap table.
InlineScriptEnvManagerskeletoncreate()happy path (manager + wiring)Why this PR
With the generic primitives from 5a in place, this PR lands the inline-script-specific utilities that
create()(5c) composes: a normalized dependency cache key, cache-layout ownership/status checks, and interpreter-constraint handling. These are pure functions with no manager wiring yet, so they are reviewed on their own.What this PR adds
Cache-key tail normalization (
src/common/inlineScriptCacheKey.ts): addsnormalizeRequirementTail, a quote-aware scanner that collapses whitespace and tightens comparator spacing (>= 1.0→>=1.0) in a requirement's version/marker tail while preserving quoted PEP 508 marker literals verbatim (e.g.python_version >= "3.11"). Direct-reference requirements (pkg @ https://…) are kept verbatim after the name and extras. The effect is that semantically identical dependency strings normalize to the same cache key, so they reuse the same cached environment.Cache-layout additions (
src/common/inlineScriptCacheLayout.ts):resolveCacheEntryPath(containment under the cache root),inspectOwnedCacheEntry(realpath ownership),getBaseInterpreterStatus(available | missing | unavailable),inspectMetaJson(typed sidecar read), and a strictervalidateMeta. The.meta.jsonsidecar schema is{ schemaVersion, baseInterpreterPath, baseInterpreterVersion, lastUsedAt }. UsesgetVenvPythonPathfrom 5a (the edge that stacks this PR on #1651).Interpreter-constraint trimming (
src/common/inlineScriptInterpreter.ts):pickCompatibleInterpreternow trimsrequires-python, so a whitespace-only constraint is treated as no constraint.Tests
inlineScriptCacheKey.unit.test.ts— canonicalization cases including marker literals and direct references.inlineScriptCacheLayout.unit.test.ts— the new containment, ownership, base-interpreter-status, and typed sidecar-read helpers.inlineScriptInterpreter.unit.test.ts— constraint trimming / selection.On this branch (5a + 5b)
npm run compile-testsis clean andnpm run unittestreports 1465 passing, 0 failing, 5 pending.User impact
None. These are pure utilities. Nothing calls the new code paths until the manager lands in 5c (#1656).
Merge order
Merge #1651 first, then this PR, then #1656.