diff --git a/.gitignore b/.gitignore index 90eb7af76d..69e53f7f91 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,6 @@ pytket/tests/qasm_test_files/testout6.qasm # IDEs .idea .vscode + +#nix +result diff --git a/nix-support/pytket.nix b/nix-support/pytket.nix index ac6fa12a21..6368ac7a1f 100644 --- a/nix-support/pytket.nix +++ b/nix-support/pytket.nix @@ -55,6 +55,7 @@ in { cp -r ${../pytket/pytket} pytket; cp ${../pytket/package.md} package.md; cp -r ${../schemas} schemas; + cp -r ${../pytket/mypy.ini} mypy.ini; # The usual build depends on setuptools-scm to extract the version. # We have already extracted the version within nix, so we can simply @@ -80,6 +81,7 @@ in { } $out/lib/python${super.python3.pythonVersion}/site-packages/pytket/circuit/display/static; ''; checkInputs = with super.python3.pkgs; [ + mypy pytest pytest-cov pytest-benchmark @@ -90,6 +92,11 @@ in { ] ++ [jsonschema-4180]; checkPhase = '' export HOME=$TMPDIR; + + # run mypy + python -m mypy --config-file=mypy.ini --no-incremental -p pytket -p test_root.tests; + + # run tests chmod 700 $TMPDIR/test_root/tests/qasm_test_files; cd test_root/tests; python -m pytest -s . diff --git a/pytket/setup.py b/pytket/setup.py index b26819b448..f4280641b7 100755 --- a/pytket/setup.py +++ b/pytket/setup.py @@ -143,6 +143,10 @@ def run(self): if not os.path.isdir(libpath): shutil.copy(libpath, extdir) + for interface_file in os.listdir("pytket/_tket"): + if interface_file.endswith(".pyi") or interface_file.endswith(".py"): + shutil.copy(os.path.join("pytket/_tket", interface_file), extdir) + plat_name = os.getenv("WHEEL_PLAT_NAME")