thank you for your interest in Graphix!
The aim of graphix is to make the measurement-based quantum computing (MBQC) accessible by creating a one-stop environment to study and research MBQC.
We recommend to fork the repository before working on new features, whether that being an existing issue or your own idea.
Once created, you'll need to clone the repository, and you can follow below to set up the environment. You may want to set up virtual environment, such as conda env or pipenv before setting up the environment.
git clone git@github.com:<username>/graphix.git
cd graphix
pip install -e .[dev]You may want to install additional packages.
Specifically, matplotlib is necessary to run codes in the example folder.
pip install matplotlibFor other depencencies for the docs build, see docs/requirements.txt.
Before comitting the code, make sure to format with ruff.
To format a python file, just run in the top level of the repository:
# Be sure to use the latest version of ruff
pip install -U ruff
# Sort imports and format
ruff check --select I --fix .
ruff format .To replicate the CI pipeline locally, install nox and run the tests:
pip install -c requirements-dev.txt nox
noxWith the development dependencies installed, run the test suite explicitly:
pip install .[dev]
pytest --cov=./graphix --cov-report=xml --cov-report=termIf you use VS Code for development, add a .vscode/settings.json file to
enable the linter and basic type checking on save:
{
"python.formatting.provider": "ruff",
"editor.codeActionsOnSave": {
"source.organizeImports": true,
"source.fixAll": true
},
"python.analysis.typeCheckingMode": "basic"
}and you are ready to commit the changes.
If graphix is installed with the command given above:
pip install -e .[dev]Then mypy fails to type-check other Python projects that import graphix, showing the following error:
error: Skipping analyzing "graphix": module is installed, but missing library stubs or py.typed marker [import-untyped]
Neither mypy nor pyright detect editable packages (installed with
pip install -e), unless they are installed in compat or strict
mode. A workaround is to install graphix in strict mode by running
the following command in the graphix repository.
pip install -e . --config-settings editable_mode=strictSee pypa/setuptools#3518 for more details.