Local checks¶
Run the same checks as CI on your computer before you push.
All checks use pixi tasks from pixi.toml.
Environments¶
| Environment | Use it for |
|---|---|
default |
containerize, build-conda-envs |
dev |
format, format-check, lint, unit-test, dry-run, setup, test, test-report |
docs |
docs-build, docs-serve |
Select the environment with -e, for example pixi run -e dev lint.
Warning
test and test-report depend on the setup task. setup exists only in dev and docs.
Thus, pixi run test without -e dev fails with "could not find the task 'setup'".
Tasks¶
| Task | Command | CI equivalent |
|---|---|---|
| Format | pixi run -e dev format |
None. This task changes files. |
| Format check | pixi run -e dev format-check |
lint.yml |
| Lint | pixi run -e dev lint <config> <profile> |
lint.yml; test.yml, job smoke |
| Unit tests | pixi run -e dev unit-test |
test.yml, job smoke |
| Dry run | pixi run -e dev dry-run <config> ci -- --sdm conda |
test.yml, job smoke |
| Test data | pixi run -e dev setup |
test.yml (checkout with LFS) |
| Integration test | pixi run -e dev test <config> <profile> |
test.yml, job e2e (local-references ci) |
| Containerize | pixi run containerize |
container-check.yml, job dockerfile-sync |
| Pin check | python3 .github/scripts/container_pin.py check |
container-check.yml, job check |
| Image list | bash .github/scripts/check-containers.sh --list |
container-check.yml, job check |
| Docs | pixi run -e docs docs-build |
docs.yml |
| Pre-commit hooks | pixi run -e dev hooks |
None |
The tasks lint, dry-run, test and test-report accept two positional arguments:
| Argument | Values | Default |
|---|---|---|
config |
remote-references, local-references, adaptive-trim |
remote-references (lint, dry-run), local-references (test, test-report) |
profile |
laptop, hpc, ci |
laptop |
The files are in .tests/integration/configs/<config>.yaml and .tests/integration/profiles/<profile>/.
Extra Snakemake arguments¶
To give more arguments to Snakemake, write -- after the task arguments:
Without --, pixi stops with "received more arguments than expected".
Recommended sequence¶
Before you push a workflow change, run these commands:
- Run
pixi run -e dev format. - Run
pixi run -e dev format-check. -
Do the
smokechecks. Run these commands: -
If you changed a conda env, run
pixi run containerize. - If you changed a rule, run
pixi run -e dev test local-references laptop. Thee2ejob runs this config.
The integration test runs containers. It needs Apptainer or Singularity.
Alternatively, start the e2e job in CI. See Job e2e.
Unit tests¶
The unit tests are in .tests/unit/. They test the Python helper modules in workflow/scripts/.
They do not need test data, conda envs or containers.
- To run all unit tests, run
pixi run -e dev unit-test. The task runspytest -q .tests/unit. - To run one file, run
pixi run -e dev pytest -q .tests/unit/<file>.py. - When you add or change a helper in
workflow/scripts/, add a test in.tests/unit/test_<module>.py. - In a test, load the module from
workflow/scripts/, and put that directory first onsys.path. Copy theload()function from.tests/unit/test_trimmomatic_steps.py.
Integration test on Linux¶
Pixi does not install Apptainer. Install Apptainer 1.2.5 or later from your system packages or your cluster modules. See Getting Started. Do not use the Apptainer from conda-forge. See Troubleshooting.
On Ubuntu 24.04 and later, AppArmor blocks unprivileged user namespaces. Rootless Apptainer needs them. To allow them until the next reboot, run:
CI does the same step in test.yml.
Integration test on macOS¶
Apptainer does not run on macOS. Use a Linux virtual machine (VM) with Lima.
Snakemake calls singularity on the host, and a wrapper script sends the call to the VM.
Set up the VM¶
- Install Lima:
brew install lima. - Write a Lima template for an Ubuntu VM. Set
arch: x86_64to runlinux/amd64images. - In the template, mount your home directory with
writable: true. Snakemake and the containers must see the same paths on the host and in the VM. - In the template, add a
provisionscript that installs Apptainer or SingularityCE from the distribution packages, not from conda. - Create and start the VM, for example
limactl start --name=singularity-amd64 <template>.yaml. - Make sure that the project directory is inside the mounted directory.
Tip
An x86_64 VM on Apple Silicon uses emulation, so the integration test is slow.
CI runs the test only on linux/amd64.
Add the wrapper¶
- Create a file named
singularityin a directory on yourPATH, for example~/.local/bin. -
Put this text in the file. Change the instance name and the binary path if yours are different.
-
Make the file executable:
chmod +x ~/.local/bin/singularity. - Run
singularity --version. The command must print the version from the VM.
Then run the integration test as usual:
The laptop profile binds $PIXI_PROJECT_ROOT and $HOME into the containers.
For more macOS notes, read Apple Silicon & macOS notes.