Skip to content

Latest commit

 

History

History
64 lines (46 loc) · 1.75 KB

README.md

File metadata and controls

64 lines (46 loc) · 1.75 KB

Building and testing pytket

Assuming the prerequisite tools and configuration described in the top-level README, to build tket with the required configuration (from the root directory of the repo):

conan create tket --user=tket --channel=stable --build=missing -o "boost/*":header_only=True -o "tklog/*":shared=True -o "tket/*":shared=True -tf ""

There is a known issue with using pybind11 from the conan-center that can lead to a Python crash when importing pytket. To remedy this, pybind11 must be installed from the local recipe:

conan remove -c "pybind11/*"
conan create recipes/pybind11

It is also currently necessary to use the local pybind11_json recipe, since the recipe on the conan-center is not yet compatible with conan 2:

conan create recipes/pybind11_json/all --version=0.2.14

Then build the pytket module:

cd pytket
pip install -e . -v

The Python tests require a few more packages. These can be installed with:

pip install -r tests/requirements.txt

And then to run the Python tests:

cd tests
pytest

To generate a test coverage report:

pytest --hypothesis-seed=1 --cov=../pytket --cov-branch --cov-report=html --cov-report=xml:htmlcov/cov.xml

Stub generation

Python type stubs are generated from the pybind11 modules using mypy's stubgen. Changes to the binding code under binders (or, in some cases, to tket itself) may require stub regeneration. See stub_generation/README.md for more information.

Building without conan

It is possible to build pytket without using conan at all: see here for instructions.