Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Environment Setup

A few options exist for environment setup:

  1. Pixi (recommended)

  2. Anaconda

  3. Custom

1. Pixi

Pixi is a tool that ensures environment hygiene and reproducibility. FASTSim has an established setup for Pixi that you can take advantage of to quickly get started.

Pixi Installation

Full installation instructions are available in the pixi docs: https://pixi.prefix.dev/latest/installation/

After installation, confirm pixi is available in a fresh terminal:

pixi --version

Environment Installation

From the repository root, install FASTSim and development dependencies:

pixi install -e dev

The dev environment installs all tools (Rust compiler, maturin, pytest, ruff, docs, and LSP packages) and uses a debug Cargo profile for fast incremental rebuilds. Other available environments:

EnvironmentPurposeCargo profile
defaultInstall from source, optimized for runtimerelease
buildCI: rust checks + python testsdebug
releasePublish step (twine)release
docsBuild and serve documentationrelease
devDay-to-day iteration (direnv default)debug

Running Tests

Use the check task to run the full local check suite (version consistency, cargo fmt --check, cargo test, a debug-profile maturin build, and pytest with nbmake using pytest-xdist):

pixi run check

All tasks:

TaskWhat it does
checkFull developer check suite (runs check-versions, rust-check, py-build, and py-test-xdist)
rust-checkcargo fmt --check + cargo test
py-buildmaturin develop --uv --profile dev (fast debug build)
py-build-releasematurin develop --uv --release (explicit release build)
py-testpytest -v inside the build env (serial), with notebook coverage
py-test-xdistpytest -v -n auto --dist=loadscope inside the build env for parallel tests, with notebook coverage
docsStart a live-reloading Jupyter Book server
build-docsFull docs build (strict, HTML)

Environment Usage

To use the environment in a terminal:

pixi run -e dev <command>
pixi shell -e dev

See the Pixi documentation or run pixi --help for more usage information. The direnv tool automates launching a shell for you, and FASTSim has a preconfigured .envrc file.

direnv: Automatic Environment Activation

If you use direnv, you can auto-load the pixi dev environment when entering this repository.

Setup:

  1. Install direnv: https://direnv.net/docs/installation.html

  2. Enable the hook for your shell (see direnv docs).

  3. Allow direnv to run .envrc:

    direnv allow

After that, entering the directory will auto-activate the pixi dev environment. Messages about environment variables can be suppressed by creating ~/.config/direnv/direnv.toml containing the line:

hide_env_diff = true

2. Anaconda

Anaconda users can easily install Rust using the conda-forge rust package

  1. Create a new environment with Python and Rust (e.g. named fastsim)

    conda create --name fastsim python=3.12 rust -c conda-forge
  2. Activate the new environment

    conda activate fastsim
  3. From the repository root, install FASTSim and development dependencies:

    pip install --upgrade pip
    pip install --group dev -e .

3. Custom

If you do not want to use Pixi or Anaconda, install Rust and Python dependencies manually.

  1. Install Rust system-wide: https://www.rust-lang.org/tools/install

  2. Create and activate a Python environment (using your environment manager of choice).

  3. From the repository root, install FASTSim and development dependencies:

    pip install --group dev -e .