diff --git a/.github/pre-commit b/.github/pre-commit deleted file mode 100755 index c7370e218..000000000 --- a/.github/pre-commit +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh - -# A pre-push hook for rust codebases that checks formatting, clippy, and tests - -set -eu - -if [[ "${IGNORE_RUSTHOOKS:=0}" -ne 0 ]]; then - echo "Ignoring rusthooks" - exit 0 -fi - -if ! cargo fmt -- --check -then - echo "There are some code style issues." - echo "Run cargo fmt first." - exit 1 -fi - -if ! cargo clippy --all-targets --all-features --workspace -- -D warnings -then - echo "There are some clippy issues." - exit 1 -fi - -if ! cargo test --all-features -then - echo "There are some test issues." - exit 1 -fi - -# Run `ruff` python formatting -if ! poetry run ruff format --check -then - echo "" - echo "There are some python code style issues." - echo "Run `poetry run ruff format` first." - exit 1 -fi - -# Run `mypy` for python type checking -if ! poetry run mypy . -then - echo "" - echo "There are some typing issues." - echo "Fix the warnings returned by 'poetry run mypy .' first." - exit 1 -fi - -# Run `ruff` python linting -if ! poetry run ruff check -then - echo "" - echo "There are some python linting issues." - exit 1 -fi - -exit 0 diff --git a/.github/workflows/drop-cache.yml b/.github/workflows/drop-cache.yml index e389893db..f550ba484 100644 --- a/.github/workflows/drop-cache.yml +++ b/.github/workflows/drop-cache.yml @@ -10,18 +10,18 @@ jobs: steps: - name: Check out code uses: actions/checkout@v4 - + - name: Cleanup run: | gh extension install actions/gh-actions-cache - + REPO=${{ github.repository }} BRANCH="refs/pull/${{ github.event.pull_request.number }}/merge" echo "Fetching list of cache key" cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 ) - ## Setting this to not fail the workflow while deleting cache keys. + ## Setting this to not fail the workflow while deleting cache keys. set +e echo "Deleting caches..." for cacheKey in $cacheKeysForPR diff --git a/.github/workflows/pr-title.yml b/.github/workflows/pr-title.yml index 0a7422684..33cb96744 100644 --- a/.github/workflows/pr-title.yml +++ b/.github/workflows/pr-title.yml @@ -3,7 +3,7 @@ name: Check Conventional Commits format on: pull_request_target: branches: - - main + - main types: - opened - edited @@ -69,4 +69,4 @@ jobs: # labels change, you might want to use the `labeled` and `unlabeled` # event triggers in your workflow. ignoreLabels: | - ignore-semantic-pull-request \ No newline at end of file + ignore-semantic-pull-request diff --git a/.github/workflows/unsoundness.yml b/.github/workflows/unsoundness.yml index 0780f0d97..fa1721d51 100644 --- a/.github/workflows/unsoundness.yml +++ b/.github/workflows/unsoundness.yml @@ -3,7 +3,7 @@ name: Unsoundness checks on: push: branches: - - main + - main workflow_dispatch: {} concurrency: diff --git a/.gitignore b/.gitignore index 836f10146..d1780cda0 100644 --- a/.gitignore +++ b/.gitignore @@ -20,9 +20,6 @@ proptest-regressions/ .devenv* devenv.local.nix -# managed by devenv -.pre-commit-config.yaml - # Coverage report lcov.info diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 000000000..d9546eaf7 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,65 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 # Use the ref you want to point at + hooks: + - id: check-added-large-files + - id: check-case-conflict + - id: check-executables-have-shebangs + - id: check-merge-conflict + - id: check-toml + - id: check-vcs-permalinks + - id: check-yaml + - id: detect-private-key + - id: end-of-file-fixer + exclude: ^specification/schema/ + - id: trailing-whitespace + - id: fix-byte-order-marker + - id: mixed-line-ending + # Python-specific + - id: check-ast + - id: check-docstring-first + - id: debug-statements + + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.3.0 + hooks: + - id: ruff + args: [--fix, --exit-non-zero-on-fix] + - id: ruff-format + + - repo: https://github.com/pre-commit/mirrors-mypy + rev: v1.9.0 + hooks: + - id: mypy + additional_dependencies: [pydantic] + + - repo: local + hooks: + - id: cargo-fmt + name: cargo format + description: Format rust code with `cargo fmt`. + entry: cargo fmt --all -- --check + language: system + files: \.rs$ + pass_filenames: false + - id: cargo-check + name: cargo check + description: Check rust code with `cargo check`. + entry: cargo check --all --all-features --workspace + language: system + files: \.rs$ + pass_filenames: false + - id: cargo-test + name: cargo test + description: Run tests with `cargo test`. + entry: cargo test --all-features --workspace + language: system + files: \.rs$ + pass_filenames: false + - id: cargo-clippy + name: cargo clippy + description: Run clippy lints with `cargo clippy`. + entry: cargo clippy --all-features --workspace -- -D warnings + language: system + files: \.rs$ + pass_filenames: false diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 53f0f611b..855ed3bc3 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -32,27 +32,24 @@ To setup the environment manually you will need: - Just: https://just.systems/ - Poetry: https://python-poetry.org/ -You can use the git hook in [`.github/pre-commit`](.github/pre-commit) to automatically run the test and check formatting before committing. -To install it, run: +Once you have these installed, you can install the required python dependencies and setup pre-commit hooks with: ```bash -ln -s .github/pre-commit .git/hooks/pre-commit -# Or, to check before pushing instead -ln -s .github/pre-commit .git/hooks/pre-push +just setup ``` ## 🏃 Running the tests -To compile and test the rust code, run: +To compile and test the code, run: ```bash -# Rust tests -just test # or `cargo test` -# Python tests -just pytest +just test +# or, to test only the rust code or the python code +just test rust +just test python ``` -Run the benchmarks with: +Run the rust benchmarks with: ```bash cargo bench @@ -75,7 +72,6 @@ The rustfmt tool is used to enforce a consistent rust coding style. The CI will To format your code, run: ```bash -# Format rust code just format ``` @@ -89,6 +85,9 @@ To quickly fix common issues, run: ```bash just fix +# or, to fix only the rust code or the python code +just fix rust +just fix python ``` ## 📈 Code Coverage @@ -98,7 +97,6 @@ line-by-line coverage report on [codecov](https://app.codecov.io/gh/CQCL/hugr/commits?branch=All%20branches). To run the coverage checks locally, first install `cargo-llvm-cov`. - ```bash cargo install cargo-llvm-cov ``` @@ -106,10 +104,7 @@ cargo install cargo-llvm-cov Then run the tests: ```bash -# Rust test coverage just coverage -# Python test -just pycoverage ``` and open it with your favourite coverage viewer. In VSCode, you can use @@ -140,4 +135,4 @@ We accept the following contribution types: - test: Adding missing tests, refactoring tests; no production code change. - ci: CI related changes. These changes are not published in the changelog. - chore: Updating build tasks, package manager configs, etc. These changes are not published in the changelog. -- revert: Reverting previous commits. \ No newline at end of file +- revert: Reverting previous commits. diff --git a/LICENCE b/LICENCE index f49a4e16e..261eeb9e9 100644 --- a/LICENCE +++ b/LICENCE @@ -198,4 +198,4 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file + limitations under the License. diff --git a/devenv.nix b/devenv.nix index a36625cce..ecbc22a6e 100644 --- a/devenv.nix +++ b/devenv.nix @@ -4,7 +4,7 @@ let in { # https://devenv.sh/packages/ - # on macos frameworks have to be explicitly specified + # on macos frameworks have to be explicitly specified # otherwise a linker error ocurs on rust packages packages = [ pkgs.just @@ -46,12 +46,6 @@ in components = [ "rustc" "cargo" "clippy" "rustfmt" "rust-analyzer" ]; }; - # https://devenv.sh/pre-commit-hooks/ - pre-commit.hooks.clippy.enable = true; - pre-commit.tools.clippy = lib.mkForce config.languages.rust.toolchain.clippy; - pre-commit.hooks.rustfmt.enable = true; - pre-commit.tools.rustfmt = lib.mkForce config.languages.rust.toolchain.rustfmt; - # https://devenv.sh/processes/ # processes.ping.exec = "ping example.com"; diff --git a/devenv.yaml b/devenv.yaml index 5a9261d03..d6eb89958 100644 --- a/devenv.yaml +++ b/devenv.yaml @@ -5,4 +5,4 @@ inputs: url: github:nix-community/fenix inputs: nixpkgs: - follows: nixpkgs \ No newline at end of file + follows: nixpkgs diff --git a/justfile b/justfile index d8a83162f..b3aa2c7c3 100644 --- a/justfile +++ b/justfile @@ -2,40 +2,70 @@ help: @just --list --justfile {{justfile()}} -# Run all the rust tests -test: - cargo test --all-features +# Prepare the environment for development, installing all the dependencies and +# setting up the pre-commit hooks. +setup: + poetry install + poetry run pre-commit install -t pre-commit -# Auto-fix all clippy warnings -fix: - cargo clippy --all-targets --all-features --workspace --fix --allow-staged - poetry run ruff check --fix - -# Run the pre-commit checks +# Run the pre-commit checks. check: - ./.github/pre-commit + poetry run pre-commit run --all-files -# Format the code -format: - cargo fmt - poetry run ruff format +# Run all the tests. +test language="[rust|python]": (_run_lang language \ + "cargo test --all-features" \ + "poetry run pytest" + ) -# Generate a test coverage report -coverage: - cargo llvm-cov --lcov > lcov.info +# Run all the benchmarks. +bench language="[rust|python]": (_run_lang language \ + "cargo bench" \ + "true" + ) -# Load a poetry shell with the dependencies installed -pyshell: - poetry shell +# Auto-fix all clippy warnings. +fix language="[rust|python]": (_run_lang language \ + "cargo clippy --all-targets --all-features --workspace --fix --allow-staged --allow-dirty" \ + "poetry run ruff check --fix" + ) + +# Format the code. +format language="[rust|python]": (_run_lang language \ + "cargo fmt" \ + "poetry run ruff format" + ) -# Run the python tests -pytest: - poetry run pytest +# Generate a test coverage report. +coverage language="[rust|python]": (_run_lang language \ + "cargo llvm-cov --lcov > lcov.info" \ + "poetry run pytest --cov=./ --cov-report=html" + ) -# Generate a python test coverage report -pycoverage: - poetry run pytest --cov=./ --cov-report=html +# Load a shell with all the dependencies installed +shell: + poetry shell -# Update the HUGR schema +# Update the HUGR schema. update-schema: poetry run python scripts/generate_schema.py specification/schema/ + + +# Runs a rust and a python command, depending on the `language` variable. +# +# If `language` is set to `rust` or `python`, only run the command for that language. +# Otherwise, run both commands. +_run_lang language rust_cmd python_cmd: + #!/usr/bin/env bash + set -euo pipefail + if [ "{{ language }}" = "rust" ]; then + set -x + {{ rust_cmd }} + elif [ "{{ language }}" = "python" ]; then + set -x + {{ python_cmd }} + else + set -x + {{ rust_cmd }} + {{ python_cmd }} + fi diff --git a/poetry.lock b/poetry.lock index 767ea27a8..4c988dcef 100644 --- a/poetry.lock +++ b/poetry.lock @@ -11,6 +11,17 @@ files = [ {file = "annotated_types-0.6.0.tar.gz", hash = "sha256:563339e807e53ffd9c267e99fc6d9ea23eb8443c08f112651963e24e22f84a5d"}, ] +[[package]] +name = "cfgv" +version = "3.4.0" +description = "Validate configuration and produce human readable error messages." +optional = false +python-versions = ">=3.8" +files = [ + {file = "cfgv-3.4.0-py2.py3-none-any.whl", hash = "sha256:b7265b1f29fd3316bfcd2b330d63d024f2bfd8bcb8b0272f8e19a504856c48f9"}, + {file = "cfgv-3.4.0.tar.gz", hash = "sha256:e52591d4c5f5dead8e0f673fb16db7949d2cfb3f7da4582893288f0ded8fe560"}, +] + [[package]] name = "colorama" version = "0.4.6" @@ -89,6 +100,17 @@ tomli = {version = "*", optional = true, markers = "python_full_version <= \"3.1 [package.extras] toml = ["tomli"] +[[package]] +name = "distlib" +version = "0.3.8" +description = "Distribution utilities" +optional = false +python-versions = "*" +files = [ + {file = "distlib-0.3.8-py2.py3-none-any.whl", hash = "sha256:034db59a0b96f8ca18035f36290806a9a6e6bd9d1ff91e45a7f172eb17e51784"}, + {file = "distlib-0.3.8.tar.gz", hash = "sha256:1530ea13e350031b6312d8580ddb6b27a104275a31106523b8f123787f494f64"}, +] + [[package]] name = "exceptiongroup" version = "1.2.0" @@ -103,6 +125,36 @@ files = [ [package.extras] test = ["pytest (>=6)"] +[[package]] +name = "filelock" +version = "3.13.1" +description = "A platform independent file lock." +optional = false +python-versions = ">=3.8" +files = [ + {file = "filelock-3.13.1-py3-none-any.whl", hash = "sha256:57dbda9b35157b05fb3e58ee91448612eb674172fab98ee235ccb0b5bee19a1c"}, + {file = "filelock-3.13.1.tar.gz", hash = "sha256:521f5f56c50f8426f5e03ad3b281b490a87ef15bc6c526f168290f0c7148d44e"}, +] + +[package.extras] +docs = ["furo (>=2023.9.10)", "sphinx (>=7.2.6)", "sphinx-autodoc-typehints (>=1.24)"] +testing = ["covdefaults (>=2.3)", "coverage (>=7.3.2)", "diff-cover (>=8)", "pytest (>=7.4.3)", "pytest-cov (>=4.1)", "pytest-mock (>=3.12)", "pytest-timeout (>=2.2)"] +typing = ["typing-extensions (>=4.8)"] + +[[package]] +name = "identify" +version = "2.5.35" +description = "File identification library for Python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "identify-2.5.35-py2.py3-none-any.whl", hash = "sha256:c4de0081837b211594f8e877a6b4fad7ca32bbfc1a9307fdd61c28bfe923f13e"}, + {file = "identify-2.5.35.tar.gz", hash = "sha256:10a7ca245cfcd756a554a7288159f72ff105ad233c7c4b9c6f0f4d108f5f6791"}, +] + +[package.extras] +license = ["ukkonen"] + [[package]] name = "iniconfig" version = "2.0.0" @@ -172,6 +224,20 @@ files = [ {file = "mypy_extensions-1.0.0.tar.gz", hash = "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782"}, ] +[[package]] +name = "nodeenv" +version = "1.8.0" +description = "Node.js virtual environment builder" +optional = false +python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*" +files = [ + {file = "nodeenv-1.8.0-py2.py3-none-any.whl", hash = "sha256:df865724bb3c3adc86b3876fa209771517b0cfe596beff01a92700e0e8be4cec"}, + {file = "nodeenv-1.8.0.tar.gz", hash = "sha256:d51e0c37e64fbf47d017feac3145cdbb58836d7eee8c6f6d3b6880c5456227d2"}, +] + +[package.dependencies] +setuptools = "*" + [[package]] name = "packaging" version = "24.0" @@ -183,6 +249,21 @@ files = [ {file = "packaging-24.0.tar.gz", hash = "sha256:eb82c5e3e56209074766e6885bb04b8c38a0c015d0a30036ebe7ece34c9989e9"}, ] +[[package]] +name = "platformdirs" +version = "4.2.0" +description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." +optional = false +python-versions = ">=3.8" +files = [ + {file = "platformdirs-4.2.0-py3-none-any.whl", hash = "sha256:0614df2a2f37e1a662acbd8e2b25b92ccf8632929bc6d43467e17fe89c75e068"}, + {file = "platformdirs-4.2.0.tar.gz", hash = "sha256:ef0cc731df711022c174543cb70a9b5bd22e5a9337c8624ef2c2ceb8ddad8768"}, +] + +[package.extras] +docs = ["furo (>=2023.9.10)", "proselint (>=0.13)", "sphinx (>=7.2.6)", "sphinx-autodoc-typehints (>=1.25.2)"] +test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.4.3)", "pytest-cov (>=4.1)", "pytest-mock (>=3.12)"] + [[package]] name = "pluggy" version = "1.4.0" @@ -198,6 +279,24 @@ files = [ dev = ["pre-commit", "tox"] testing = ["pytest", "pytest-benchmark"] +[[package]] +name = "pre-commit" +version = "3.6.2" +description = "A framework for managing and maintaining multi-language pre-commit hooks." +optional = false +python-versions = ">=3.9" +files = [ + {file = "pre_commit-3.6.2-py2.py3-none-any.whl", hash = "sha256:ba637c2d7a670c10daedc059f5c49b5bd0aadbccfcd7ec15592cf9665117532c"}, + {file = "pre_commit-3.6.2.tar.gz", hash = "sha256:c3ef34f463045c88658c5b99f38c1e297abdcc0ff13f98d3370055fbbfabc67e"}, +] + +[package.dependencies] +cfgv = ">=2.0.0" +identify = ">=1.0.0" +nodeenv = ">=0.11.1" +pyyaml = ">=5.1" +virtualenv = ">=20.10.0" + [[package]] name = "pydantic" version = "2.6.4" @@ -348,10 +447,70 @@ pytest = ">=4.6" [package.extras] testing = ["fields", "hunter", "process-tests", "pytest-xdist", "six", "virtualenv"] +[[package]] +name = "pyyaml" +version = "6.0.1" +description = "YAML parser and emitter for Python" +optional = false +python-versions = ">=3.6" +files = [ + {file = "PyYAML-6.0.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:d858aa552c999bc8a8d57426ed01e40bef403cd8ccdd0fc5f6f04a00414cac2a"}, + {file = "PyYAML-6.0.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:fd66fc5d0da6d9815ba2cebeb4205f95818ff4b79c3ebe268e75d961704af52f"}, + {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:69b023b2b4daa7548bcfbd4aa3da05b3a74b772db9e23b982788168117739938"}, + {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:81e0b275a9ecc9c0c0c07b4b90ba548307583c125f54d5b6946cfee6360c733d"}, + {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ba336e390cd8e4d1739f42dfe9bb83a3cc2e80f567d8805e11b46f4a943f5515"}, + {file = "PyYAML-6.0.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:326c013efe8048858a6d312ddd31d56e468118ad4cdeda36c719bf5bb6192290"}, + {file = "PyYAML-6.0.1-cp310-cp310-win32.whl", hash = "sha256:bd4af7373a854424dabd882decdc5579653d7868b8fb26dc7d0e99f823aa5924"}, + {file = "PyYAML-6.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:fd1592b3fdf65fff2ad0004b5e363300ef59ced41c2e6b3a99d4089fa8c5435d"}, + {file = "PyYAML-6.0.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:6965a7bc3cf88e5a1c3bd2e0b5c22f8d677dc88a455344035f03399034eb3007"}, + {file = "PyYAML-6.0.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:f003ed9ad21d6a4713f0a9b5a7a0a79e08dd0f221aff4525a2be4c346ee60aab"}, + {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:42f8152b8dbc4fe7d96729ec2b99c7097d656dc1213a3229ca5383f973a5ed6d"}, + {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:062582fca9fabdd2c8b54a3ef1c978d786e0f6b3a1510e0ac93ef59e0ddae2bc"}, + {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d2b04aac4d386b172d5b9692e2d2da8de7bfb6c387fa4f801fbf6fb2e6ba4673"}, + {file = "PyYAML-6.0.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:e7d73685e87afe9f3b36c799222440d6cf362062f78be1013661b00c5c6f678b"}, + {file = "PyYAML-6.0.1-cp311-cp311-win32.whl", hash = "sha256:1635fd110e8d85d55237ab316b5b011de701ea0f29d07611174a1b42f1444741"}, + {file = "PyYAML-6.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34"}, + {file = "PyYAML-6.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28"}, + {file = "PyYAML-6.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9"}, + {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a08c6f0fe150303c1c6b71ebcd7213c2858041a7e01975da3a99aed1e7a378ef"}, + {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0"}, + {file = "PyYAML-6.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4"}, + {file = "PyYAML-6.0.1-cp312-cp312-win32.whl", hash = "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54"}, + {file = "PyYAML-6.0.1-cp312-cp312-win_amd64.whl", hash = "sha256:0d3304d8c0adc42be59c5f8a4d9e3d7379e6955ad754aa9d6ab7a398b59dd1df"}, + {file = "PyYAML-6.0.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:50550eb667afee136e9a77d6dc71ae76a44df8b3e51e41b77f6de2932bfe0f47"}, + {file = "PyYAML-6.0.1-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1fe35611261b29bd1de0070f0b2f47cb6ff71fa6595c077e42bd0c419fa27b98"}, + {file = "PyYAML-6.0.1-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:704219a11b772aea0d8ecd7058d0082713c3562b4e271b849ad7dc4a5c90c13c"}, + {file = "PyYAML-6.0.1-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:afd7e57eddb1a54f0f1a974bc4391af8bcce0b444685d936840f125cf046d5bd"}, + {file = "PyYAML-6.0.1-cp36-cp36m-win32.whl", hash = "sha256:fca0e3a251908a499833aa292323f32437106001d436eca0e6e7833256674585"}, + {file = "PyYAML-6.0.1-cp36-cp36m-win_amd64.whl", hash = "sha256:f22ac1c3cac4dbc50079e965eba2c1058622631e526bd9afd45fedd49ba781fa"}, + {file = "PyYAML-6.0.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:b1275ad35a5d18c62a7220633c913e1b42d44b46ee12554e5fd39c70a243d6a3"}, + {file = "PyYAML-6.0.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:18aeb1bf9a78867dc38b259769503436b7c72f7a1f1f4c93ff9a17de54319b27"}, + {file = "PyYAML-6.0.1-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:596106435fa6ad000c2991a98fa58eeb8656ef2325d7e158344fb33864ed87e3"}, + {file = "PyYAML-6.0.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:baa90d3f661d43131ca170712d903e6295d1f7a0f595074f151c0aed377c9b9c"}, + {file = "PyYAML-6.0.1-cp37-cp37m-win32.whl", hash = "sha256:9046c58c4395dff28dd494285c82ba00b546adfc7ef001486fbf0324bc174fba"}, + {file = "PyYAML-6.0.1-cp37-cp37m-win_amd64.whl", hash = "sha256:4fb147e7a67ef577a588a0e2c17b6db51dda102c71de36f8549b6816a96e1867"}, + {file = "PyYAML-6.0.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:1d4c7e777c441b20e32f52bd377e0c409713e8bb1386e1099c2415f26e479595"}, + {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a0cd17c15d3bb3fa06978b4e8958dcdc6e0174ccea823003a106c7d4d7899ac5"}, + {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:28c119d996beec18c05208a8bd78cbe4007878c6dd15091efb73a30e90539696"}, + {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7e07cbde391ba96ab58e532ff4803f79c4129397514e1413a7dc761ccd755735"}, + {file = "PyYAML-6.0.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:49a183be227561de579b4a36efbb21b3eab9651dd81b1858589f796549873dd6"}, + {file = "PyYAML-6.0.1-cp38-cp38-win32.whl", hash = "sha256:184c5108a2aca3c5b3d3bf9395d50893a7ab82a38004c8f61c258d4428e80206"}, + {file = "PyYAML-6.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:1e2722cc9fbb45d9b87631ac70924c11d3a401b2d7f410cc0e3bbf249f2dca62"}, + {file = "PyYAML-6.0.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:9eb6caa9a297fc2c2fb8862bc5370d0303ddba53ba97e71f08023b6cd73d16a8"}, + {file = "PyYAML-6.0.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:c8098ddcc2a85b61647b2590f825f3db38891662cfc2fc776415143f599bb859"}, + {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5773183b6446b2c99bb77e77595dd486303b4faab2b086e7b17bc6bef28865f6"}, + {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b786eecbdf8499b9ca1d697215862083bd6d2a99965554781d0d8d1ad31e13a0"}, + {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bc1bf2925a1ecd43da378f4db9e4f799775d6367bdb94671027b73b393a7c42c"}, + {file = "PyYAML-6.0.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:04ac92ad1925b2cff1db0cfebffb6ffc43457495c9b3c39d3fcae417d7125dc5"}, + {file = "PyYAML-6.0.1-cp39-cp39-win32.whl", hash = "sha256:faca3bdcf85b2fc05d06ff3fbc1f83e1391b3e724afa3feba7d13eeab355484c"}, + {file = "PyYAML-6.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:510c9deebc5c0225e8c96813043e62b680ba2f9c50a08d3724c7f28a747d1486"}, + {file = "PyYAML-6.0.1.tar.gz", hash = "sha256:bfdf460b1736c775f2ba9f6a92bca30bc2095067b8a9d77876d1fad6cc3b4a43"}, +] + [[package]] name = "quantinuum-hugr" version = "0.0.0" -description = "Quantinuum's common representation of quantum circuits and operations" +description = "Quantinuum's common representation for quantum programs" optional = false python-versions = ">=3.10" files = [] @@ -390,6 +549,22 @@ files = [ {file = "ruff-0.3.3.tar.gz", hash = "sha256:38671be06f57a2f8aba957d9f701ea889aa5736be806f18c0cd03d6ff0cbca8d"}, ] +[[package]] +name = "setuptools" +version = "69.2.0" +description = "Easily download, build, install, upgrade, and uninstall Python packages" +optional = false +python-versions = ">=3.8" +files = [ + {file = "setuptools-69.2.0-py3-none-any.whl", hash = "sha256:c21c49fb1042386df081cb5d86759792ab89efca84cf114889191cd09aacc80c"}, + {file = "setuptools-69.2.0.tar.gz", hash = "sha256:0ff4183f8f42cd8fa3acea16c45205521a4ef28f73c6391d8a25e92893134f2e"}, +] + +[package.extras] +docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "rst.linker (>=1.9)", "sphinx (<7.2.5)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (>=1,<2)", "sphinx-reredirects", "sphinxcontrib-towncrier"] +testing = ["build[virtualenv]", "filelock (>=3.4.0)", "importlib-metadata", "ini2toml[lite] (>=0.9)", "jaraco.develop (>=7.21)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "mypy (==1.9)", "packaging (>=23.2)", "pip (>=19.1)", "pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-home (>=0.5)", "pytest-mypy (>=0.9.1)", "pytest-perf", "pytest-ruff (>=0.2.1)", "pytest-timeout", "pytest-xdist (>=3)", "tomli", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"] +testing-integration = ["build[virtualenv] (>=1.0.3)", "filelock (>=3.4.0)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "packaging (>=23.2)", "pytest", "pytest-enabler", "pytest-xdist", "tomli", "virtualenv (>=13.0.0)", "wheel"] + [[package]] name = "tomli" version = "2.0.1" @@ -412,7 +587,27 @@ files = [ {file = "typing_extensions-4.10.0.tar.gz", hash = "sha256:b0abd7c89e8fb96f98db18d86106ff1d90ab692004eb746cf6eda2682f91b3cb"}, ] +[[package]] +name = "virtualenv" +version = "20.25.1" +description = "Virtual Python Environment builder" +optional = false +python-versions = ">=3.7" +files = [ + {file = "virtualenv-20.25.1-py3-none-any.whl", hash = "sha256:961c026ac520bac5f69acb8ea063e8a4f071bcc9457b9c1f28f6b085c511583a"}, + {file = "virtualenv-20.25.1.tar.gz", hash = "sha256:e08e13ecdca7a0bd53798f356d5831434afa5b07b93f0abdf0797b7a06ffe197"}, +] + +[package.dependencies] +distlib = ">=0.3.7,<1" +filelock = ">=3.12.2,<4" +platformdirs = ">=3.9.1,<5" + +[package.extras] +docs = ["furo (>=2023.7.26)", "proselint (>=0.13)", "sphinx (>=7.1.2)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=23.6)"] +test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23.1)", "pytest (>=7.4)", "pytest-env (>=0.8.2)", "pytest-freezer (>=0.4.8)", "pytest-mock (>=3.11.1)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)", "setuptools (>=68)", "time-machine (>=2.10)"] + [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "eafdb1c10c2862ba10b0bfc815d41f1f1dd2799971c34f1a93c5a807d0319f1e" +content-hash = "e04a4d46e86490057be6b1faf1bebf9d4a5297d221884cbbb93319f8280101e4" diff --git a/pyproject.toml b/pyproject.toml index ab5aef9cc..af4a5ed9b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,6 +12,7 @@ package-mode = false python = "^3.10" [tool.poetry.group.dev.dependencies] +pre-commit = "^3.6.2" pytest = "^8.1.1" pytest-cov = "^4.1.0" mypy = "^1.9.0" diff --git a/specification/schema/serialization.md b/specification/schema/serialization.md old mode 100755 new mode 100644