Skip to content

Add CondaWorkspace spec for conda.toml#91

Merged
martindurant merged 3 commits into
fsspec:mainfrom
jezdez:add-conda-workspaces-spec
May 4, 2026
Merged

Add CondaWorkspace spec for conda.toml#91
martindurant merged 3 commits into
fsspec:mainfrom
jezdez:add-conda-workspaces-spec

Conversation

@jezdez
Copy link
Copy Markdown

@jezdez jezdez commented Apr 29, 2026

Adds a CondaWorkspaces(ProjectSpec) for conda-workspaces, a conda subcommand plugin (conda workspace, conda task) whose on-disk format is a conda-native sibling of pixi.toml and whose lockfile (conda.lock) is rattler-lock v6 with a version: 1 byte.

Match

True iff a [workspace] table is reachable through either conda.toml or pyproject.toml [tool.conda.workspace]. A pyproject.toml with only [tool.pixi.workspace] stays with the existing Pixi spec — projspec's design lets multiple specs coexist on one project, and the conda-workspaces internal tool.conda > tool.pixi precedence isn't projspec's concern. A bare conda.toml without [workspace] (a tasks-only manifest) does not match per the spec.

Parse

Environment content per env (stack=CONDA; precision=SPEC from manifest, LOCK from conda.lock). Command per task. Process per task → conda task run <name> [-e <env>]. CondaEnv per env → conda workspace install -e <env> (prefix path honours [workspace].envs-dir, default .conda/envs/<env>). LockFileconda workspace lock.

Re-use, not copy

Two helpers in pixi.py are shared rather than duplicated:

  • extract_feature is generalised to extract_tasks(meta, procs, commands, proj, *, env, run_cmd, env_flag). Default args keep Pixi.parse() byte-identical; extract_feature is kept as a compat shim.
  • envs_from_lock accepts both version: 1 (conda.lock) and version: 6 (pixi.lock) — same rattler-lock schema.

spec_doc points at the conda.toml specification.

Tests

13 new tests in tests/test_conda_workspaces.py plus a conda_workspaces entry in tests/test_roundtrips.py::test_compliant. Includes a regression test that Pixi's task command is unchanged after the refactor. Local run: 58 pass in the relevant subset; full suite has 5 pre-existing failures unrelated to this PR (missing optional deps flask/django/JLab/RustPython/briefcase in my env).

Tracking

Tracked in conda-incubator/conda-workspaces#30.

@jezdez jezdez marked this pull request as draft April 29, 2026 20:59
@jezdez jezdez force-pushed the add-conda-workspaces-spec branch from 2b24f4b to 324828a Compare April 29, 2026 21:07
@jezdez jezdez marked this pull request as ready for review April 29, 2026 21:20
@jezdez jezdez changed the title Add CondaWorkspaces spec for conda.toml Add CondaWorkspaces spec for conda.toml Apr 29, 2026
Adds a new ProjectSpec for conda-workspaces, a conda subcommand plugin
(`conda workspace`, `conda task`) whose on-disk format is a conda-native
sibling of pixi.toml.  Matches `conda.toml` with `[workspace]` and
`pyproject.toml` with `[tool.conda.workspace]`.

Re-uses two helpers from pixi.py rather than copying:

* `extract_feature` becomes `extract_tasks`, parameterised by run-cmd
  and env-flag.  Default args keep `Pixi.parse()` behaviour identical;
  `extract_feature` is kept as a compat shim.
* `envs_from_lock` accepts both `version: 1` (conda.lock) and
  `version: 6` (pixi.lock); the rest of the rattler-lock schema is
  identical (see conda-workspaces' lockfile.py).

A `pyproject.toml` with only `[tool.pixi.workspace]` stays with the
existing Pixi spec; multiple specs already coexist on one project, so
the conda-workspaces internal `tool.conda > tool.pixi` precedence is
not encoded here.

Tests cover positive/negative match (conda.toml, pyproject.toml,
tasks-only, pixi-only), parse (envs, tasks, lockfile), the create
roundtrip, registry membership, and a regression that Pixi's task cmd
is unchanged after the refactor.

Spec_doc points at https://conda-incubator.github.io/conda-workspaces/reference/conda-toml-spec/
@jezdez jezdez force-pushed the add-conda-workspaces-spec branch from 324828a to a0765a0 Compare April 29, 2026 21:27
@jezdez jezdez changed the title Add CondaWorkspaces spec for conda.toml Add CondaWorkspace spec for conda.toml Apr 29, 2026
@jezdez jezdez changed the title Add CondaWorkspace spec for conda.toml Add CondaWorkspace spec for conda.toml Apr 29, 2026
Copy link
Copy Markdown
Member

@martindurant martindurant left a comment

Choose a reason for hiding this comment

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

Please add to the docs api.rst file too.

Comment thread src/projspec/proj/conda_workspace.py Outdated
Comment thread src/projspec/proj/conda_workspace.py Outdated
@martindurant martindurant merged commit 33eda9c into fsspec:main May 4, 2026
2 checks passed
@jezdez
Copy link
Copy Markdown
Author

jezdez commented May 11, 2026

Sorry I did not circle back in time for this, thanks for merging!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants