diff --git a/Makefile b/Makefile index 0ce5da1bd..08a2f245c 100644 --- a/Makefile +++ b/Makefile @@ -74,7 +74,7 @@ test: .PHONY: test-fast test-fast: poetry install --extras latex - pytest -v --cov=pyquil test/unit + pytest -vx --cov=pyquil test/unit .PHONY: e2e e2e: diff --git a/poetry.lock b/poetry.lock index 1b368396a..175a40b4f 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.4.0 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.4.2 and should not be changed by hand. [[package]] name = "alabaster" @@ -419,6 +419,7 @@ files = [ {file = "contourpy-1.1.0-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:18a64814ae7bce73925131381603fff0116e2df25230dfc80d6d690aa6e20b37"}, {file = "contourpy-1.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:90c81f22b4f572f8a2110b0b741bb64e5a6427e0a198b2cdc1fbaf85f352a3aa"}, {file = "contourpy-1.1.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:53cc3a40635abedbec7f1bde60f8c189c49e84ac180c665f2cd7c162cc454baa"}, + {file = "contourpy-1.1.0-cp310-cp310-win32.whl", hash = "sha256:9b2dd2ca3ac561aceef4c7c13ba654aaa404cf885b187427760d7f7d4c57cff8"}, {file = "contourpy-1.1.0-cp310-cp310-win_amd64.whl", hash = "sha256:1f795597073b09d631782e7245016a4323cf1cf0b4e06eef7ea6627e06a37ff2"}, {file = "contourpy-1.1.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:0b7b04ed0961647691cfe5d82115dd072af7ce8846d31a5fac6c142dcce8b882"}, {file = "contourpy-1.1.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:27bc79200c742f9746d7dd51a734ee326a292d77e7d94c8af6e08d1e6c15d545"}, @@ -427,6 +428,7 @@ files = [ {file = "contourpy-1.1.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e5cec36c5090e75a9ac9dbd0ff4a8cf7cecd60f1b6dc23a374c7d980a1cd710e"}, {file = "contourpy-1.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1f0cbd657e9bde94cd0e33aa7df94fb73c1ab7799378d3b3f902eb8eb2e04a3a"}, {file = "contourpy-1.1.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:181cbace49874f4358e2929aaf7ba84006acb76694102e88dd15af861996c16e"}, + {file = "contourpy-1.1.0-cp311-cp311-win32.whl", hash = "sha256:edb989d31065b1acef3828a3688f88b2abb799a7db891c9e282df5ec7e46221b"}, {file = "contourpy-1.1.0-cp311-cp311-win_amd64.whl", hash = "sha256:fb3b7d9e6243bfa1efb93ccfe64ec610d85cfe5aec2c25f97fbbd2e58b531256"}, {file = "contourpy-1.1.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:bcb41692aa09aeb19c7c213411854402f29f6613845ad2453d30bf421fe68fed"}, {file = "contourpy-1.1.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:5d123a5bc63cd34c27ff9c7ac1cd978909e9c71da12e05be0231c608048bb2ae"}, @@ -435,6 +437,7 @@ files = [ {file = "contourpy-1.1.0-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:317267d915490d1e84577924bd61ba71bf8681a30e0d6c545f577363157e5e94"}, {file = "contourpy-1.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d551f3a442655f3dcc1285723f9acd646ca5858834efeab4598d706206b09c9f"}, {file = "contourpy-1.1.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:e7a117ce7df5a938fe035cad481b0189049e8d92433b4b33aa7fc609344aafa1"}, + {file = "contourpy-1.1.0-cp38-cp38-win32.whl", hash = "sha256:108dfb5b3e731046a96c60bdc46a1a0ebee0760418951abecbe0fc07b5b93b27"}, {file = "contourpy-1.1.0-cp38-cp38-win_amd64.whl", hash = "sha256:d4f26b25b4f86087e7d75e63212756c38546e70f2a92d2be44f80114826e1cd4"}, {file = "contourpy-1.1.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:bc00bb4225d57bff7ebb634646c0ee2a1298402ec10a5fe7af79df9a51c1bfd9"}, {file = "contourpy-1.1.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:189ceb1525eb0655ab8487a9a9c41f42a73ba52d6789754788d1883fb06b2d8a"}, @@ -443,6 +446,7 @@ files = [ {file = "contourpy-1.1.0-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:143dde50520a9f90e4a2703f367cf8ec96a73042b72e68fcd184e1279962eb6f"}, {file = "contourpy-1.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e94bef2580e25b5fdb183bf98a2faa2adc5b638736b2c0a4da98691da641316a"}, {file = "contourpy-1.1.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:ed614aea8462735e7d70141374bd7650afd1c3f3cb0c2dbbcbe44e14331bf002"}, + {file = "contourpy-1.1.0-cp39-cp39-win32.whl", hash = "sha256:71551f9520f008b2950bef5f16b0e3587506ef4f23c734b71ffb7b89f8721999"}, {file = "contourpy-1.1.0-cp39-cp39-win_amd64.whl", hash = "sha256:438ba416d02f82b692e371858143970ed2eb6337d9cdbbede0d8ad9f3d7dd17d"}, {file = "contourpy-1.1.0-pp38-pypy38_pp73-macosx_10_9_x86_64.whl", hash = "sha256:a698c6a7a432789e587168573a864a7ea374c6be8d4f31f9d87c001d5a843493"}, {file = "contourpy-1.1.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:397b0ac8a12880412da3551a8cb5a187d3298a72802b45a3bd1805e204ad8439"}, @@ -2090,59 +2094,6 @@ files = [ {file = "pycparser-2.21.tar.gz", hash = "sha256:e644fdec12f7872f86c58ff790da456218b10f863970249516d60a5eaca77206"}, ] -[[package]] -name = "pydantic" -version = "1.10.14" -description = "Data validation and settings management using python type hints" -category = "main" -optional = false -python-versions = ">=3.7" -files = [ - {file = "pydantic-1.10.14-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:7f4fcec873f90537c382840f330b90f4715eebc2bc9925f04cb92de593eae054"}, - {file = "pydantic-1.10.14-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:8e3a76f571970fcd3c43ad982daf936ae39b3e90b8a2e96c04113a369869dc87"}, - {file = "pydantic-1.10.14-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:82d886bd3c3fbeaa963692ef6b643159ccb4b4cefaf7ff1617720cbead04fd1d"}, - {file = "pydantic-1.10.14-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:798a3d05ee3b71967844a1164fd5bdb8c22c6d674f26274e78b9f29d81770c4e"}, - {file = "pydantic-1.10.14-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:23d47a4b57a38e8652bcab15a658fdb13c785b9ce217cc3a729504ab4e1d6bc9"}, - {file = "pydantic-1.10.14-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:f9f674b5c3bebc2eba401de64f29948ae1e646ba2735f884d1594c5f675d6f2a"}, - {file = "pydantic-1.10.14-cp310-cp310-win_amd64.whl", hash = "sha256:24a7679fab2e0eeedb5a8924fc4a694b3bcaac7d305aeeac72dd7d4e05ecbebf"}, - {file = "pydantic-1.10.14-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:9d578ac4bf7fdf10ce14caba6f734c178379bd35c486c6deb6f49006e1ba78a7"}, - {file = "pydantic-1.10.14-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:fa7790e94c60f809c95602a26d906eba01a0abee9cc24150e4ce2189352deb1b"}, - {file = "pydantic-1.10.14-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:aad4e10efa5474ed1a611b6d7f0d130f4aafadceb73c11d9e72823e8f508e663"}, - {file = "pydantic-1.10.14-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1245f4f61f467cb3dfeced2b119afef3db386aec3d24a22a1de08c65038b255f"}, - {file = "pydantic-1.10.14-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:21efacc678a11114c765eb52ec0db62edffa89e9a562a94cbf8fa10b5db5c046"}, - {file = "pydantic-1.10.14-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:412ab4a3f6dbd2bf18aefa9f79c7cca23744846b31f1d6555c2ee2b05a2e14ca"}, - {file = "pydantic-1.10.14-cp311-cp311-win_amd64.whl", hash = "sha256:e897c9f35281f7889873a3e6d6b69aa1447ceb024e8495a5f0d02ecd17742a7f"}, - {file = "pydantic-1.10.14-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:d604be0f0b44d473e54fdcb12302495fe0467c56509a2f80483476f3ba92b33c"}, - {file = "pydantic-1.10.14-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a42c7d17706911199798d4c464b352e640cab4351efe69c2267823d619a937e5"}, - {file = "pydantic-1.10.14-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:596f12a1085e38dbda5cbb874d0973303e34227b400b6414782bf205cc14940c"}, - {file = "pydantic-1.10.14-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:bfb113860e9288d0886e3b9e49d9cf4a9d48b441f52ded7d96db7819028514cc"}, - {file = "pydantic-1.10.14-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:bc3ed06ab13660b565eed80887fcfbc0070f0aa0691fbb351657041d3e874efe"}, - {file = "pydantic-1.10.14-cp37-cp37m-win_amd64.whl", hash = "sha256:ad8c2bc677ae5f6dbd3cf92f2c7dc613507eafe8f71719727cbc0a7dec9a8c01"}, - {file = "pydantic-1.10.14-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:c37c28449752bb1f47975d22ef2882d70513c546f8f37201e0fec3a97b816eee"}, - {file = "pydantic-1.10.14-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:49a46a0994dd551ec051986806122767cf144b9702e31d47f6d493c336462597"}, - {file = "pydantic-1.10.14-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:53e3819bd20a42470d6dd0fe7fc1c121c92247bca104ce608e609b59bc7a77ee"}, - {file = "pydantic-1.10.14-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0fbb503bbbbab0c588ed3cd21975a1d0d4163b87e360fec17a792f7d8c4ff29f"}, - {file = "pydantic-1.10.14-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:336709883c15c050b9c55a63d6c7ff09be883dbc17805d2b063395dd9d9d0022"}, - {file = "pydantic-1.10.14-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:4ae57b4d8e3312d486e2498d42aed3ece7b51848336964e43abbf9671584e67f"}, - {file = "pydantic-1.10.14-cp38-cp38-win_amd64.whl", hash = "sha256:dba49d52500c35cfec0b28aa8b3ea5c37c9df183ffc7210b10ff2a415c125c4a"}, - {file = "pydantic-1.10.14-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:c66609e138c31cba607d8e2a7b6a5dc38979a06c900815495b2d90ce6ded35b4"}, - {file = "pydantic-1.10.14-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:d986e115e0b39604b9eee3507987368ff8148222da213cd38c359f6f57b3b347"}, - {file = "pydantic-1.10.14-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:646b2b12df4295b4c3148850c85bff29ef6d0d9621a8d091e98094871a62e5c7"}, - {file = "pydantic-1.10.14-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:282613a5969c47c83a8710cc8bfd1e70c9223feb76566f74683af889faadc0ea"}, - {file = "pydantic-1.10.14-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:466669501d08ad8eb3c4fecd991c5e793c4e0bbd62299d05111d4f827cded64f"}, - {file = "pydantic-1.10.14-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:13e86a19dca96373dcf3190fcb8797d40a6f12f154a244a8d1e8e03b8f280593"}, - {file = "pydantic-1.10.14-cp39-cp39-win_amd64.whl", hash = "sha256:08b6ec0917c30861e3fe71a93be1648a2aa4f62f866142ba21670b24444d7fd8"}, - {file = "pydantic-1.10.14-py3-none-any.whl", hash = "sha256:8ee853cd12ac2ddbf0ecbac1c289f95882b2d4482258048079d13be700aa114c"}, - {file = "pydantic-1.10.14.tar.gz", hash = "sha256:46f17b832fe27de7850896f3afee50ea682220dd218f7e9c88d436788419dca6"}, -] - -[package.dependencies] -typing-extensions = ">=4.2.0" - -[package.extras] -dotenv = ["python-dotenv (>=0.10.4)"] -email = ["email-validator (>=1.0.3)"] - [[package]] name = "pyflakes" version = "2.3.1" @@ -2816,37 +2767,51 @@ python-versions = ">=3.6" files = [ {file = "ruamel.yaml.clib-0.2.8-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:b42169467c42b692c19cf539c38d4602069d8c1505e97b86387fcf7afb766e1d"}, {file = "ruamel.yaml.clib-0.2.8-cp310-cp310-macosx_13_0_arm64.whl", hash = "sha256:07238db9cbdf8fc1e9de2489a4f68474e70dffcb32232db7c08fa61ca0c7c462"}, - {file = "ruamel.yaml.clib-0.2.8-cp310-cp310-manylinux2014_aarch64.whl", hash = "sha256:d92f81886165cb14d7b067ef37e142256f1c6a90a65cd156b063a43da1708cfd"}, {file = "ruamel.yaml.clib-0.2.8-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl", hash = "sha256:fff3573c2db359f091e1589c3d7c5fc2f86f5bdb6f24252c2d8e539d4e45f412"}, + {file = "ruamel.yaml.clib-0.2.8-cp310-cp310-manylinux_2_24_aarch64.whl", hash = "sha256:aa2267c6a303eb483de8d02db2871afb5c5fc15618d894300b88958f729ad74f"}, + {file = "ruamel.yaml.clib-0.2.8-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:840f0c7f194986a63d2c2465ca63af8ccbbc90ab1c6001b1978f05119b5e7334"}, + {file = "ruamel.yaml.clib-0.2.8-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:024cfe1fc7c7f4e1aff4a81e718109e13409767e4f871443cbff3dba3578203d"}, {file = "ruamel.yaml.clib-0.2.8-cp310-cp310-win32.whl", hash = "sha256:c69212f63169ec1cfc9bb44723bf2917cbbd8f6191a00ef3410f5a7fe300722d"}, {file = "ruamel.yaml.clib-0.2.8-cp310-cp310-win_amd64.whl", hash = "sha256:cabddb8d8ead485e255fe80429f833172b4cadf99274db39abc080e068cbcc31"}, {file = "ruamel.yaml.clib-0.2.8-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:bef08cd86169d9eafb3ccb0a39edb11d8e25f3dae2b28f5c52fd997521133069"}, {file = "ruamel.yaml.clib-0.2.8-cp311-cp311-macosx_13_0_arm64.whl", hash = "sha256:b16420e621d26fdfa949a8b4b47ade8810c56002f5389970db4ddda51dbff248"}, - {file = "ruamel.yaml.clib-0.2.8-cp311-cp311-manylinux2014_aarch64.whl", hash = "sha256:b5edda50e5e9e15e54a6a8a0070302b00c518a9d32accc2346ad6c984aacd279"}, {file = "ruamel.yaml.clib-0.2.8-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl", hash = "sha256:25c515e350e5b739842fc3228d662413ef28f295791af5e5110b543cf0b57d9b"}, + {file = "ruamel.yaml.clib-0.2.8-cp311-cp311-manylinux_2_24_aarch64.whl", hash = "sha256:1707814f0d9791df063f8c19bb51b0d1278b8e9a2353abbb676c2f685dee6afe"}, + {file = "ruamel.yaml.clib-0.2.8-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:46d378daaac94f454b3a0e3d8d78cafd78a026b1d71443f4966c696b48a6d899"}, + {file = "ruamel.yaml.clib-0.2.8-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:09b055c05697b38ecacb7ac50bdab2240bfca1a0c4872b0fd309bb07dc9aa3a9"}, {file = "ruamel.yaml.clib-0.2.8-cp311-cp311-win32.whl", hash = "sha256:53a300ed9cea38cf5a2a9b069058137c2ca1ce658a874b79baceb8f892f915a7"}, {file = "ruamel.yaml.clib-0.2.8-cp311-cp311-win_amd64.whl", hash = "sha256:c2a72e9109ea74e511e29032f3b670835f8a59bbdc9ce692c5b4ed91ccf1eedb"}, {file = "ruamel.yaml.clib-0.2.8-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:ebc06178e8821efc9692ea7544aa5644217358490145629914d8020042c24aa1"}, {file = "ruamel.yaml.clib-0.2.8-cp312-cp312-macosx_13_0_arm64.whl", hash = "sha256:edaef1c1200c4b4cb914583150dcaa3bc30e592e907c01117c08b13a07255ec2"}, - {file = "ruamel.yaml.clib-0.2.8-cp312-cp312-manylinux2014_aarch64.whl", hash = "sha256:7048c338b6c86627afb27faecf418768acb6331fc24cfa56c93e8c9780f815fa"}, {file = "ruamel.yaml.clib-0.2.8-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d176b57452ab5b7028ac47e7b3cf644bcfdc8cacfecf7e71759f7f51a59e5c92"}, + {file = "ruamel.yaml.clib-0.2.8-cp312-cp312-manylinux_2_24_aarch64.whl", hash = "sha256:1dc67314e7e1086c9fdf2680b7b6c2be1c0d8e3a8279f2e993ca2a7545fecf62"}, + {file = "ruamel.yaml.clib-0.2.8-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:3213ece08ea033eb159ac52ae052a4899b56ecc124bb80020d9bbceeb50258e9"}, + {file = "ruamel.yaml.clib-0.2.8-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:aab7fd643f71d7946f2ee58cc88c9b7bfc97debd71dcc93e03e2d174628e7e2d"}, + {file = "ruamel.yaml.clib-0.2.8-cp312-cp312-win32.whl", hash = "sha256:5c365d91c88390c8d0a8545df0b5857172824b1c604e867161e6b3d59a827eaa"}, + {file = "ruamel.yaml.clib-0.2.8-cp312-cp312-win_amd64.whl", hash = "sha256:1758ce7d8e1a29d23de54a16ae867abd370f01b5a69e1a3ba75223eaa3ca1a1b"}, {file = "ruamel.yaml.clib-0.2.8-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:a5aa27bad2bb83670b71683aae140a1f52b0857a2deff56ad3f6c13a017a26ed"}, {file = "ruamel.yaml.clib-0.2.8-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:c58ecd827313af6864893e7af0a3bb85fd529f862b6adbefe14643947cfe2942"}, {file = "ruamel.yaml.clib-0.2.8-cp37-cp37m-macosx_12_0_arm64.whl", hash = "sha256:f481f16baec5290e45aebdc2a5168ebc6d35189ae6fea7a58787613a25f6e875"}, - {file = "ruamel.yaml.clib-0.2.8-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:3fcc54cb0c8b811ff66082de1680b4b14cf8a81dce0d4fbf665c2265a81e07a1"}, + {file = "ruamel.yaml.clib-0.2.8-cp37-cp37m-manylinux_2_24_aarch64.whl", hash = "sha256:77159f5d5b5c14f7c34073862a6b7d34944075d9f93e681638f6d753606c6ce6"}, {file = "ruamel.yaml.clib-0.2.8-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:7f67a1ee819dc4562d444bbafb135832b0b909f81cc90f7aa00260968c9ca1b3"}, + {file = "ruamel.yaml.clib-0.2.8-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:4ecbf9c3e19f9562c7fdd462e8d18dd902a47ca046a2e64dba80699f0b6c09b7"}, + {file = "ruamel.yaml.clib-0.2.8-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:87ea5ff66d8064301a154b3933ae406b0863402a799b16e4a1d24d9fbbcbe0d3"}, {file = "ruamel.yaml.clib-0.2.8-cp37-cp37m-win32.whl", hash = "sha256:75e1ed13e1f9de23c5607fe6bd1aeaae21e523b32d83bb33918245361e9cc51b"}, {file = "ruamel.yaml.clib-0.2.8-cp37-cp37m-win_amd64.whl", hash = "sha256:3f215c5daf6a9d7bbed4a0a4f760f3113b10e82ff4c5c44bec20a68c8014f675"}, {file = "ruamel.yaml.clib-0.2.8-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:1b617618914cb00bf5c34d4357c37aa15183fa229b24767259657746c9077615"}, {file = "ruamel.yaml.clib-0.2.8-cp38-cp38-macosx_12_0_arm64.whl", hash = "sha256:a6a9ffd280b71ad062eae53ac1659ad86a17f59a0fdc7699fd9be40525153337"}, - {file = "ruamel.yaml.clib-0.2.8-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:665f58bfd29b167039f714c6998178d27ccd83984084c286110ef26b230f259f"}, + {file = "ruamel.yaml.clib-0.2.8-cp38-cp38-manylinux_2_24_aarch64.whl", hash = "sha256:305889baa4043a09e5b76f8e2a51d4ffba44259f6b4c72dec8ca56207d9c6fe1"}, {file = "ruamel.yaml.clib-0.2.8-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:700e4ebb569e59e16a976857c8798aee258dceac7c7d6b50cab63e080058df91"}, + {file = "ruamel.yaml.clib-0.2.8-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:e2b4c44b60eadec492926a7270abb100ef9f72798e18743939bdbf037aab8c28"}, + {file = "ruamel.yaml.clib-0.2.8-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:e79e5db08739731b0ce4850bed599235d601701d5694c36570a99a0c5ca41a9d"}, {file = "ruamel.yaml.clib-0.2.8-cp38-cp38-win32.whl", hash = "sha256:955eae71ac26c1ab35924203fda6220f84dce57d6d7884f189743e2abe3a9fbe"}, {file = "ruamel.yaml.clib-0.2.8-cp38-cp38-win_amd64.whl", hash = "sha256:56f4252222c067b4ce51ae12cbac231bce32aee1d33fbfc9d17e5b8d6966c312"}, {file = "ruamel.yaml.clib-0.2.8-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:03d1162b6d1df1caa3a4bd27aa51ce17c9afc2046c31b0ad60a0a96ec22f8001"}, {file = "ruamel.yaml.clib-0.2.8-cp39-cp39-macosx_12_0_arm64.whl", hash = "sha256:bba64af9fa9cebe325a62fa398760f5c7206b215201b0ec825005f1b18b9bccf"}, - {file = "ruamel.yaml.clib-0.2.8-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:9eb5dee2772b0f704ca2e45b1713e4e5198c18f515b52743576d196348f374d3"}, + {file = "ruamel.yaml.clib-0.2.8-cp39-cp39-manylinux_2_24_aarch64.whl", hash = "sha256:a1a45e0bb052edf6a1d3a93baef85319733a888363938e1fc9924cb00c8df24c"}, {file = "ruamel.yaml.clib-0.2.8-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:da09ad1c359a728e112d60116f626cc9f29730ff3e0e7db72b9a2dbc2e4beed5"}, + {file = "ruamel.yaml.clib-0.2.8-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:184565012b60405d93838167f425713180b949e9d8dd0bbc7b49f074407c5a8b"}, + {file = "ruamel.yaml.clib-0.2.8-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:a75879bacf2c987c003368cf14bed0ffe99e8e85acfa6c0bfffc21a090f16880"}, {file = "ruamel.yaml.clib-0.2.8-cp39-cp39-win32.whl", hash = "sha256:84b554931e932c46f94ab306913ad7e11bba988104c5cff26d90d03f68258cd5"}, {file = "ruamel.yaml.clib-0.2.8-cp39-cp39-win_amd64.whl", hash = "sha256:25ac8c08322002b06fa1d49d1646181f0b2c72f5cbc15a85e80b4c30a544bb15"}, {file = "ruamel.yaml.clib-0.2.8.tar.gz", hash = "sha256:beb2e0404003de9a4cab9753a8805a8fe9320ee6673136ed7f04255fe60bb512"}, @@ -3295,7 +3260,7 @@ files = [ name = "typing-extensions" version = "4.9.0" description = "Backported and Experimental Type Hints for Python 3.8+" -category = "main" +category = "dev" optional = false python-versions = ">=3.8" files = [ @@ -3460,4 +3425,4 @@ latex = ["ipython"] [metadata] lock-version = "2.0" python-versions = "^3.8,<=3.12" -content-hash = "7b1f1a670578f5dcf315e28b50f2912d937753462b5771e286509e3356a1b26e" +content-hash = "f6275a0a741313f6932a192a3dea28af38692febbbd9e18931abc135c7335944" diff --git a/pyproject.toml b/pyproject.toml index fbb6cf089..58db11e4d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,7 +24,6 @@ numpy = "^1.22" scipy = "^1.7.3" lark = "^0.11.1" rpcq = "^3.10.0" -pydantic = "^1.10.7" networkx = ">=2.5" importlib-metadata = { version = ">=3.7.3,<5", python = "<3.8" } qcs-sdk-python = "0.16.4" @@ -70,6 +69,7 @@ docs = ["Sphinx", "sphinx-rtd-theme", "nbsphinx", "recommonmark", "pandoc", "mat [tool.poetry.group.dev.dependencies] setuptools = {version = "^69.0.2", python = ">=3.12"} +mypy = "^1.8.0" [tool.ruff] line-length = 120 diff --git a/pyquil/external/rpcq.py b/pyquil/external/rpcq.py index 719eca1b5..e15a3b8d9 100644 --- a/pyquil/external/rpcq.py +++ b/pyquil/external/rpcq.py @@ -1,56 +1,270 @@ -from typing import Dict, List, Union, Optional, Any -from typing_extensions import Literal -from pydantic import BaseModel, Field +import json +from typing import Dict, List, Union, Optional, Any, Literal + +from deprecated.sphinx import deprecated from rpcq.messages import TargetDevice as TargetQuantumProcessor +from dataclasses import dataclass, field +JsonValue = Union[type(None), bool, int, float, str, List["JsonValue"], Dict[str, "JsonValue"]] -class Operator(BaseModel): +@dataclass +class Operator: operator: Optional[str] = None duration: Optional[float] = None fidelity: Optional[float] = None - + def __post_init__(self): + self.duration = float(self.duration) if self.duration is not None else None + self.fidelity = float(self.fidelity) if self.fidelity is not None else None + + def _dict(self) -> Dict[str, JsonValue]: + if type(self) is Operator: + raise ValueError("Should be a subclass") + return dict( + operator=self.operator, + duration=self.duration, + fidelity=self.fidelity, + ) + + @deprecated( + version="4.7", + reason="No longer requires serialization of RPCQ objects and is dropping Pydantic as a dependency.", # noqa: E501 + ) + def dict(self): + return self._dict() + + @classmethod + def _parse_obj(cls, dictionary: Dict): + return Operator(**dictionary) + + @classmethod + @deprecated( + version="4.7", + reason="No longer requires serialization of RPCQ objects and is dropping Pydantic as a dependency.", # noqa: E501 + ) + def parse_obj(cls, dictionary: Dict): + return cls._parse_obj(dictionary) + + +@dataclass class MeasureInfo(Operator): qubit: Optional[Union[int, str]] = None target: Optional[Union[int, str]] = None operator_type: Literal["measure"] = "measure" - + def __post_init__(self): + self.qubit = str(self.qubit) + + def _dict(self) -> Dict[str, JsonValue]: + return dict( + operator_type=self.operator_type, + operator=self.operator, + duration=self.duration, + fidelity=self.fidelity, + qubit=self.qubit, + target=self.target, + ) + + @deprecated( + version="4.7", + reason="No longer requires serialization of RPCQ objects and is dropping Pydantic as a dependency.", # noqa: E501 + ) + def dict(self): + return self._dict() + + @classmethod + def _parse_obj(cls, dictionary: Dict) -> "MeasureInfo": + return MeasureInfo( + operator=dictionary.get("operator"), + duration=dictionary.get("duration"), + fidelity=dictionary.get("fidelity"), + qubit=dictionary.get("qubit"), + target=dictionary.get("target"), + ) + + @classmethod + @deprecated( + version="4.7", + reason="No longer requires serialization of RPCQ objects and is dropping Pydantic as a dependency.", # noqa: E501 + ) + def parse_obj(cls, dictionary: Dict): + return cls._parse_obj(dictionary) + + +@dataclass class GateInfo(Operator): - parameters: List[Union[float, str]] = Field(default_factory=list) - arguments: List[Union[int, str]] = Field(default_factory=list) + parameters: List[Union[float, str]] = field(default_factory=list) + arguments: List[Union[int, str]] = field(default_factory=list) operator_type: Literal["gate"] = "gate" - -class Qubit(BaseModel): + def _dict(self) -> Dict[str, JsonValue]: + return dict( + operator_type=self.operator_type, + operator=self.operator, + duration=self.duration, + fidelity=self.fidelity, + parameters=self.parameters, + arguments=self.arguments, + ) + + @deprecated( + version="4.7", + reason="No longer requires serialization of RPCQ objects and is dropping Pydantic as a dependency.", # noqa: E501 + ) + def dict(self): + return self._dict() + + @classmethod + def _parse_obj(cls, dictionary: dict) -> "GateInfo": + return GateInfo( + operator=dictionary.get("operator"), + duration=dictionary.get("duration"), + fidelity=dictionary.get("fidelity"), + parameters=dictionary["parameters"], + arguments=dictionary["arguments"], + ) + + @classmethod + @deprecated( + version="4.7", + reason="No longer requires serialization of RPCQ objects and is dropping Pydantic as a dependency.", # noqa: E501 + ) + def parse_obj(cls, dictionary: Dict): + return cls._parse_obj(dictionary) + + +def _parse_operator(dictionary: dict) -> Union[GateInfo, MeasureInfo]: + operator_type = dictionary["operator_type"] + if operator_type == "measure": + return MeasureInfo._parse_obj(dictionary) + if operator_type == "gate": + return GateInfo._parse_obj(dictionary) + raise ValueError("Should be a subclass of Operator") + + +@dataclass +class Qubit: id: int dead: Optional[bool] = False - gates: List[Union[GateInfo, MeasureInfo]] = Field(default_factory=list) - - def dict(self, **kwargs: Any) -> Dict[str, Any]: - exclude = kwargs.get("exclude") or set() - if not self.dead: - exclude.add("dead") - kwargs["exclude"] = exclude - return super().dict(**kwargs) - - -class Edge(BaseModel): + gates: List[Union[GateInfo, MeasureInfo]] = field(default_factory=list) + + def _dict(self) -> Dict[str, JsonValue]: + encoding = dict( + id=self.id, + gates=[g._dict() for g in self.gates] + ) + if self.dead: + encoding["dead"] = self.dead + return encoding + + @deprecated( + version="4.7", + reason="No longer requires serialization of RPCQ objects and is dropping Pydantic as a dependency.", # noqa: E501 + ) + def dict(self): + return self._dict() + + @classmethod + def _parse_obj(cls, dictionary: Dict) -> "Qubit": + return Qubit( + id=dictionary["id"], + dead=bool(dictionary.get("dead")), + gates=[_parse_operator(v) for v in dictionary.get("gates", [])], + ) + + @classmethod + @deprecated( + version="4.7", + reason="No longer requires serialization of RPCQ objects and is dropping Pydantic as a dependency.", # noqa: E501 + ) + def parse_obj(cls, dictionary: Dict): + return cls._parse_obj(dictionary) + + +@dataclass +class Edge: ids: List[int] dead: Optional[bool] = False - gates: List[GateInfo] = Field(default_factory=list) + gates: List[GateInfo] = field(default_factory=list) + + def _dict(self) -> Dict[str, JsonValue]: + encoding = dict( + ids=self.ids, + gates=[g._dict() for g in self.gates] + ) + if self.dead: + encoding["dead"] = self.dead + return encoding + + @deprecated( + version="4.7", + reason="No longer requires serialization of RPCQ objects and is dropping Pydantic as a dependency.", # noqa: E501 + ) + def dict(self): + return self._dict() + + @classmethod + def _parse_obj(cls, dictionary: dict) -> "Edge": + return Edge( + ids=dictionary["ids"], + dead=bool(dictionary.get("dead")), + gates=[GateInfo._parse_obj(g) for g in dictionary.get("gates", [])] + ) + + @classmethod + @deprecated( + version="4.7", + reason="No longer requires serialization of RPCQ objects and is dropping Pydantic as a dependency.", # noqa: E501 + ) + def parse_obj(cls, dictionary: Dict): + return cls._parse_obj(dictionary) + + +@dataclass +class CompilerISA: + qubits: Dict[str, Qubit] = field(default_factory=dict) + edges: Dict[str, Edge] = field(default_factory=dict) + + def _dict(self) -> Dict[str, JsonValue]: + return { + "1Q": {k: q._dict() for k, q in self.qubits.items()}, + "2Q": {k: e._dict() for k, e in self.edges.items()} + } + + @deprecated( + version="4.7", + reason="No longer requires serialization of RPCQ objects and is dropping Pydantic as a dependency.", # noqa: E501 + ) + def dict(self): + return self._dict() + + @classmethod + def _parse_obj(cls, dictionary: Dict): + qubit_dict = dictionary.get("1Q", {}) + edge_dict = dictionary.get("2Q", {}) + return CompilerISA( + qubits={k: Qubit._parse_obj(v) for k, v in qubit_dict.items()}, + edges={k: Edge._parse_obj(v) for k, v in edge_dict.items()}, + ) + + @classmethod + @deprecated( + version="4.7", + reason="No longer requires serialization of RPCQ objects and is dropping Pydantic as a dependency.", # noqa: E501 + ) + def parse_obj(cls, dictionary: Dict): + return cls._parse_obj(dictionary) + + @classmethod + @deprecated( + version="4.7", + reason="No longer requires serialization of RPCQ objects and is dropping Pydantic as a dependency.", # noqa: E501 + ) + def parse_file(cls, filename: str): + with open(filename, "r") as file: + json_dict = json.load(file) + return cls._parse_obj(json_dict) - def dict(self, **kwargs: Any) -> Dict[str, Any]: - exclude = kwargs.get("exclude") or set() - if not self.dead: - exclude.add("dead") - kwargs["exclude"] = exclude - return super().dict(**kwargs) - - -class CompilerISA(BaseModel): - qubits: Dict[str, Qubit] = Field(default_factory=dict, alias="1Q") - edges: Dict[str, Edge] = Field(default_factory=dict, alias="2Q") def add_qubit(quantum_processor: CompilerISA, node_id: int) -> Qubit: @@ -79,20 +293,8 @@ def get_edge(quantum_processor: CompilerISA, qubit1: int, qubit2: int) -> Option return quantum_processor.edges.get(edge_id) -def _edge_ids_from_id(edge_id: str) -> List[int]: - return [int(node_id) for node_id in edge_id.split("-")] - - -def _compiler_isa_from_dict(data: Dict[str, Dict[str, Any]]) -> CompilerISA: - compiler_isa_data = { - "1Q": {k: {"id": int(k), **v} for k, v in data.get("1Q", {}).items()}, - "2Q": {k: {"ids": _edge_ids_from_id(k), **v} for k, v in data.get("2Q", {}).items()}, - } - return CompilerISA.parse_obj(compiler_isa_data) - - def compiler_isa_to_target_quantum_processor(compiler_isa: CompilerISA) -> TargetQuantumProcessor: - return TargetQuantumProcessor(isa=compiler_isa.dict(by_alias=True), specs={}) + return TargetQuantumProcessor(isa=compiler_isa._dict(), specs={}) class Supported1QGate: diff --git a/test/unit/conftest.py b/test/unit/conftest.py index 4607106d4..3377eabcc 100644 --- a/test/unit/conftest.py +++ b/test/unit/conftest.py @@ -42,42 +42,45 @@ def compiler_isa() -> CompilerISA: gates_2q = [] for gate in DEFAULT_2Q_GATES: gates_2q.extend(_transform_edge_operation_to_gates(gate)) - return CompilerISA.parse_obj( - { - "1Q": { - "0": {"id": 0, "gates": gates_1q}, - "1": {"id": 1, "gates": gates_1q}, - "2": {"id": 2, "gates": gates_1q}, - "3": {"id": 3, "dead": True}, + gates_1q = [g.dict() for g in gates_1q] + gates_2q = [g.dict() for g in gates_2q] + compiler_isa_dict = { + "1Q": { + "0": {"id": 0, "gates": gates_1q}, + "1": {"id": 1, "gates": gates_1q}, + "2": {"id": 2, "gates": gates_1q}, + "3": {"id": 3, "dead": True}, + }, + "2Q": { + "0-1": {"ids": [0, 1], "gates": gates_2q}, + "1-2": { + "ids": [1, 2], + "gates": [ + { + "operator_type": "gate", + "operator": "ISWAP", + "parameters": [], + "arguments": ["_", "_"], + } + ], }, - "2Q": { - "0-1": {"ids": [0, 1], "gates": gates_2q}, - "1-2": { - "ids": [1, 2], - "gates": [ - { - "operator_type": "gate", - "operator": "ISWAP", - "parameters": [], - "arguments": ["_", "_"], - } - ], - }, - "0-2": { - "ids": [0, 2], - "gates": [ - { - "operator_type": "gate", - "operator": "CPHASE", - "parameters": ["theta"], - "arguments": ["_", "_"], - }, - ], - }, - "0-3": {"ids": [0, 3], "dead": True}, + "0-2": { + "ids": [0, 2], + "gates": [ + { + "operator_type": "gate", + "operator": "CPHASE", + "parameters": ["theta"], + "arguments": ["_", "_"], + }, + ], }, - } - ) + "0-3": {"ids": [0, 3], "dead": True}, + }, + } + # from pprint import pprint + # pprint(compiler_isa_dict) + return CompilerISA.parse_obj(compiler_isa_dict) @pytest.fixture() diff --git a/test/unit/test_api.py b/test/unit/test_api.py index 4b1e7146f..e5dcec1df 100644 --- a/test/unit/test_api.py +++ b/test/unit/test_api.py @@ -18,7 +18,7 @@ import numpy as np -from pyquil.external.rpcq import _compiler_isa_from_dict +from pyquil.external.rpcq import CompilerISA, Qubit, Edge from pyquil.gates import CNOT, H, MEASURE, PHASE, RZ, RX, CZ from pyquil.paulis import PauliTerm from pyquil.quil import Program @@ -48,8 +48,15 @@ Halt(), ] ) -DUMMY_ISA_DICT = {"1Q": {"0": {}, "1": {}}, "2Q": {"0-1": {}}} -DUMMY_ISA = _compiler_isa_from_dict(DUMMY_ISA_DICT) +DUMMY_ISA = CompilerISA( + qubits={ + "0": Qubit(id=0), + "1": Qubit(id=1), + }, + edges={ + "0-1": Edge(ids=[0, 1]), + }, +) COMPILED_BYTES_ARRAY = b"SUPER SECRET PACKAGE" RB_ENCODED_REPLY = [[0, 0], [1, 1]] diff --git a/test/unit/test_graph.py b/test/unit/test_graph.py index 902420512..837b3d7a1 100644 --- a/test/unit/test_graph.py +++ b/test/unit/test_graph.py @@ -19,7 +19,7 @@ def test_isa_from_graph_order(): # representation will have it as (16,15) fc = nx.from_edgelist([(16, 17), (15, 16)]) isa = graph_to_compiler_isa(fc) - isad = isa.dict(by_alias=True) + isad = isa.dict() for k in isad["2Q"]: q1, q2 = k.split("-") assert q1 < q2