Skip to content

feat: pixi-managed software environment - #163

Open
ggmarshall wants to merge 2 commits into
mainfrom
pixi-envs
Open

ggmarshall wants to merge 2 commits into
mainfrom
pixi-envs

Conversation

@ggmarshall

Copy link
Copy Markdown
Collaborator

Closes #135 (first stage).

Adds a pixi-managed software environment to the production cycle, modeled on legend-simflow's setup, as the path towards removing the execenv container machinery.

Changes

  • [tool.pixi] workspace in pyproject.toml: conda-forge + bioconda channels (linux-64); [tool.pixi.dependencies] mirroring the pinned pypi dependencies with the exact production pins (pygama==2.4.1, dspeed==2.1.4, snakemake==9.9.0, …); [tool.pixi.pypi-dependencies] with the repo itself editable plus the four packages not on conda-forge (legend-daq2lh5, legend-dataflow-scripts, both snakemake logger plugins); default/test environments on one solve-group; snakemake / dry / prod [--profile <name>] / test tasks.
  • [tool.pixi.activation.env] reproduces the execenv "bare" env vars (LGDO_BOUNDSCHECK, DSPEED_BOUNDSCHECK, PYGAMA_PARALLEL, PYGAMA_FASTMATH, TQDM_DISABLE) — a pixi-managed cycle needs no execenv: section and no containers. With the companion feat(execenv): pixi mode and deprecation of the execenv layer legend-dataflow-scripts#45 change, execenv_pyexe then returns bare console-script names that resolve from the pixi environment, so all 88 rule call sites work unchanged in both modes.
  • .pixi/ and pixi.lock gitignored (simflow convention: lock not committed).
  • New unit-tests-pixi CI job (prefix-dev/setup-pixi).
  • Docs: pixi documented as the recommended installation; dataflow install demoted to the legacy container-site path with a deprecation note; comment in dataflow-config.yaml that execenv: is optional under pixi.

Verified locally (pixi 0.75.0)

  • pixi install: full conda solve succeeds with the exact production pins on first try.
  • pixi run -e test test: unit suite passes inside the pixi env.
  • Inside the env: snakemake --version → 9.9.0, build-tier-dsp et al. on PATH, activation env vars set, and pixi-mode execenv_pyexe(cfg, "build-tier-dsp") returns the bare runnable command.

Follow-ups (out of scope here)

  • Rewrite the 88 execenv_pyexe/execenv_prefix call sites to invoke console scripts directly and delete the execenv machinery once container sites have migrated.
  • Decide a pixi.lock policy for frozen production cycles (committing the lock at cycle-tag time would make cycles bit-reproducible).

Disclosure per AI_POLICY.md: developed with AI assistance (Claude) and reviewed by the submitter.

🤖 Generated with Claude Code

Add a [tool.pixi] workspace to pyproject.toml, modeled on
legend-simflow: conda-forge/bioconda channels, conda packages mirroring
the pinned pypi dependencies, editable self-install plus the four
packages not on conda-forge (legend-daq2lh5, legend-dataflow-scripts,
snakemake logger plugins) from pypi, default/test environments on one
solve-group, and snakemake/dry/prod/test tasks.

The [tool.pixi.activation.env] block reproduces the execenv 'bare'
environment variables, so a cycle managed by pixi no longer needs the
execenv config section or containers at all: with the companion
legend-dataflow-scripts change (pixi-execenv branch), execenv_pyexe
returns bare console-script names that resolve from the pixi
environment.

Also: .pixi/ and pixi.lock gitignored (simflow convention), a
unit-tests-pixi CI job via prefix-dev/setup-pixi, pixi documented as the
recommended installation path (dataflow install demoted to the legacy
container-site path), and a note in dataflow-config.yaml that the
execenv block is optional under pixi.

Verified locally with pixi 0.75.0: full conda solve succeeds with the
exact production pins, unit suite passes inside the pixi test env
(pixi run -e test test), and console scripts + snakemake 9.9.0 resolve
on the env PATH with the activation variables set.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 29, 2026 21:01
@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 62.23%. Comparing base (6ab38e7) to head (bf3e5ca).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #163   +/-   ##
=======================================
  Coverage   62.23%   62.23%           
=======================================
  Files           7        7           
  Lines         662      662           
=======================================
  Hits          412      412           
  Misses        250      250           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a pixi-managed software environment for legend-dataflow (alongside the existing uv/container-based flow), adds documentation to recommend pixi, and wires up CI to run unit tests inside a pixi environment.

Changes:

  • Adds a [tool.pixi] workspace to pyproject.toml, including environments and tasks (prod/dry/snakemake/test) plus activation env vars.
  • Documents pixi as the recommended installation path and marks the legacy dataflow install / container machinery as deprecated.
  • Ignores .pixi/ and pixi.lock, and adds a new GitHub Actions job to run unit tests via pixi.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pyproject.toml Defines pixi workspace, deps, activation env vars, environments, and tasks.
docs/source/user_manual.rst Adds pixi-based installation guidance and deprecates the legacy container-site install path.
dataflow-config.yaml Notes that execenv: can be omitted when running in a pixi-managed environment.
.gitignore Ignores pixi environment directory and lock file.
.github/workflows/main.yml Adds CI job to run unit tests within the pixi environment.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pyproject.toml
Comment on lines +177 to +178
[tool.pixi.feature.test.tasks]
test = "pytest"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The 'test' feature actually does carry the test dependencies: pixi's pyproject integration maps [project.optional-dependencies] extras to features of the same name, so the test extra (pytest, pytest-cov, pylegendtestdata) is included in the solve — verified with pixi list -e test (pytest 9.1.1 present, absent from the default env), and pixi run -e test test passes on a clean solve. Added a clarifying comment above the environment table in e3a5e4a so this isn't confusing to readers.

Comment on lines +14 to +16
Installation with pixi (recommended)
------------------------------------

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Went one better in e3a5e4a: added osx-64/osx-arm64 to the pixi platforms — the full pinned stack solves cleanly for all three platforms (the LEGEND packages are noarch), so macOS users can pixi install directly rather than reading a caveat.

Comment thread .github/workflows/main.yml
Address Copilot review on #163: add osx-64/osx-arm64 to the pixi
platforms (the full pinned stack solves cleanly for all three
platforms), note that the pixi 'test' feature maps to the [project]
test extra (which already provides pytest/pytest-cov — verified in the
solved test environment), and fix the 'units tests' typo in the CI job
name.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@iguinn

iguinn commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Hey George, I would strongly consider setting up pixi in a way that uses "detached environments" and does not store the SW in the same directory as the ref-prod. This has major benefits in transferring data, since the environments have a huge number of small files (right now, if you try to globus a dataset, the .venv is a major slowdown!). I would just keep the lock file in the actual ref-prods.

In addition, we are working on providing versioned and reproducible lock files with legend-analysis-toolkit. I would also strongly consider drawing on one of those and documenting the version of that used. Right now, this isn't quite ready to use, but in the future I think this will be ideal

@iguinn iguinn mentioned this pull request Aug 18, 2026
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.

Pixi / conda envs

3 participants