Skip to content

Add empty InlineScriptEnvManager skeleton behind internal flag (PEP 723 PR 4/16)#1610

Merged
StellaHuang95 merged 1 commit into
microsoft:mainfrom
StellaHuang95:pep723-pr4-manager-skeleton
Jun 24, 2026
Merged

Add empty InlineScriptEnvManager skeleton behind internal flag (PEP 723 PR 4/16)#1610
StellaHuang95 merged 1 commit into
microsoft:mainfrom
StellaHuang95:pep723-pr4-manager-skeleton

Conversation

@StellaHuang95

@StellaHuang95 StellaHuang95 commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Part of #1602 (PEP 723 inline script env support). Design doc: #1601.

Roadmap context — where this PR sits

This is PR 4 of 16 in the PEP 723 inline-script roadmap. The full plan lives in #1602; here's a one-line summary of where each PR sits relative to this one:

Phase PR Status
Phase 1 — Foundation PR 1: cache key hash utility in progress
PR 2: cache layout + meta.json sidecar in progress
PR 3: requires-python → interpreter selection in progress
Phase 2 — Manager PR 4: InlineScriptEnvManager skeleton this PR
PR 5: create() happy path not started (needs 1, 2, 3, 4)
PR 6: create() uv-install fallback not started (needs 3, 5)
PR 7: persistence — get / set + Memento not started (needs 4)
PR 8: activation-time discovery not started (needs 2, 4, 7)
Phase 3 — Routing PR 9: route PEP 723 scripts to inline manager not started (needs 4, 7)
PR 10: per-script project registration not started (needs 9)
Phase 3.5 — Cross-repo PR 17 (pyrx), PR 18 (pyrx), PR 19 (vscode-python) not started
Phase 4 — UX PR 11: picker item, PR 12: bulk command not started
Phase 5 — Lifecycle & polish PR 13: clear cache, PR 14: TTL, PR 15: telemetry, PR 16: status bar not started

After PRs 1–4 merge, PR 7 unlocks the largest downstream wave (PR 8, 9, 13, 17, 19) — see the ordering comment on #1602 for the full timeline.

Why a skeleton

The roadmap rolls out across 16 PRs. Landing each one behind a feature gate keeps main shippable at every step and lets reviewers see one concern at a time. This PR is the smallest possible mount point for that gate: an EnvironmentManager implementation that satisfies the interface contract and registers cleanly, but otherwise does nothing.

Every subsequent PR (5–8) replaces one of the no-ops in this skeleton with the real thing.

What this PR does

  1. Adds InlineScriptEnvManager (src/managers/builtin/inlineScriptEnvManager.ts) — implements EnvironmentManager:

    • Metadata: name = "inline-script", displayName = "Inline script environments", iconPath = file-code, preferredPackageManagerId = "ms-python.python:pip".
    • Methods: getEnvironments returns [], get / resolve return undefined, set / refresh are no-ops.
    • Optional methods omitted: create, remove, quickCreateConfig are deliberately not declared so the picker UI hides their entry points until PR 5 lands them.
    • Events: both onDidChangeEnvironments and onDidChangeEnvironment exposed and disposed correctly; never fired by this skeleton.
  2. Adds registerInlineScriptFeatures (src/managers/builtin/inlineScriptMain.ts) — a gated registration helper that reads the internal flag and registers the manager only when on. Wired into the existing Promise.all of manager-registration tasks in extension.ts (alongside system, conda, pyenv, pipenv, poetry, shellStartupVars).

  3. Adds isInlineScriptsFeatureEnabled (src/helpers.ts) — reads python-envs.inlineScripts.enabled. The setting is intentionally NOT declared in package.json, so it does not appear in Settings UI, JSON autocomplete, or settings search. End users never discover it. Devs / CI can opt in by manually adding it to settings.json. Default value false. Gate goes away in PR 16.

User impact

Zero. The feature flag is undeclared in package.json, so:

  • No setting visible in Settings UI search.
  • No autocomplete entry when typing python-envs. in settings.json.
  • No "Preview" badge or any indication the feature exists.
  • No new picker section, no commands, no status-bar changes.
  • No log output on the default level (gate-off path uses traceVerbose).

PR 5–15 will all land behind the same gate; PR 16 removes the gate and declares the public setting for real.

