Full development (Python + Rust, recommended):
- Python 3.10+
- Rust (stable toolchain)
- uv - Python package manager
- just - Command runner
- pecos - PECOS dev tools CLI
Pure Rust development (Rust crates only):
If you're only working on Rust crates (e.g., pecos-core, pecos-engines), you can use cargo directly without Python:
cargo build -p pecos-core
cargo test -p pecos-core
cargo clippy -p pecos-core
cargo clean # Clean Rust artifacts onlyFor developers who want to contribute or modify PECOS:
-
Make sure you have Python and Rust installed for your system.
-
Install all dev tools with a single command:
cargo install --locked uv just pecos
This installs:
uv- Python package managerjust- Command runner for build taskspecos- PECOS dev tools (llvm, cuda, rust, python commands)
-
Clone the repository:
git clone https://github.com/PECOS-packages/PECOS.git cd PECOS -
Create the development environment:
uv sync
-
LLVM 14 Setup (Required for LLVM IR/QIS Support)
PECOS requires LLVM version 14 for LLVM IR execution features.
Quick setup:
pecos install llvm cargo build
For detailed installation instructions for all platforms (macOS, Linux, Windows), see the LLVM Setup Guide.
-
You may wish to explicitly activate the environment for development. To do so:
=== "Linux/Mac"
sh source .venv/bin/activate=== "Windows"
sh .\.venv\Scripts\activate -
Build the project in editable mode
just build
Other build options:
just build-release(optimized),just build-native(optimized for your CPU). -
Run all Python and Rust tests:
just testNote: Make sure you have run a build command before running tests.
-
Run linters using pre-commit (after installing it) to make sure all everything is properly linted/formated
just lint
-
To deactivate your development venv:
deactivate
Before pull requests are merged, they must pass linting and the test.
Note: For the Rust side of the project, you can use cargo to run tests, benchmarks, formatting, etc.
Clean commands are cross-platform (Windows, macOS, Linux):
just clean # Clean project build artifacts
just clean-selene # Clean Selene plugin artifacts only
just clean-cache # Clean ~/.pecos/cache/ and ~/.pecos/tmp/
just clean-deps # Clean ~/.pecos/deps/
just clean-all # Clean project + cache + deps
just clean-everything # Nuclear option: includes LLVM and CUDAYou can also run the cleaning script directly:
uv run python scripts/clean.py --help
uv run python scripts/clean.py --dry-run # Preview what would be deletedFor day-to-day Rust development, cargo clean handles the target/ directory. The ~/.pecos/ directory (LLVM, CUDA, C++ dependencies) rarely needs cleaning - it contains installed dependencies rather than build artifacts.
PECOS uses ~/.pecos/ to store external dependencies and build artifacts that cannot be managed through Cargo.toml:
~/.pecos/
├── llvm/ # LLVM-14 installation (for QIR/LLVM IR execution)
├── deps/ # Downloaded C++ dependencies (Stim, QuEST, Qulacs, etc.)
└── cache/ # Build artifacts and intermediate files
| Variable | Purpose | Default |
|---|---|---|
PECOS_HOME |
Override entire home directory | ~/.pecos/ |
PECOS_DEPS_DIR |
Override deps location | $PECOS_HOME/deps/ |
PECOS_CACHE_DIR |
Override cache location | $PECOS_HOME/cache/ |
These can be set via shell environment or in .cargo/config.toml:
[env]
PECOS_HOME = { value = "/custom/path", force = true }For specific development topics, see:
- Parallel Blocks and Optimization - Guide to using and extending the Parallel block construct and optimizer
- Documentation Code Testing - Guide to testing code examples in documentation