The instructions on this page won't work natively on Windows. For ffsim development on Windows, we recommend using Windows Subsystem for Linux (WSL) and doing development within the WSL.
To set up ffsim for development, install it from source in editable mode along with the development requirements:
pip install -e ".[dev]"
To install the git pre-commit hooks, run
pre-commit install
If you add or modify any Rust modules, rebuild them by running the command
maturin develop
If you are benchmarking the code, then pass the --release
flag:
maturin develop --release
You can run tests and other code checks using tox. To run all checks, simply run
tox
To run a specific check, run
tox run -e <environment name>
substituting <environment name>
with the name of the tox environment for the check. The following environments are available:
py38
,py39
,py310
,py311
,py312
: Run tests for a specific Python versioncoverage
: Code coveragetype
: Type checklint
: Lint checkformat
: Format checkdocs
: Build documentation
Running the code checks directly using the corresponding software tool can be useful and allows you to:
- Automatically fix lint and formatting errors.
- Build the documentation without deleting cached files.
pytest
mypy
ruff check --fix
ruff format
sphinx-build -b html -W docs/ docs/_build/html
After building the docs using either the tox command or the sphinx command, open the file docs/_build/html/index.html
in your web browser. For rapid iterations, the sphinx command is preferred because it retains cached files.
Building the documentation can consume significant CPU because the tutorial notebooks are executed.
The tox command deletes cached files so it will execute all the notebooks every time, while the sphinx command only executes notebooks if they were modified from the previous run.