… 4/16)

First PR in Phase 2 of the inline-script roadmap. Lands the empty
manager class and a registration helper gated behind an INTERNAL
flag, so the plumbing for PRs 5-16 can land incrementally without
any user-visible surface.

What is in:

- src/managers/builtin/inlineScriptEnvManager.ts (new)
  Class implementing EnvironmentManager: name="inline-script",
  displayName="Inline script environments", iconPath=file-code,
  preferredPackageManagerId="ms-python.python:pip". Every method is
  a sentinel: getEnvironments returns [], get returns undefined,
  set / refresh are no-ops, resolve returns undefined. Optional
  methods (create, remove, quickCreateConfig) are deliberately
  omitted so the UI hides their entry points until PR 5 lands them.

- src/managers/builtin/inlineScriptMain.ts (new)
  registerInlineScriptFeatures(disposables, log) -- gated
  registration helper. Reads isInlineScriptsFeatureEnabled() and
  returns early (with a traceVerbose, not traceInfo, so no per-
  activation log noise for default users) when the flag is false.
  When true, constructs the manager and registers it.

- src/helpers.ts
  isInlineScriptsFeatureEnabled(): boolean -- reads
  python-envs.inlineScripts.enabled via getConfiguration().get(...).
  The setting is INTENTIONALLY NOT DECLARED in package.json, so:
    - it does not appear in Settings UI
    - it does not appear in JSON autocomplete
    - it does not appear in settings search
    - end users never discover it
  Devs / CI can still opt in by manually adding it to settings.json
  (VS Code will mark it as an unknown setting with a yellow squiggle
  -- that is a feature, not a bug; signals you are on an internal
  flag). The whole gate goes away in PR 16 when the feature ships
  for real.

- src/extension.ts
  Wires registerInlineScriptFeatures into the existing
  Promise.all of manager-registration tasks, alongside system,
  conda, pyenv, pipenv, poetry, and shellStartupVars.

- src/test/managers/builtin/inlineScriptEnvManager.unit.test.ts (new)
  19 tests pinning the skeleton's no-op contract: static metadata,
  all five EnvironmentManager methods, optional methods correctly
  omitted, events exposed but never fired, dispose() is idempotent.

- src/test/managers/builtin/inlineScriptMain.unit.test.ts (new)
  2 tests pinning the gate itself: flag false -> no register call,
  no getPythonApi call, no disposable pushed; flag true -> exactly
  one register call, two disposables pushed (mgr + registration
  handle). These guard the entire "zero user impact" promise
  against future refactors.

- src/test/helpers.inlineScriptsFeature.unit.test.ts (new)
  3 tests covering the feature-flag helper: defaults to false,
  returns true on user-set, reads from the python-envs section.

User impact

Zero. No setting in package.json, so:
- No setting visible in Settings UI search
- No autocomplete entry when typing "python-envs..." in settings.json
- No "Preview" badge or any indication the feature exists
- No empty picker section, no commands, no status-bar changes
- No log output on the default log level

PR 5-15 will land on top of this gate; PR 16 removes the gate and
declares the public setting for real.

Design context

Implements PR 4 in Phase 2 of pep723_design_questions.md. The
internal-flag approach (undeclared setting) is the strictest
interpretation of "zero user impact during incremental rollout" --
discussed in the planning conversation as the alternative to a
declared-but-default-false setting (which would still show in
autocomplete and confuse early adopters).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@StellaHuang95 StellaHuang95 added the feature-request Request for new features or functionality label Jun 24, 2026
@StellaHuang95 StellaHuang95 requested review from edvilme and eleanorjboyd and removed request for edvilme June 24, 2026 23:09
@StellaHuang95 StellaHuang95 enabled auto-merge (squash) June 24, 2026 23:33

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we maybe have it under src/managers/builtin/inlineScriptEnvManager/inlineScriptEnvManager.ts and src/managers/builtin/inlineScriptEnvManager/main.ts ?

l10n.t('Environments built from PEP 723 inline script metadata.'),
true,
);
public readonly iconPath: IconPath = new ThemeIcon('file-code');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice touch :)

@StellaHuang95 StellaHuang95 merged commit 707f2a8 into microsoft:main Jun 24, 2026
45 of 46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature-request Request for new features or functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants