You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Split matrix selection: run takes --interpreter, prepare-envs takes --env (ADR-0103)
`--env` and `--interpreter` both existed on `run` and `prepare-envs`
and intersected in ways callers could not predict: a base named by
`--env` silently ignored its `default_interpreters` policy, and
`--interpreter` on prepare-envs widened or narrowed every matrix base
at once. Each command now has one selector, matching what it operates
on: `run` fans out over interpreters, `prepare-envs` over envs.
- `run` selects by `--interpreter` only; `all` means the full axis and
ignores `default_interpreters`. `--env` is removed from `run`.
- `prepare-envs` selects by `--env` only, in four forms: `<base>` (the
base's default subset), `<base>@<impl>-<version>` (one child),
`<base>@all` (every child) and a non-matrix env name. `--interpreter`
is removed from it.
- With any `--env` given, a base not named contributes nothing; without
one, every base applies its own default policy. Each base's policy
selects its own children only.
- Rework env_selection around resolve_run_selection, which yields
concrete selected envs, and pass them down through matrix_runner and
matrix_streaming via selected_variants so both fan-out paths filter
identically.
- Update CLI docs, the preparing-environments guide, WM internals and
protocol docs, and the unit tests.
|`--no-save-results`| Do not write action results to the cache directory |
65
65
|`--results-file=<path>`| Also write *this run's* results to `<path>`, unmerged, on every exit path, and report the path on stderr. See [Per-run results file](#per-run-results-file)|
66
66
|`--dev-env=<env>`| Override the detected dev environment. One of: `ai`, `ci`, `cli`, `ide`, `precommit` (default: auto-detected — see [Dev environment detection](#dev-environment-detection)) |
67
-
|`--env=<name>`| For a matrixed action (ADR-0047), restrict execution to the named interpreter environment(s) — a matrix base selects all of its children, a concrete child selects only itself. Repeatable. Non-matrix envs are unaffected. See [Preparing Environments — filtering by environment name](guides/preparing-environments.md#filtering-by-environment-name). |
68
-
|`--interpreter=<impl>@<version>`| For a matrixed action, restrict execution to the named interpreter(s) across every matrix env the action touches. Repeatable; a bare version means `cpython`. See [Preparing Environments — filtering by interpreter](guides/preparing-environments.md#filtering-by-interpreter). |
67
+
|`--interpreter=<impl>@<version>`| For a matrixed action, restrict execution to the named interpreter(s). Repeatable; a bare version means `cpython`; `all` means the full axis, ignoring `default_interpreters`. |
69
68
|`--resource-usage[=SEC]`| Print one `[resources]` stderr line per interval plus a peaks summary at the end (see [Resource usage in CI](#resource-usage-in-ci)). Accepted range `0 < SEC ≤ 600`; bare flag polls every 15 s. |
70
69
|`--no-resource-usage`| Disable the reporter, including its CI default. |
71
70
72
71
In a multi-project workspace, `run` fans out across every project that declares the action; spawned subprocesses are bounded by the machine-wide process budget (one slot per subprocess, leased per unit of work; default: derived from the machine's CPU budget). Fan-out is throttled, never refused — workspace size does not limit which actions you can run. See [Process budget](guides/wm-server-internals.md#process-budget).
73
72
74
-
`--env` and `--interpreter` on `run`use the same selector semantics as `prepare-envs`(ADR-0050): they compose by intersection, and a matrix env's config-declared `default_interpreters` policy (see [Preparing Environments — default interpreter subset](guides/preparing-environments.md#default-interpreter-subset)) applies as the default when neither is given — so a plain `run` can execute only a local subset of a matrix (e.g. the newest interpreter) while CI still runs the full axis, mirroring `prepare-envs`. The selection also decides which interpreter instances are *started*, not only which run: unselected matrix children are never started or repaired.
73
+
`run`selects matrix variants with `--interpreter` alone (ADR-0103): no selector applies each base's `default_interpreters` policy (see [Preparing Environments — default interpreter subset](guides/preparing-environments.md#default-interpreter-subset)) — so a plain `run` can execute only a local subset of a matrix (e.g. the newest interpreter) while CI still runs the full axis; values select exactly those interpreters; `all` selects the full axis, ignoring the policy. The selection also decides which interpreter instances are *started*, not only which run: unselected matrix children are never started or repaired.
75
74
76
75
WAL environment variable and storage settings are shared with `start-wm-server` — see [`start-wm-server`](#start-wm-server) for details.
77
76
@@ -192,11 +191,14 @@ python -m finecode --workdir=./finecode_extension_api run lint
192
191
# Override ruff line length
193
192
python -m finecode run lint --config.ruff.line_length=120
194
193
195
-
# Run a matrixed action's "testing" env only for its cpython@3.11 child
196
-
python -m finecode run run_tests --env=testing@cpython-3.11
194
+
# Run a matrixed action's 3.11 variant
195
+
python -m finecode run run_tests --interpreter=3.11
197
196
198
197
# Run every matrix env's 3.12 interpreter
199
198
python -m finecode run run_tests --interpreter=3.12
199
+
200
+
# Run the full declared axis, ignoring the default policy
201
+
python -m finecode run run_tests --interpreter=all
200
202
```
201
203
202
204
---
@@ -220,7 +222,7 @@ See [Preparing Environments](guides/preparing-environments.md) for a full explan
220
222
| Option | Description |
221
223
|---|---|
222
224
|`--recreate`| Delete and recreate the venvs this run covers (all, or the `--env` selection) |
223
-
|`--env=<name>`| Restrict `create_envs` and `install_envs` to the named env(s). Repeatable. See note below. |
225
+
|`--env=<name>`| Restrict `create_envs` and `install_envs` to the named env(s): a name, a matrix base (its default interpreters), `<base>@<impl>-<version>`, or `<base>@all`. Repeatable. See note below. |
224
226
|`--project=<name>`| Restrict preparation to the named project(s) (matched by `[project].name` from `pyproject.toml`). Repeatable. |
Copy file name to clipboardExpand all lines: docs/guides/preparing-environments.md
+21-22Lines changed: 21 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -259,8 +259,8 @@ This is the only command most users need. It:
259
259
1. Discovers all projects in the workspace
260
260
2. Bootstraps `dev_workspace` for each subproject (`create_envs` + `install_envs`, using workspace root config)
261
261
3. Starts Extension Runners
262
-
4. Runs `create_envs` across all projects (only the selected envs when `--env`/`--interpreter` narrows the run — see Filtering by environment name)
263
-
5. Runs `install_envs` across all projects (only the selected envs when `--env`/`--interpreter` narrows the run — see Filtering by environment name)
262
+
4. Runs `create_envs` across all projects (only the selected envs when `--env` narrows the run — see Filtering by environment name)
263
+
5. Runs `install_envs` across all projects (only the selected envs when `--env` narrows the run — see Filtering by environment name)
264
264
265
265
See [CLI reference — prepare-envs](../cli.md#prepare-envs) for available options.
266
266
@@ -349,34 +349,33 @@ Useful when you've added a new handler in one env and want to update only that e
349
349
350
350
#### Matrix environments
351
351
352
-
For a matrix environment (ADR-0047 — one declaring an `interpreters` axis), the same rule applies, with base-name expansion: naming a concrete matrix child — or its base name, which expands to all of its children — restricts **both**`create_envs` and `install_envs` to the selected children (PRD-0003 AC8). Unselected children of that matrix are not created at all, since there is no point creating a venv for an interpreter nobody asked for in this run.
352
+
For a matrix base (ADR-0047 — one declaring an `interpreters` axis), `--env` takes four forms (ADR-0103). With any `--env` given, a base not named in any form contributes nothing; with no `--env`, every base contributes its default and every non-matrix env is included:
353
+
354
+
| Form | Selects |
355
+
|---|---|
356
+
|`<base>`| that base's default interpreters |
357
+
|`<base>@<impl>-<version>`| that one child |
358
+
|`<base>@all`| every child |
359
+
|`<non-matrix>`| that env |
360
+
361
+
The selection restricts **both**`create_envs` and `install_envs` (PRD-0003 AC8). Unselected children are not created at all. Each base's policy selects its own children only.
A matrix base named by `--env` is always expanded to *all* of its children, ignoring that base's own `default_interpreters` policy (see below) — `--env` is more specific than a config default. A sibling matrix base *not* named by `--env` is unaffected by this and keeps applying its own config default (or its full axis, if it has none).
Restricts every matrix environment's interpreter axis to the named interpreter(s), the same way for both `create_envs` and `install_envs`. `--interpreter` is repeatable to select more than one interpreter. Values may be the canonical `<impl>@<version>` form or a bare version, which is shorthand for `cpython@<version>`.
372
-
373
-
`--interpreter` can be combined with `--env`: the effective selection is the intersection of the two — e.g. `--env=testing --interpreter=3.12` selects only `testing`'s `cpython@3.12` child. An `--interpreter` value that doesn't exist in a given matrix env's axis simply contributes nothing for that env (it is not an error by itself — see below for when a selector *is* rejected).
374
-
375
-
Non-matrix envs are unaffected by `--interpreter`; they are created and installed unless an `--env` filter excludes them.
374
+
`prepare-envs` has no `--interpreter`; name the child, or use `<base>@all`.
376
375
377
376
### Default interpreter subset
378
377
379
-
A matrix environment can declare a default interpreter subset per dev-env, so that a plain `prepare-envs` run (no `--env`/`--interpreter`) still narrows the axis automatically:
378
+
A matrix base can declare a default interpreter subset per dev-env, so that a plain `prepare-envs` run (no `--env`) still narrows the axis automatically:
380
379
381
380
```toml
382
381
[tool.finecode.env.testing]
@@ -395,11 +394,11 @@ Each key is either an exact dev-env (`ide`/`cli`/`ai`/`git_hook`/`ci`) or one of
395
394
396
395
Lookup for the active dev-env `D` (see [dev environment detection](../cli.md#dev-environment-detection) — `ide`/`cli`/`ai`/`git_hook`/`ci`) tries, in order: the exact key `D`, then the bucket key (`"ci"` if `D == "ci"`, otherwise `"local"`), then falls back to `"all"`. In the example above, `local = "newest"` covers `ide`/`cli`/`ai`/`git_hook`, while `ci = "all"` covers `ci` — a common pattern where local development only needs the newest interpreter, but CI verifies every interpreter in the matrix.
397
396
398
-
An explicit `--interpreter` selector always overrides the config default outright, for every matrix base. A config default (or its explicit-list policy) that names an interpreter outside the env's declared axis is rejected at resolution time with a clear error.
397
+
An explicit `--env` selector always overrides the config default outright, for its own base; each base's policy selects its own children only. A config default (or its explicit-list policy) that names an interpreter outside the env's declared axis is rejected at resolution time with a clear error.
399
398
400
-
### `run`uses the same selection
399
+
### `run`selects by interpreter
401
400
402
-
`python -m finecode run`accepts the same `--env`/`--interpreter`selectors, with identical semantics (ADR-0050), to restrict which interpreter variants of a matrixed action actually execute — see [CLI reference — `run`](../cli.md#run). The config-declared `default_interpreters` policy applies there too: a plain `run` (no selectors) executes only the dev-env's default subset of a matrix (e.g. just the newest interpreter locally), while `ci` runs the full axis by default, exactly mirroring `prepare-envs`. Selection is resolved once per project (via `env_selection.resolve_selected_interpreters`) and passed down to whichever fan-out site handles the request — `matrix_runner` (non-streaming) or `matrix_streaming` (CLI / IDE streaming) — so both paths filter identically.
401
+
`python -m finecode run`selects with `--interpreter` (ADR-0103) to restrict which interpreter variants of a matrixed action actually execute — see [CLI reference — `run`](../cli.md#run). Values select exactly those interpreters, `all` selects the full axis, and no selector applies the `default_interpreters` policy. The config-declared `default_interpreters` policy applies there too: a plain `run` (no selectors) executes only the dev-env's default subset of a matrix (e.g. just the newest interpreter locally), while `ci` runs the full axis by default. Selection is resolved once per project (via `env_selection.resolve_run_selection` into selected concrete envs) and passed down to whichever fan-out site handles the request — `matrix_runner` (non-streaming) or `matrix_streaming` (CLI / IDE streaming) via `matrix_runner.selected_variants` — so both paths filter identically.
Copy file name to clipboardExpand all lines: src/finecode/cli_app/cli.py
+7-16Lines changed: 7 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -391,7 +391,6 @@ def run(ctx) -> None:
391
391
dev_env: str=detect_dev_env()
392
392
wal_enabled: bool|None=None
393
393
verbose: bool=False
394
-
env_selectors: list[str] = []
395
394
interpreter_selectors: list[str] = []
396
395
resource_usage_flag_value: str|float|None=None
397
396
no_resource_usage: bool=False
@@ -455,8 +454,12 @@ def run(ctx) -> None:
455
454
err=True,
456
455
)
457
456
sys.exit(1)
458
-
elifarg.startswith("--env="):
459
-
env_selectors.append(arg.removeprefix("--env="))
457
+
elifarg=="--env"orarg.startswith("--env="):
458
+
click.echo(
459
+
"run selects matrix variants by interpreter: use --interpreter=<impl>@<version> (repeatable) or --interpreter=all. --env is a prepare-envs option (ADR-0103).",
0 commit comments