From 640e771d6ab11cbddc023ad57df2e4394e3d1c42 Mon Sep 17 00:00:00 2001 From: Agustin Borgna Date: Wed, 1 Nov 2023 16:32:43 +0000 Subject: [PATCH 01/13] refactor: Move tket2 to a workspace module --- .gitignore | 3 +- Cargo.toml | 78 +++---------------- compile-rewriter/Cargo.toml | 9 ++- justfile | 4 +- pyrs/Cargo.toml | 9 ++- taso-optimiser/Cargo.toml | 9 ++- tket2/Cargo.toml | 68 ++++++++++++++++ {benches => tket2/benches}/bench_main.rs | 0 .../benches}/benchmarks/generators.rs | 0 {benches => tket2/benches}/benchmarks/hash.rs | 0 {benches => tket2/benches}/benchmarks/mod.rs | 0 {src => tket2/src}/circuit.rs | 0 {src => tket2/src}/circuit/command.rs | 0 {src => tket2/src}/circuit/cost.rs | 0 {src => tket2/src}/circuit/hash.rs | 0 {src => tket2/src}/circuit/units.rs | 0 {src => tket2/src}/circuit/units/filter.rs | 0 {src => tket2/src}/extension.rs | 0 {src => tket2/src}/json.rs | 0 {src => tket2/src}/json/decoder.rs | 0 {src => tket2/src}/json/encoder.rs | 0 {src => tket2/src}/json/op.rs | 0 {src => tket2/src}/json/tests.rs | 2 +- {src => tket2/src}/lib.rs | 0 {src => tket2/src}/ops.rs | 0 {src => tket2/src}/optimiser.rs | 0 {src => tket2/src}/optimiser/taso.rs | 2 +- .../src}/optimiser/taso/eq_circ_class.rs | 0 .../src}/optimiser/taso/hugr_pchannel.rs | 0 .../src}/optimiser/taso/hugr_pqueue.rs | 0 {src => tket2/src}/optimiser/taso/log.rs | 0 .../src}/optimiser/taso/qtz_circuit.rs | 4 +- {src => tket2/src}/optimiser/taso/worker.rs | 0 {src => tket2/src}/passes.rs | 0 {src => tket2/src}/passes/_classical.rs | 0 {src => tket2/src}/passes/_squash.rs | 0 {src => tket2/src}/passes/chunks.rs | 0 {src => tket2/src}/passes/commutation.rs | 0 {src => tket2/src}/portmatching.rs | 0 {src => tket2/src}/portmatching/matcher.rs | 0 {src => tket2/src}/portmatching/pattern.rs | 0 {src => tket2/src}/portmatching/pyo3.rs | 0 {src => tket2/src}/rewrite.rs | 0 {src => tket2/src}/rewrite/ecc_rewriter.rs | 4 +- {src => tket2/src}/rewrite/strategy.rs | 0 {src => tket2/src}/utils.rs | 0 46 files changed, 107 insertions(+), 85 deletions(-) create mode 100644 tket2/Cargo.toml rename {benches => tket2/benches}/bench_main.rs (100%) rename {benches => tket2/benches}/benchmarks/generators.rs (100%) rename {benches => tket2/benches}/benchmarks/hash.rs (100%) rename {benches => tket2/benches}/benchmarks/mod.rs (100%) rename {src => tket2/src}/circuit.rs (100%) rename {src => tket2/src}/circuit/command.rs (100%) rename {src => tket2/src}/circuit/cost.rs (100%) rename {src => tket2/src}/circuit/hash.rs (100%) rename {src => tket2/src}/circuit/units.rs (100%) rename {src => tket2/src}/circuit/units/filter.rs (100%) rename {src => tket2/src}/extension.rs (100%) rename {src => tket2/src}/json.rs (100%) rename {src => tket2/src}/json/decoder.rs (100%) rename {src => tket2/src}/json/encoder.rs (100%) rename {src => tket2/src}/json/op.rs (100%) rename {src => tket2/src}/json/tests.rs (99%) rename {src => tket2/src}/lib.rs (100%) rename {src => tket2/src}/ops.rs (100%) rename {src => tket2/src}/optimiser.rs (100%) rename {src => tket2/src}/optimiser/taso.rs (99%) rename {src => tket2/src}/optimiser/taso/eq_circ_class.rs (100%) rename {src => tket2/src}/optimiser/taso/hugr_pchannel.rs (100%) rename {src => tket2/src}/optimiser/taso/hugr_pqueue.rs (100%) rename {src => tket2/src}/optimiser/taso/log.rs (100%) rename {src => tket2/src}/optimiser/taso/qtz_circuit.rs (96%) rename {src => tket2/src}/optimiser/taso/worker.rs (100%) rename {src => tket2/src}/passes.rs (100%) rename {src => tket2/src}/passes/_classical.rs (100%) rename {src => tket2/src}/passes/_squash.rs (100%) rename {src => tket2/src}/passes/chunks.rs (100%) rename {src => tket2/src}/passes/commutation.rs (100%) rename {src => tket2/src}/portmatching.rs (100%) rename {src => tket2/src}/portmatching/matcher.rs (100%) rename {src => tket2/src}/portmatching/pattern.rs (100%) rename {src => tket2/src}/portmatching/pyo3.rs (100%) rename {src => tket2/src}/rewrite.rs (100%) rename {src => tket2/src}/rewrite/ecc_rewriter.rs (99%) rename {src => tket2/src}/rewrite/strategy.rs (100%) rename {src => tket2/src}/utils.rs (100%) diff --git a/.gitignore b/.gitignore index 8414c4fb..22dc2f45 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ /target Cargo.lock -pyrs/target/ +pytket-tk2/target/ +__pycache__ .ipynb_checkpoints # Devenv diff --git a/Cargo.toml b/Cargo.toml index 6bea0559..33f9c941 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,78 +1,22 @@ -[package] -name = "tket2" -version = "0.1.0" -edition = "2021" - -[lib] -bench = false -name = "tket2" -path = "src/lib.rs" - [profile.release] lto = "thin" -[dependencies] -lazy_static = "1.4.0" -cgmath = "0.18.0" -num-rational = "0.4" -num-complex = { version = "0.4", optional = true } -tket-json-rs = { workspace = true } -rayon = "1.5" -thiserror = "1.0.28" -serde = { version = "1.0", features = ["derive"] } -serde_json = "1.0" -downcast-rs = "1.2.0" -priority-queue = "1.3.0" -smol_str = "0.2.0" -typetag = "0.2.8" -itertools = { workspace = true } -petgraph = { version = "0.6.3", default-features = false } -serde_yaml = "0.9.22" -# portmatching = { version = "0.2.0", optional = true, features = ["serde"]} -portmatching = { optional = true, git = "https://github.com/lmondada/portmatching", rev = "738c91c", features = [ - "serde", -] } -derive_more = "0.99.17" -quantinuum-hugr = { workspace = true } -portgraph = { workspace = true, features = ["serde"] } -pyo3 = { workspace = true, optional = true, features = ["multiple-pymethods"] } -strum_macros = "0.25.2" -strum = "0.25.0" -fxhash = "0.2.1" -rmp-serde = { version = "1.1.2", optional = true } -delegate = "0.10.0" -csv = { version = "1.2.2" } -chrono = { version = "0.4.30" } -bytemuck = "1.14.0" -stringreader = "0.1.1" -crossbeam-channel = "0.5.8" -tracing = { workspace = true } - -[features] -pyo3 = [ - "dep:pyo3", - "tket-json-rs/pyo3", - "portgraph/pyo3", - "quantinuum-hugr/pyo3", -] -portmatching = ["dep:portmatching", "dep:rmp-serde"] - -[dev-dependencies] -rstest = "0.18.1" -criterion = { version = "0.5.1", features = ["html_reports"] } -webbrowser = "0.8.10" -urlencoding = "2.1.2" - -[[bench]] -name = "bench_main" -harness = false - [workspace] +resolver = "2" +members = ["tket2", "pyrs", "compile-rewriter", "taso-optimiser"] +default-members = ["tket2"] -members = ["pyrs", "compile-rewriter", "taso-optimiser"] +[workspace.package] +version = "0.1.0" +rust-version = "1.70" +edition = "2021" +homepage = "https://github.com/CQCL/tket2" +license-file = "LICENCE" +# authors [workspace.dependencies] +tket2 = { path = "./tket2" } quantinuum-hugr = { git = "https://github.com/CQCL-DEV/hugr", rev = "0beb165" } portgraph = { version = "0.10" } pyo3 = { version = "0.20" } diff --git a/compile-rewriter/Cargo.toml b/compile-rewriter/Cargo.toml index c7cb8b9e..513b744a 100644 --- a/compile-rewriter/Cargo.toml +++ b/compile-rewriter/Cargo.toml @@ -1,12 +1,15 @@ [package] name = "compile-matcher" -version = "0.1.0" -edition = "2021" +edition = { workspace = true } +version = { workspace = true } +rust-version = { workspace = true } +homepage = { workspace = true } +license-file = { workspace = true } # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] clap = { version = "4.4.2", features = ["derive"] } -tket2 = { path = "../", features = ["portmatching"] } +tket2 = { workspace = true, features = ["portmatching"] } quantinuum-hugr = { workspace = true } itertools = { workspace = true } diff --git a/justfile b/justfile index bbee89e0..56cc3c3a 100644 --- a/justfile +++ b/justfile @@ -1,8 +1,8 @@ test: - cargo test + cargo test --all-features fix: - cargo clippy --fix --allow-staged + cargo clippy --all-targets --all-features --workspace --fix --allow-staged ptest: (cd pyrs && maturin develop && pytest) \ No newline at end of file diff --git a/pyrs/Cargo.toml b/pyrs/Cargo.toml index ab53c31f..49a8e3de 100644 --- a/pyrs/Cargo.toml +++ b/pyrs/Cargo.toml @@ -1,7 +1,10 @@ [package] name = "pyrs" -version = "0.1.0" -edition = "2018" +edition = { workspace = true } +version = { workspace = true } +rust-version = { workspace = true } +homepage = { workspace = true } +license-file = { workspace = true } # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [lib] @@ -9,7 +12,7 @@ name = "pyrs" crate-type = ["cdylib"] [dependencies] -tket2 = { path = "../", features = ["pyo3", "portmatching"] } +tket2 = { workspace = true, features = ["pyo3", "portmatching"] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" tket-json-rs = { workspace = true, features = ["pyo3"] } diff --git a/taso-optimiser/Cargo.toml b/taso-optimiser/Cargo.toml index 5d82ccb7..a8fcd5af 100644 --- a/taso-optimiser/Cargo.toml +++ b/taso-optimiser/Cargo.toml @@ -1,14 +1,17 @@ [package] name = "taso-optimiser" -version = "0.1.0" -edition = "2021" +edition = { workspace = true } +version = { workspace = true } +rust-version = { workspace = true } +homepage = { workspace = true } +license-file = { workspace = true } # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] clap = { version = "4.4.2", features = ["derive"] } serde_json = "1.0" -tket2 = { path = "../", features = ["portmatching"] } +tket2 = { workspace = true, features = ["portmatching"] } quantinuum-hugr = { workspace = true } itertools = { workspace = true } tket-json-rs = { workspace = true } diff --git a/tket2/Cargo.toml b/tket2/Cargo.toml new file mode 100644 index 00000000..94328feb --- /dev/null +++ b/tket2/Cargo.toml @@ -0,0 +1,68 @@ +[package] +name = "tket2" +edition = { workspace = true } +version = { workspace = true } +rust-version = { workspace = true } +homepage = { workspace = true } +license-file = { workspace = true } + +[lib] +bench = false +name = "tket2" +path = "src/lib.rs" + +[features] +pyo3 = [ + "dep:pyo3", + "tket-json-rs/pyo3", + "portgraph/pyo3", + "quantinuum-hugr/pyo3", +] +portmatching = ["dep:portmatching", "dep:rmp-serde"] + +[dependencies] +lazy_static = "1.4.0" +cgmath = "0.18.0" +num-rational = "0.4" +num-complex = { version = "0.4", optional = true } +tket-json-rs = { workspace = true } +rayon = "1.5" +thiserror = "1.0.28" +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" +downcast-rs = "1.2.0" +priority-queue = "1.3.0" +smol_str = "0.2.0" +typetag = "0.2.8" +itertools = { workspace = true } +petgraph = { version = "0.6.3", default-features = false } +serde_yaml = "0.9.22" +# portmatching = { version = "0.2.0", optional = true, features = ["serde"]} +portmatching = { optional = true, git = "https://github.com/lmondada/portmatching", rev = "738c91c", features = [ + "serde", +] } +derive_more = "0.99.17" +quantinuum-hugr = { workspace = true } +portgraph = { workspace = true, features = ["serde"] } +pyo3 = { workspace = true, optional = true, features = ["multiple-pymethods"] } +strum_macros = "0.25.2" +strum = "0.25.0" +fxhash = "0.2.1" +rmp-serde = { version = "1.1.2", optional = true } +delegate = "0.10.0" +csv = { version = "1.2.2" } +chrono = { version = "0.4.30" } +bytemuck = "1.14.0" +stringreader = "0.1.1" +crossbeam-channel = "0.5.8" +tracing = { workspace = true } + +[dev-dependencies] +rstest = "0.18.1" +criterion = { version = "0.5.1", features = ["html_reports"] } +webbrowser = "0.8.10" +urlencoding = "2.1.2" + +[[bench]] +name = "bench_main" +harness = false diff --git a/benches/bench_main.rs b/tket2/benches/bench_main.rs similarity index 100% rename from benches/bench_main.rs rename to tket2/benches/bench_main.rs diff --git a/benches/benchmarks/generators.rs b/tket2/benches/benchmarks/generators.rs similarity index 100% rename from benches/benchmarks/generators.rs rename to tket2/benches/benchmarks/generators.rs diff --git a/benches/benchmarks/hash.rs b/tket2/benches/benchmarks/hash.rs similarity index 100% rename from benches/benchmarks/hash.rs rename to tket2/benches/benchmarks/hash.rs diff --git a/benches/benchmarks/mod.rs b/tket2/benches/benchmarks/mod.rs similarity index 100% rename from benches/benchmarks/mod.rs rename to tket2/benches/benchmarks/mod.rs diff --git a/src/circuit.rs b/tket2/src/circuit.rs similarity index 100% rename from src/circuit.rs rename to tket2/src/circuit.rs diff --git a/src/circuit/command.rs b/tket2/src/circuit/command.rs similarity index 100% rename from src/circuit/command.rs rename to tket2/src/circuit/command.rs diff --git a/src/circuit/cost.rs b/tket2/src/circuit/cost.rs similarity index 100% rename from src/circuit/cost.rs rename to tket2/src/circuit/cost.rs diff --git a/src/circuit/hash.rs b/tket2/src/circuit/hash.rs similarity index 100% rename from src/circuit/hash.rs rename to tket2/src/circuit/hash.rs diff --git a/src/circuit/units.rs b/tket2/src/circuit/units.rs similarity index 100% rename from src/circuit/units.rs rename to tket2/src/circuit/units.rs diff --git a/src/circuit/units/filter.rs b/tket2/src/circuit/units/filter.rs similarity index 100% rename from src/circuit/units/filter.rs rename to tket2/src/circuit/units/filter.rs diff --git a/src/extension.rs b/tket2/src/extension.rs similarity index 100% rename from src/extension.rs rename to tket2/src/extension.rs diff --git a/src/json.rs b/tket2/src/json.rs similarity index 100% rename from src/json.rs rename to tket2/src/json.rs diff --git a/src/json/decoder.rs b/tket2/src/json/decoder.rs similarity index 100% rename from src/json/decoder.rs rename to tket2/src/json/decoder.rs diff --git a/src/json/encoder.rs b/tket2/src/json/encoder.rs similarity index 100% rename from src/json/encoder.rs rename to tket2/src/json/encoder.rs diff --git a/src/json/op.rs b/tket2/src/json/op.rs similarity index 100% rename from src/json/op.rs rename to tket2/src/json/op.rs diff --git a/src/json/tests.rs b/tket2/src/json/tests.rs similarity index 99% rename from src/json/tests.rs rename to tket2/src/json/tests.rs index 195ee444..21a3d982 100644 --- a/src/json/tests.rs +++ b/tket2/src/json/tests.rs @@ -74,7 +74,7 @@ fn json_roundtrip(#[case] circ_s: &str, #[case] num_commands: usize, #[case] num #[rstest] #[cfg_attr(miri, ignore)] // Opening files is not supported in (isolated) miri -#[case::barenco_tof_10("test_files/barenco_tof_10.json")] +#[case::barenco_tof_10("../test_files/barenco_tof_10.json")] fn json_file_roundtrip(#[case] circ: impl AsRef) { let reader = BufReader::new(std::fs::File::open(circ).unwrap()); let ser: circuit_json::SerialCircuit = serde_json::from_reader(reader).unwrap(); diff --git a/src/lib.rs b/tket2/src/lib.rs similarity index 100% rename from src/lib.rs rename to tket2/src/lib.rs diff --git a/src/ops.rs b/tket2/src/ops.rs similarity index 100% rename from src/ops.rs rename to tket2/src/ops.rs diff --git a/src/optimiser.rs b/tket2/src/optimiser.rs similarity index 100% rename from src/optimiser.rs rename to tket2/src/optimiser.rs diff --git a/src/optimiser/taso.rs b/tket2/src/optimiser/taso.rs similarity index 99% rename from src/optimiser/taso.rs rename to tket2/src/optimiser/taso.rs index a54a6471..ff906770 100644 --- a/src/optimiser/taso.rs +++ b/tket2/src/optimiser/taso.rs @@ -459,7 +459,7 @@ mod tests { #[fixture] fn taso_opt() -> DefaultTasoOptimiser { - TasoOptimiser::default_with_eccs_json_file("test_files/small_eccs.json").unwrap() + TasoOptimiser::default_with_eccs_json_file("../test_files/small_eccs.json").unwrap() } #[rstest] diff --git a/src/optimiser/taso/eq_circ_class.rs b/tket2/src/optimiser/taso/eq_circ_class.rs similarity index 100% rename from src/optimiser/taso/eq_circ_class.rs rename to tket2/src/optimiser/taso/eq_circ_class.rs diff --git a/src/optimiser/taso/hugr_pchannel.rs b/tket2/src/optimiser/taso/hugr_pchannel.rs similarity index 100% rename from src/optimiser/taso/hugr_pchannel.rs rename to tket2/src/optimiser/taso/hugr_pchannel.rs diff --git a/src/optimiser/taso/hugr_pqueue.rs b/tket2/src/optimiser/taso/hugr_pqueue.rs similarity index 100% rename from src/optimiser/taso/hugr_pqueue.rs rename to tket2/src/optimiser/taso/hugr_pqueue.rs diff --git a/src/optimiser/taso/log.rs b/tket2/src/optimiser/taso/log.rs similarity index 100% rename from src/optimiser/taso/log.rs rename to tket2/src/optimiser/taso/log.rs diff --git a/src/optimiser/taso/qtz_circuit.rs b/tket2/src/optimiser/taso/qtz_circuit.rs similarity index 96% rename from src/optimiser/taso/qtz_circuit.rs rename to tket2/src/optimiser/taso/qtz_circuit.rs index 11ea2982..ef5cd19b 100644 --- a/src/optimiser/taso/qtz_circuit.rs +++ b/tket2/src/optimiser/taso/qtz_circuit.rs @@ -145,7 +145,7 @@ mod tests { #[cfg_attr(miri, ignore)] // Opening files is not supported in (isolated) miri fn test_read_rep() { let rep_map: HashMap = - load_representative_set("test_files/h_rz_cxrepresentative_set.json"); + load_representative_set("../test_files/h_rz_cxrepresentative_set.json"); for c in rep_map.values().take(1) { println!("{}", c.dot_string()); @@ -156,7 +156,7 @@ mod tests { #[cfg_attr(miri, ignore)] // Opening files is not supported in (isolated) miri fn test_read_complete() { let _ecc: HashMap> = - load_ecc_set("test_files/h_rz_cxcomplete_ECC_set.json").unwrap(); + load_ecc_set("../test_files/h_rz_cxcomplete_ECC_set.json").unwrap(); // ecc.values() // .flatten() diff --git a/src/optimiser/taso/worker.rs b/tket2/src/optimiser/taso/worker.rs similarity index 100% rename from src/optimiser/taso/worker.rs rename to tket2/src/optimiser/taso/worker.rs diff --git a/src/passes.rs b/tket2/src/passes.rs similarity index 100% rename from src/passes.rs rename to tket2/src/passes.rs diff --git a/src/passes/_classical.rs b/tket2/src/passes/_classical.rs similarity index 100% rename from src/passes/_classical.rs rename to tket2/src/passes/_classical.rs diff --git a/src/passes/_squash.rs b/tket2/src/passes/_squash.rs similarity index 100% rename from src/passes/_squash.rs rename to tket2/src/passes/_squash.rs diff --git a/src/passes/chunks.rs b/tket2/src/passes/chunks.rs similarity index 100% rename from src/passes/chunks.rs rename to tket2/src/passes/chunks.rs diff --git a/src/passes/commutation.rs b/tket2/src/passes/commutation.rs similarity index 100% rename from src/passes/commutation.rs rename to tket2/src/passes/commutation.rs diff --git a/src/portmatching.rs b/tket2/src/portmatching.rs similarity index 100% rename from src/portmatching.rs rename to tket2/src/portmatching.rs diff --git a/src/portmatching/matcher.rs b/tket2/src/portmatching/matcher.rs similarity index 100% rename from src/portmatching/matcher.rs rename to tket2/src/portmatching/matcher.rs diff --git a/src/portmatching/pattern.rs b/tket2/src/portmatching/pattern.rs similarity index 100% rename from src/portmatching/pattern.rs rename to tket2/src/portmatching/pattern.rs diff --git a/src/portmatching/pyo3.rs b/tket2/src/portmatching/pyo3.rs similarity index 100% rename from src/portmatching/pyo3.rs rename to tket2/src/portmatching/pyo3.rs diff --git a/src/rewrite.rs b/tket2/src/rewrite.rs similarity index 100% rename from src/rewrite.rs rename to tket2/src/rewrite.rs diff --git a/src/rewrite/ecc_rewriter.rs b/tket2/src/rewrite/ecc_rewriter.rs similarity index 99% rename from src/rewrite/ecc_rewriter.rs rename to tket2/src/rewrite/ecc_rewriter.rs index feabd8f5..dede628a 100644 --- a/src/rewrite/ecc_rewriter.rs +++ b/tket2/src/rewrite/ecc_rewriter.rs @@ -335,7 +335,7 @@ mod tests { fn ecc_rewriter_from_file() { // In this example, all circuits are valid patterns, thus // PatternID == TargetID. - let test_file = "test_files/small_eccs.json"; + let test_file = "../test_files/small_eccs.json"; let rewriter = ECCRewriter::try_from_eccs_json_file(test_file).unwrap(); assert_eq!(rewriter.rewrite_rules.len(), rewriter.matcher.n_patterns()); assert_eq!(rewriter.targets.len(), 5 * 4 + 5 * 3); @@ -370,7 +370,7 @@ mod tests { /// obtain convex patterns #[test] fn ecc_rewriter_empty_params() { - let test_file = "test_files/cx_cx_eccs.json"; + let test_file = "../test_files/cx_cx_eccs.json"; let rewriter = ECCRewriter::try_from_eccs_json_file(test_file).unwrap(); let cx_cx = cx_cx(); diff --git a/src/rewrite/strategy.rs b/tket2/src/rewrite/strategy.rs similarity index 100% rename from src/rewrite/strategy.rs rename to tket2/src/rewrite/strategy.rs diff --git a/src/utils.rs b/tket2/src/utils.rs similarity index 100% rename from src/utils.rs rename to tket2/src/utils.rs From 3c0335469b985ffed12aab2e95015191e6e762b5 Mon Sep 17 00:00:00 2001 From: Agustin Borgna Date: Thu, 2 Nov 2023 15:04:17 +0000 Subject: [PATCH 02/13] Update pyrs name, make it work from the root dir --- Cargo.toml | 2 +- DEVELOPMENT.md | 46 +- README.md | 2 +- devenv.nix | 2 +- justfile | 28 +- poetry.lock | 471 ++++++++++++++++++ pyproject.toml | 45 ++ pyrs/pyproject.toml | 13 - pyrs/pyrs/__init__.py | 0 pyrs/requirements.txt | 1 - {pyrs => pytket-tk2}/.gitignore | 0 {pyrs => pytket-tk2}/Cargo.toml | 4 +- {pyrs => pytket-tk2}/README.md | 4 +- {pyrs => pytket-tk2}/dev-requirements.txt | 0 pytket-tk2/pyproject.toml | 12 + pytket-tk2/pytket_tk2/__init__.py | 5 + .../pytket_tk2}/custom_base.py | 2 +- .../pytket_tk2}/data/nam_6_3.rwr | Bin .../pyrs => pytket-tk2/pytket_tk2}/passes.py | 8 +- pytket-tk2/requirements.txt | 1 + {pyrs => pytket-tk2}/src/circuit.rs | 0 {pyrs => pytket-tk2}/src/lib.rs | 2 +- {pyrs => pytket-tk2}/src/optimiser.rs | 0 {pyrs => pytket-tk2}/src/pass.rs | 0 {pyrs => pytket-tk2}/test/test_bindings.py | 6 +- {pyrs => pytket-tk2}/test/test_optimiser.py | 8 +- {pyrs => pytket-tk2}/test/test_pass.py | 4 +- .../test/test_portmatching.py | 12 +- .../circ.qasm => test_files/simple.qasm | 0 tket2/src/json.rs | 2 +- tket2/src/passes/commutation.rs | 2 +- tket2/src/portmatching/pattern.rs | 2 +- 32 files changed, 611 insertions(+), 73 deletions(-) create mode 100644 poetry.lock create mode 100644 pyproject.toml delete mode 100644 pyrs/pyproject.toml delete mode 100644 pyrs/pyrs/__init__.py delete mode 100644 pyrs/requirements.txt rename {pyrs => pytket-tk2}/.gitignore (100%) rename {pyrs => pytket-tk2}/Cargo.toml (94%) rename {pyrs => pytket-tk2}/README.md (90%) rename {pyrs => pytket-tk2}/dev-requirements.txt (100%) create mode 100644 pytket-tk2/pyproject.toml create mode 100644 pytket-tk2/pytket_tk2/__init__.py rename {pyrs/pyrs => pytket-tk2/pytket_tk2}/custom_base.py (82%) rename {pyrs/pyrs => pytket-tk2/pytket_tk2}/data/nam_6_3.rwr (100%) rename {pyrs/pyrs => pytket-tk2/pytket_tk2}/passes.py (86%) create mode 100644 pytket-tk2/requirements.txt rename {pyrs => pytket-tk2}/src/circuit.rs (100%) rename {pyrs => pytket-tk2}/src/lib.rs (97%) rename {pyrs => pytket-tk2}/src/optimiser.rs (100%) rename {pyrs => pytket-tk2}/src/pass.rs (100%) rename {pyrs => pytket-tk2}/test/test_bindings.py (98%) rename {pyrs => pytket-tk2}/test/test_optimiser.py (51%) rename {pyrs => pytket-tk2}/test/test_pass.py (65%) rename {pyrs => pytket-tk2}/test/test_portmatching.py (79%) rename pyrs/test/test_files/circ.qasm => test_files/simple.qasm (100%) diff --git a/Cargo.toml b/Cargo.toml index 33f9c941..b6266141 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ lto = "thin" [workspace] resolver = "2" -members = ["tket2", "pyrs", "compile-rewriter", "taso-optimiser"] +members = ["tket2", "pytket-tk2", "compile-rewriter", "taso-optimiser"] default-members = ["tket2"] [workspace.package] diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index b930aecd..fc49d6b0 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -24,40 +24,24 @@ devenv shell All the required dependencies should be available. You can automate loading the shell by setting up [direnv](https://devenv.sh/automatic-shell-activation/). -### Manual setup +### Poetry setup To setup the environment manually you will need: -- Rust: https://www.rust-lang.org/tools/install +- Rust 1.70+: https://www.rust-lang.org/tools/install -- Python 3.10+: https://www.python.org/downloads/ +- Poetry: https://python-poetry.org/ - It is advisable to use a virtual environment for keeping the python - environment isolated, see - [`venv`](https://docs.python.org/3/tutorial/venv.html) for more details. - - Install the python development dependencies with: - - ```bash - pip install -r pyrs/dev-requirements.txt - ``` - - -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: - -```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 -``` +Simply run `poetry shell` to activate an environment with all the required dependencies. ## 🏃 Running the tests -To compile and test the rust code, run: +The repository root contains a Justfile with the most common development tasks. +Run `just` to see a list. + +To manually compile and test the rust code, run: ```bash -cargo build cargo test ``` @@ -78,11 +62,19 @@ cargo +nightly miri test To run the python tests, run: ```bash -cd pyrs -maturin develop +maturin develop -m pytket-tk2/Cargo.toml pytest ``` +You can use the script in [`.github/pre-commit`](.github/pre-commit) to run the test and formatting required by our CI. +To automatically check that before each commit, install it as a hook 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 +``` + ## 💅 Coding Style The rustfmt tool is used to enforce a consistent rust coding style. The CI will fail if the code is not formatted correctly. Python code is formatted with black. @@ -93,7 +85,7 @@ To format your code, run: # Format rust code cargo fmt # Format python code -black . +ruff format . ``` We also check for clippy warnings, which are a set of linting rules for rust. To run clippy, run: diff --git a/README.md b/README.md index daf3c96b..30993746 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Version 2 of the TKET compiler. ## Features - `pyo3` -This optional feature enables some python bindings via pyo3. See the `pyrs` folder for more. +This optional feature enables some python bindings via pyo3. See the `pytket-tk2` folder for more. - `portmatching` This enables pattern matching using the `portmatching` crate. diff --git a/devenv.nix b/devenv.nix index a1dd0d15..134d9584 100644 --- a/devenv.nix +++ b/devenv.nix @@ -39,7 +39,7 @@ enable = true; venv.enable = true; - venv.requirements = "-r ${config.env.DEVENV_ROOT}/pyrs/dev-requirements.txt"; + venv.requirements = "-r ${config.env.DEVENV_ROOT}/pytket-tk2/dev-requirements.txt"; }; # https://devenv.sh/pre-commit-hooks/ diff --git a/justfile b/justfile index 56cc3c3a..05e57f49 100644 --- a/justfile +++ b/justfile @@ -1,8 +1,32 @@ +# List the available commands +help: + @just --list --justfile {{justfile()}} + +# Run all the rust tests test: cargo test --all-features +# Auto-fix all clippy warnings fix: cargo clippy --all-targets --all-features --workspace --fix --allow-staged -ptest: - (cd pyrs && maturin develop && pytest) \ No newline at end of file +# Build the python package wheels +pybuild: + maturin build -m pytket-tk2/Cargo.toml --release + +# Build the python package for local development +pydevelop: + maturin develop -m pytket-tk2/Cargo.toml + +# Run the python tests +pytest: pydevelop + pytest + +# Run the pre-commit checks +check: + ./.github/pre-commit + +# Format the code +format: + cargo fmt + ruff format . \ No newline at end of file diff --git a/poetry.lock b/poetry.lock new file mode 100644 index 00000000..7e135809 --- /dev/null +++ b/poetry.lock @@ -0,0 +1,471 @@ +# This file is automatically @generated by Poetry 1.6.1 and should not be changed by hand. + +[[package]] +name = "colorama" +version = "0.4.6" +description = "Cross-platform colored terminal text." +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" +files = [ + {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, + {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, +] + +[[package]] +name = "exceptiongroup" +version = "1.1.3" +description = "Backport of PEP 654 (exception groups)" +optional = false +python-versions = ">=3.7" +files = [ + {file = "exceptiongroup-1.1.3-py3-none-any.whl", hash = "sha256:343280667a4585d195ca1cf9cef84a4e178c4b6cf2274caef9859782b567d5e3"}, + {file = "exceptiongroup-1.1.3.tar.gz", hash = "sha256:097acd85d473d75af5bb98e41b61ff7fe35efe6675e4f9370ec6ec5126d160e9"}, +] + +[package.extras] +test = ["pytest (>=6)"] + +[[package]] +name = "graphviz" +version = "0.20.1" +description = "Simple Python interface for Graphviz" +optional = false +python-versions = ">=3.7" +files = [ + {file = "graphviz-0.20.1-py3-none-any.whl", hash = "sha256:587c58a223b51611c0cf461132da386edd896a029524ca61a1462b880bf97977"}, + {file = "graphviz-0.20.1.zip", hash = "sha256:8c58f14adaa3b947daf26c19bc1e98c4e0702cdc31cf99153e6f06904d492bf8"}, +] + +[package.extras] +dev = ["flake8", "pep8-naming", "tox (>=3)", "twine", "wheel"] +docs = ["sphinx (>=5)", "sphinx-autodoc-typehints", "sphinx-rtd-theme"] +test = ["coverage", "mock (>=4)", "pytest (>=7)", "pytest-cov", "pytest-mock (>=3)"] + +[[package]] +name = "iniconfig" +version = "2.0.0" +description = "brain-dead simple config-ini parsing" +optional = false +python-versions = ">=3.7" +files = [ + {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, + {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, +] + +[[package]] +name = "jinja2" +version = "3.1.2" +description = "A very fast and expressive template engine." +optional = false +python-versions = ">=3.7" +files = [ + {file = "Jinja2-3.1.2-py3-none-any.whl", hash = "sha256:6088930bfe239f0e6710546ab9c19c9ef35e29792895fed6e6e31a023a182a61"}, + {file = "Jinja2-3.1.2.tar.gz", hash = "sha256:31351a702a408a9e7595a8fc6150fc3f43bb6bf7e319770cbc0db9df9437e852"}, +] + +[package.dependencies] +MarkupSafe = ">=2.0" + +[package.extras] +i18n = ["Babel (>=2.7)"] + +[[package]] +name = "lark-parser" +version = "0.12.0" +description = "a modern parsing library" +optional = false +python-versions = "*" +files = [ + {file = "lark-parser-0.12.0.tar.gz", hash = "sha256:15967db1f1214013dca65b1180745047b9be457d73da224fcda3d9dd4e96a138"}, + {file = "lark_parser-0.12.0-py2.py3-none-any.whl", hash = "sha256:0eaf30cb5ba787fe404d73a7d6e61df97b21d5a63ac26c5008c78a494373c675"}, +] + +[package.extras] +atomic-cache = ["atomicwrites"] +nearley = ["js2py"] +regex = ["regex"] + +[[package]] +name = "markupsafe" +version = "2.1.3" +description = "Safely add untrusted strings to HTML/XML markup." +optional = false +python-versions = ">=3.7" +files = [ + {file = "MarkupSafe-2.1.3-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:cd0f502fe016460680cd20aaa5a76d241d6f35a1c3350c474bac1273803893fa"}, + {file = "MarkupSafe-2.1.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:e09031c87a1e51556fdcb46e5bd4f59dfb743061cf93c4d6831bf894f125eb57"}, + {file = "MarkupSafe-2.1.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:68e78619a61ecf91e76aa3e6e8e33fc4894a2bebe93410754bd28fce0a8a4f9f"}, + {file = "MarkupSafe-2.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:65c1a9bcdadc6c28eecee2c119465aebff8f7a584dd719facdd9e825ec61ab52"}, + {file = "MarkupSafe-2.1.3-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:525808b8019e36eb524b8c68acdd63a37e75714eac50e988180b169d64480a00"}, + {file = "MarkupSafe-2.1.3-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:962f82a3086483f5e5f64dbad880d31038b698494799b097bc59c2edf392fce6"}, + {file = "MarkupSafe-2.1.3-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:aa7bd130efab1c280bed0f45501b7c8795f9fdbeb02e965371bbef3523627779"}, + {file = "MarkupSafe-2.1.3-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:c9c804664ebe8f83a211cace637506669e7890fec1b4195b505c214e50dd4eb7"}, + {file = "MarkupSafe-2.1.3-cp310-cp310-win32.whl", hash = "sha256:10bbfe99883db80bdbaff2dcf681dfc6533a614f700da1287707e8a5d78a8431"}, + {file = "MarkupSafe-2.1.3-cp310-cp310-win_amd64.whl", hash = "sha256:1577735524cdad32f9f694208aa75e422adba74f1baee7551620e43a3141f559"}, + {file = "MarkupSafe-2.1.3-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:ad9e82fb8f09ade1c3e1b996a6337afac2b8b9e365f926f5a61aacc71adc5b3c"}, + {file = "MarkupSafe-2.1.3-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:3c0fae6c3be832a0a0473ac912810b2877c8cb9d76ca48de1ed31e1c68386575"}, + {file = "MarkupSafe-2.1.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b076b6226fb84157e3f7c971a47ff3a679d837cf338547532ab866c57930dbee"}, + {file = "MarkupSafe-2.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bfce63a9e7834b12b87c64d6b155fdd9b3b96191b6bd334bf37db7ff1fe457f2"}, + {file = "MarkupSafe-2.1.3-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:338ae27d6b8745585f87218a3f23f1512dbf52c26c28e322dbe54bcede54ccb9"}, + {file = "MarkupSafe-2.1.3-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:e4dd52d80b8c83fdce44e12478ad2e85c64ea965e75d66dbeafb0a3e77308fcc"}, + {file = "MarkupSafe-2.1.3-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:df0be2b576a7abbf737b1575f048c23fb1d769f267ec4358296f31c2479db8f9"}, + {file = "MarkupSafe-2.1.3-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:5bbe06f8eeafd38e5d0a4894ffec89378b6c6a625ff57e3028921f8ff59318ac"}, + {file = "MarkupSafe-2.1.3-cp311-cp311-win32.whl", hash = "sha256:dd15ff04ffd7e05ffcb7fe79f1b98041b8ea30ae9234aed2a9168b5797c3effb"}, + {file = "MarkupSafe-2.1.3-cp311-cp311-win_amd64.whl", hash = "sha256:134da1eca9ec0ae528110ccc9e48041e0828d79f24121a1a146161103c76e686"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:f698de3fd0c4e6972b92290a45bd9b1536bffe8c6759c62471efaa8acb4c37bc"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:aa57bd9cf8ae831a362185ee444e15a93ecb2e344c8e52e4d721ea3ab6ef1823"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ffcc3f7c66b5f5b7931a5aa68fc9cecc51e685ef90282f4a82f0f5e9b704ad11"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:47d4f1c5f80fc62fdd7777d0d40a2e9dda0a05883ab11374334f6c4de38adffd"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1f67c7038d560d92149c060157d623c542173016c4babc0c1913cca0564b9939"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:9aad3c1755095ce347e26488214ef77e0485a3c34a50c5a5e2471dff60b9dd9c"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:14ff806850827afd6b07a5f32bd917fb7f45b046ba40c57abdb636674a8b559c"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8f9293864fe09b8149f0cc42ce56e3f0e54de883a9de90cd427f191c346eb2e1"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-win32.whl", hash = "sha256:715d3562f79d540f251b99ebd6d8baa547118974341db04f5ad06d5ea3eb8007"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-win_amd64.whl", hash = "sha256:1b8dd8c3fd14349433c79fa8abeb573a55fc0fdd769133baac1f5e07abf54aeb"}, + {file = "MarkupSafe-2.1.3-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:8e254ae696c88d98da6555f5ace2279cf7cd5b3f52be2b5cf97feafe883b58d2"}, + {file = "MarkupSafe-2.1.3-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cb0932dc158471523c9637e807d9bfb93e06a95cbf010f1a38b98623b929ef2b"}, + {file = "MarkupSafe-2.1.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9402b03f1a1b4dc4c19845e5c749e3ab82d5078d16a2a4c2cd2df62d57bb0707"}, + {file = "MarkupSafe-2.1.3-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ca379055a47383d02a5400cb0d110cef0a776fc644cda797db0c5696cfd7e18e"}, + {file = "MarkupSafe-2.1.3-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:b7ff0f54cb4ff66dd38bebd335a38e2c22c41a8ee45aa608efc890ac3e3931bc"}, + {file = "MarkupSafe-2.1.3-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:c011a4149cfbcf9f03994ec2edffcb8b1dc2d2aede7ca243746df97a5d41ce48"}, + {file = "MarkupSafe-2.1.3-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:56d9f2ecac662ca1611d183feb03a3fa4406469dafe241673d521dd5ae92a155"}, + {file = "MarkupSafe-2.1.3-cp37-cp37m-win32.whl", hash = "sha256:8758846a7e80910096950b67071243da3e5a20ed2546e6392603c096778d48e0"}, + {file = "MarkupSafe-2.1.3-cp37-cp37m-win_amd64.whl", hash = "sha256:787003c0ddb00500e49a10f2844fac87aa6ce977b90b0feaaf9de23c22508b24"}, + {file = "MarkupSafe-2.1.3-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:2ef12179d3a291be237280175b542c07a36e7f60718296278d8593d21ca937d4"}, + {file = "MarkupSafe-2.1.3-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:2c1b19b3aaacc6e57b7e25710ff571c24d6c3613a45e905b1fde04d691b98ee0"}, + {file = "MarkupSafe-2.1.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8afafd99945ead6e075b973fefa56379c5b5c53fd8937dad92c662da5d8fd5ee"}, + {file = "MarkupSafe-2.1.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8c41976a29d078bb235fea9b2ecd3da465df42a562910f9022f1a03107bd02be"}, + {file = "MarkupSafe-2.1.3-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d080e0a5eb2529460b30190fcfcc4199bd7f827663f858a226a81bc27beaa97e"}, + {file = "MarkupSafe-2.1.3-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:69c0f17e9f5a7afdf2cc9fb2d1ce6aabdb3bafb7f38017c0b77862bcec2bbad8"}, + {file = "MarkupSafe-2.1.3-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:504b320cd4b7eff6f968eddf81127112db685e81f7e36e75f9f84f0df46041c3"}, + {file = "MarkupSafe-2.1.3-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:42de32b22b6b804f42c5d98be4f7e5e977ecdd9ee9b660fda1a3edf03b11792d"}, + {file = "MarkupSafe-2.1.3-cp38-cp38-win32.whl", hash = "sha256:ceb01949af7121f9fc39f7d27f91be8546f3fb112c608bc4029aef0bab86a2a5"}, + {file = "MarkupSafe-2.1.3-cp38-cp38-win_amd64.whl", hash = "sha256:1b40069d487e7edb2676d3fbdb2b0829ffa2cd63a2ec26c4938b2d34391b4ecc"}, + {file = "MarkupSafe-2.1.3-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:8023faf4e01efadfa183e863fefde0046de576c6f14659e8782065bcece22198"}, + {file = "MarkupSafe-2.1.3-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:6b2b56950d93e41f33b4223ead100ea0fe11f8e6ee5f641eb753ce4b77a7042b"}, + {file = "MarkupSafe-2.1.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9dcdfd0eaf283af041973bff14a2e143b8bd64e069f4c383416ecd79a81aab58"}, + {file = "MarkupSafe-2.1.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:05fb21170423db021895e1ea1e1f3ab3adb85d1c2333cbc2310f2a26bc77272e"}, + {file = "MarkupSafe-2.1.3-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:282c2cb35b5b673bbcadb33a585408104df04f14b2d9b01d4c345a3b92861c2c"}, + {file = "MarkupSafe-2.1.3-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:ab4a0df41e7c16a1392727727e7998a467472d0ad65f3ad5e6e765015df08636"}, + {file = "MarkupSafe-2.1.3-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:7ef3cb2ebbf91e330e3bb937efada0edd9003683db6b57bb108c4001f37a02ea"}, + {file = "MarkupSafe-2.1.3-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:0a4e4a1aff6c7ac4cd55792abf96c915634c2b97e3cc1c7129578aa68ebd754e"}, + {file = "MarkupSafe-2.1.3-cp39-cp39-win32.whl", hash = "sha256:fec21693218efe39aa7f8599346e90c705afa52c5b31ae019b2e57e8f6542bb2"}, + {file = "MarkupSafe-2.1.3-cp39-cp39-win_amd64.whl", hash = "sha256:3fd4abcb888d15a94f32b75d8fd18ee162ca0c064f35b11134be77050296d6ba"}, + {file = "MarkupSafe-2.1.3.tar.gz", hash = "sha256:af598ed32d6ae86f1b747b82783958b1a4ab8f617b06fe68795c7f026abbdcad"}, +] + +[[package]] +name = "maturin" +version = "1.3.1" +description = "Build and publish crates with pyo3, rust-cpython and cffi bindings as well as rust binaries as python packages" +optional = false +python-versions = ">=3.7" +files = [ + {file = "maturin-1.3.1-py3-none-linux_armv6l.whl", hash = "sha256:925f8324d9bbe8fad90b73ebc6c7f6f594645e7f13af50bded72606b6c233208"}, + {file = "maturin-1.3.1-py3-none-macosx_10_7_x86_64.whl", hash = "sha256:f3c2c694b76e63e78c353e4a2a74f8baff5ac6becf807f23435d28e47a567d63"}, + {file = "maturin-1.3.1-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:13188296f389d05043b8bd2265df66692490b61ba219ae7d5abc09e81e5659ce"}, + {file = "maturin-1.3.1-py3-none-manylinux_2_12_i686.manylinux2010_i686.musllinux_1_1_i686.whl", hash = "sha256:11bbf9978695ac066729af08bc24123317ca3fad51757b0fbdfe811212896714"}, + {file = "maturin-1.3.1-py3-none-manylinux_2_12_x86_64.manylinux2010_x86_64.musllinux_1_1_x86_64.whl", hash = "sha256:d566d2f424fa3f5cd6bd3033fd300b80654884abd061bd53c68f4717753e7d58"}, + {file = "maturin-1.3.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_1_aarch64.whl", hash = "sha256:c0e2b8171f1a70270b86ed72397ba548e3bf4d914f24cd50a228ed85a9d5e914"}, + {file = "maturin-1.3.1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.musllinux_1_1_armv7l.whl", hash = "sha256:804c6706588a9ca78f18f1a10adf9d24099b9cd3c2917628063ba8d4418b8a50"}, + {file = "maturin-1.3.1-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.musllinux_1_1_ppc64le.whl", hash = "sha256:c533d02563bb185125488cdcf161cc6ba2cdd4812ebff1b6504d1b29880ba1f8"}, + {file = "maturin-1.3.1-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:066b0c515505d4a4c526a9afc26fad4f010972d60937530dc4949dda0f49aa61"}, + {file = "maturin-1.3.1-py3-none-win32.whl", hash = "sha256:4835c332e3b632547db12e6a70abc18cb90ba9df06200dd9a7cc73424919901d"}, + {file = "maturin-1.3.1-py3-none-win_amd64.whl", hash = "sha256:871268417d6b3e2b46018c54a0522efc018bc4918b885d005df90b338e0674c7"}, + {file = "maturin-1.3.1-py3-none-win_arm64.whl", hash = "sha256:659a601c27984a50350f792447ff65ec60309423747f5304c98cb7b7fbb63d39"}, + {file = "maturin-1.3.1.tar.gz", hash = "sha256:efa194e99ae5fff185263d8244acacb12ae256ea73aba62c9446f6075ffc7ac1"}, +] + +[package.dependencies] +tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} + +[package.extras] +patchelf = ["patchelf"] +zig = ["ziglang (>=0.10.0,<0.11.0)"] + +[[package]] +name = "mpmath" +version = "1.3.0" +description = "Python library for arbitrary-precision floating-point arithmetic" +optional = false +python-versions = "*" +files = [ + {file = "mpmath-1.3.0-py3-none-any.whl", hash = "sha256:a0b2b9fe80bbcd81a6647ff13108738cfb482d481d826cc0e02f5b35e5c88d2c"}, + {file = "mpmath-1.3.0.tar.gz", hash = "sha256:7a28eb2a9774d00c7bc92411c19a89209d5da7c4c9a9e227be8330a23a25b91f"}, +] + +[package.extras] +develop = ["codecov", "pycodestyle", "pytest (>=4.6)", "pytest-cov", "wheel"] +docs = ["sphinx"] +gmpy = ["gmpy2 (>=2.1.0a4)"] +tests = ["pytest (>=4.6)"] + +[[package]] +name = "networkx" +version = "3.2.1" +description = "Python package for creating and manipulating graphs and networks" +optional = false +python-versions = ">=3.9" +files = [ + {file = "networkx-3.2.1-py3-none-any.whl", hash = "sha256:f18c69adc97877c42332c170849c96cefa91881c99a7cb3e95b7c659ebdc1ec2"}, + {file = "networkx-3.2.1.tar.gz", hash = "sha256:9f1bb5cf3409bf324e0a722c20bdb4c20ee39bf1c30ce8ae499c8502b0b5e0c6"}, +] + +[package.extras] +default = ["matplotlib (>=3.5)", "numpy (>=1.22)", "pandas (>=1.4)", "scipy (>=1.9,!=1.11.0,!=1.11.1)"] +developer = ["changelist (==0.4)", "mypy (>=1.1)", "pre-commit (>=3.2)", "rtoml"] +doc = ["nb2plots (>=0.7)", "nbconvert (<7.9)", "numpydoc (>=1.6)", "pillow (>=9.4)", "pydata-sphinx-theme (>=0.14)", "sphinx (>=7)", "sphinx-gallery (>=0.14)", "texext (>=0.6.7)"] +extra = ["lxml (>=4.6)", "pydot (>=1.4.2)", "pygraphviz (>=1.11)", "sympy (>=1.10)"] +test = ["pytest (>=7.2)", "pytest-cov (>=4.0)"] + +[[package]] +name = "numpy" +version = "1.26.1" +description = "Fundamental package for array computing in Python" +optional = false +python-versions = "<3.13,>=3.9" +files = [ + {file = "numpy-1.26.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:82e871307a6331b5f09efda3c22e03c095d957f04bf6bc1804f30048d0e5e7af"}, + {file = "numpy-1.26.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:cdd9ec98f0063d93baeb01aad472a1a0840dee302842a2746a7a8e92968f9575"}, + {file = "numpy-1.26.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d78f269e0c4fd365fc2992c00353e4530d274ba68f15e968d8bc3c69ce5f5244"}, + {file = "numpy-1.26.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8ab9163ca8aeb7fd32fe93866490654d2f7dda4e61bc6297bf72ce07fdc02f67"}, + {file = "numpy-1.26.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:78ca54b2f9daffa5f323f34cdf21e1d9779a54073f0018a3094ab907938331a2"}, + {file = "numpy-1.26.1-cp310-cp310-win32.whl", hash = "sha256:d1cfc92db6af1fd37a7bb58e55c8383b4aa1ba23d012bdbba26b4bcca45ac297"}, + {file = "numpy-1.26.1-cp310-cp310-win_amd64.whl", hash = "sha256:d2984cb6caaf05294b8466966627e80bf6c7afd273279077679cb010acb0e5ab"}, + {file = "numpy-1.26.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:cd7837b2b734ca72959a1caf3309457a318c934abef7a43a14bb984e574bbb9a"}, + {file = "numpy-1.26.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:1c59c046c31a43310ad0199d6299e59f57a289e22f0f36951ced1c9eac3665b9"}, + {file = "numpy-1.26.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d58e8c51a7cf43090d124d5073bc29ab2755822181fcad978b12e144e5e5a4b3"}, + {file = "numpy-1.26.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6081aed64714a18c72b168a9276095ef9155dd7888b9e74b5987808f0dd0a974"}, + {file = "numpy-1.26.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:97e5d6a9f0702c2863aaabf19f0d1b6c2628fbe476438ce0b5ce06e83085064c"}, + {file = "numpy-1.26.1-cp311-cp311-win32.whl", hash = "sha256:b9d45d1dbb9de84894cc50efece5b09939752a2d75aab3a8b0cef6f3a35ecd6b"}, + {file = "numpy-1.26.1-cp311-cp311-win_amd64.whl", hash = "sha256:3649d566e2fc067597125428db15d60eb42a4e0897fc48d28cb75dc2e0454e53"}, + {file = "numpy-1.26.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:1d1bd82d539607951cac963388534da3b7ea0e18b149a53cf883d8f699178c0f"}, + {file = "numpy-1.26.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:afd5ced4e5a96dac6725daeb5242a35494243f2239244fad10a90ce58b071d24"}, + {file = "numpy-1.26.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a03fb25610ef560a6201ff06df4f8105292ba56e7cdd196ea350d123fc32e24e"}, + {file = "numpy-1.26.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dcfaf015b79d1f9f9c9fd0731a907407dc3e45769262d657d754c3a028586124"}, + {file = "numpy-1.26.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:e509cbc488c735b43b5ffea175235cec24bbc57b227ef1acc691725beb230d1c"}, + {file = "numpy-1.26.1-cp312-cp312-win32.whl", hash = "sha256:af22f3d8e228d84d1c0c44c1fbdeb80f97a15a0abe4f080960393a00db733b66"}, + {file = "numpy-1.26.1-cp312-cp312-win_amd64.whl", hash = "sha256:9f42284ebf91bdf32fafac29d29d4c07e5e9d1af862ea73686581773ef9e73a7"}, + {file = "numpy-1.26.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:bb894accfd16b867d8643fc2ba6c8617c78ba2828051e9a69511644ce86ce83e"}, + {file = "numpy-1.26.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:e44ccb93f30c75dfc0c3aa3ce38f33486a75ec9abadabd4e59f114994a9c4617"}, + {file = "numpy-1.26.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9696aa2e35cc41e398a6d42d147cf326f8f9d81befcb399bc1ed7ffea339b64e"}, + {file = "numpy-1.26.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a5b411040beead47a228bde3b2241100454a6abde9df139ed087bd73fc0a4908"}, + {file = "numpy-1.26.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:1e11668d6f756ca5ef534b5be8653d16c5352cbb210a5c2a79ff288e937010d5"}, + {file = "numpy-1.26.1-cp39-cp39-win32.whl", hash = "sha256:d1d2c6b7dd618c41e202c59c1413ef9b2c8e8a15f5039e344af64195459e3104"}, + {file = "numpy-1.26.1-cp39-cp39-win_amd64.whl", hash = "sha256:59227c981d43425ca5e5c01094d59eb14e8772ce6975d4b2fc1e106a833d5ae2"}, + {file = "numpy-1.26.1-pp39-pypy39_pp73-macosx_10_9_x86_64.whl", hash = "sha256:06934e1a22c54636a059215d6da99e23286424f316fddd979f5071093b648668"}, + {file = "numpy-1.26.1-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:76ff661a867d9272cd2a99eed002470f46dbe0943a5ffd140f49be84f68ffc42"}, + {file = "numpy-1.26.1-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:6965888d65d2848e8768824ca8288db0a81263c1efccec881cb35a0d805fcd2f"}, + {file = "numpy-1.26.1.tar.gz", hash = "sha256:c8c6c72d4a9f831f328efb1312642a1cafafaa88981d9ab76368d50d07d93cbe"}, +] + +[[package]] +name = "packaging" +version = "23.2" +description = "Core utilities for Python packages" +optional = false +python-versions = ">=3.7" +files = [ + {file = "packaging-23.2-py3-none-any.whl", hash = "sha256:8c491190033a9af7e1d931d0b5dacc2ef47509b34dd0de67ed209b5203fc88c7"}, + {file = "packaging-23.2.tar.gz", hash = "sha256:048fb0e9405036518eaaf48a55953c750c11e1a1b68e0dd1a9d62ed0c092cfc5"}, +] + +[[package]] +name = "pluggy" +version = "1.3.0" +description = "plugin and hook calling mechanisms for python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pluggy-1.3.0-py3-none-any.whl", hash = "sha256:d89c696a773f8bd377d18e5ecda92b7a3793cbe66c87060a6fb58c7b6e1061f7"}, + {file = "pluggy-1.3.0.tar.gz", hash = "sha256:cf61ae8f126ac6f7c451172cf30e3e43d3ca77615509771b3a984a0730651e12"}, +] + +[package.extras] +dev = ["pre-commit", "tox"] +testing = ["pytest", "pytest-benchmark"] + +[[package]] +name = "pytest" +version = "7.4.3" +description = "pytest: simple powerful testing with Python" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pytest-7.4.3-py3-none-any.whl", hash = "sha256:0d009c083ea859a71b76adf7c1d502e4bc170b80a8ef002da5806527b9591fac"}, + {file = "pytest-7.4.3.tar.gz", hash = "sha256:d989d136982de4e3b29dabcc838ad581c64e8ed52c11fbe86ddebd9da0818cd5"}, +] + +[package.dependencies] +colorama = {version = "*", markers = "sys_platform == \"win32\""} +exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} +iniconfig = "*" +packaging = "*" +pluggy = ">=0.12,<2.0" +tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} + +[package.extras] +testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] + +[[package]] +name = "pytket" +version = "1.21.0" +description = "Python module for interfacing with the CQC tket library of quantum software" +optional = false +python-versions = ">=3.9" +files = [ + {file = "pytket-1.21.0-cp310-cp310-macosx_10_14_x86_64.whl", hash = "sha256:36b684fd48d4b142b08dc1722a5115c4f56f88951fefc84661a9370730acee68"}, + {file = "pytket-1.21.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:3987c23d8fbc5735dc57d0c19399c107ad318175e2d172f37a866be025d5fd6e"}, + {file = "pytket-1.21.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:166ace1a61c2b0f66ec6d538ac064676865ef8aa91e621f439afaa46af16cb9d"}, + {file = "pytket-1.21.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:17ccdd443bf2aee3d9eaeb1c64174acde72d430828ba09123a90ad3af458cdcf"}, + {file = "pytket-1.21.0-cp310-cp310-win_amd64.whl", hash = "sha256:b103ee6aa4dbe041edeed82b70df5e5b9ac31fdd284f06068b6bedaf52db4c9b"}, + {file = "pytket-1.21.0-cp311-cp311-macosx_10_14_x86_64.whl", hash = "sha256:6d76d01cfacfd1622685aee6d258163b5efc002ee95aa0ddf25ed7c59adcba3c"}, + {file = "pytket-1.21.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:f5fffbc51bea4655a5c8c4e9898bd6ab60eb3e2ffe017dfad0622718ab036621"}, + {file = "pytket-1.21.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d2b6d81b550c728ac2d73c1cf0adc91ef092cdf1b10aa7e5039abd94711374b3"}, + {file = "pytket-1.21.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:00ac3df11370acd0bedccb97a2260483fc99f9020fa28548ddb55bfa9c08e8ca"}, + {file = "pytket-1.21.0-cp311-cp311-win_amd64.whl", hash = "sha256:bb47cbe505b88035246bef18c571f8592c10e4582c72d9f4b67886364fb7df88"}, + {file = "pytket-1.21.0-cp39-cp39-macosx_10_14_x86_64.whl", hash = "sha256:efa05518436e091c8bd2fc5ef5ed9cea86bf0c5a793138dff2674b8fe27e37bd"}, + {file = "pytket-1.21.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:a4ce6c8a582e0d33cdd2ade1cafc94adccc27f2f60c4a495e3e7ec2a399ada1c"}, + {file = "pytket-1.21.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7ef81b83c9d1de50e3bea44a0dea136833c2fe11bcbaf282bd6dbd754cab2589"}, + {file = "pytket-1.21.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:957e8558600a801de72911183c5fd15c6154736926dfa65b51b4664416c1ee7a"}, + {file = "pytket-1.21.0-cp39-cp39-win_amd64.whl", hash = "sha256:53a4b2967d9f434fe400d8096b9eae19beb482de32f7509354116c06f904a8df"}, +] + +[package.dependencies] +graphviz = ">=0.14,<1.0" +jinja2 = ">=3.0,<4.0" +lark-parser = ">=0.7,<1.0" +networkx = ">=2.8.8" +numpy = ">=1.21.4,<2.0" +qwasm = ">=1.0,<2.0" +scipy = ">=1.7.2,<2.0" +sympy = ">=1.6,<2.0" +types-pkg-resources = "*" +typing-extensions = ">=4.2,<5.0" + +[package.extras] +zx = ["autoray (>=0.6.1)", "quimb (>=1.5,<2.0)"] + +[[package]] +name = "qwasm" +version = "1.0.1" +description = "WebAssembly decoder & disassembler" +optional = false +python-versions = "*" +files = [ + {file = "qwasm-1.0.1-py3-none-any.whl", hash = "sha256:c4c82a3f962d29314634868e06375f0cb4676c3d5266fbe137f6cd67321b0ef1"}, + {file = "qwasm-1.0.1.tar.gz", hash = "sha256:01f5dfe27159b7fdd9d02cd299833225d528fa383d1278268e5e1526357950fb"}, +] + +[package.dependencies] +setuptools = "*" + +[[package]] +name = "scipy" +version = "1.11.3" +description = "Fundamental algorithms for scientific computing in Python" +optional = false +python-versions = "<3.13,>=3.9" +files = [ + {file = "scipy-1.11.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:370f569c57e1d888304052c18e58f4a927338eafdaef78613c685ca2ea0d1fa0"}, + {file = "scipy-1.11.3-cp310-cp310-macosx_12_0_arm64.whl", hash = "sha256:9885e3e4f13b2bd44aaf2a1a6390a11add9f48d5295f7a592393ceb8991577a3"}, + {file = "scipy-1.11.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e04aa19acc324a1a076abb4035dabe9b64badb19f76ad9c798bde39d41025cdc"}, + {file = "scipy-1.11.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3e1a8a4657673bfae1e05e1e1d6e94b0cabe5ed0c7c144c8aa7b7dbb774ce5c1"}, + {file = "scipy-1.11.3-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:7abda0e62ef00cde826d441485e2e32fe737bdddee3324e35c0e01dee65e2a88"}, + {file = "scipy-1.11.3-cp310-cp310-win_amd64.whl", hash = "sha256:033c3fd95d55012dd1148b201b72ae854d5086d25e7c316ec9850de4fe776929"}, + {file = "scipy-1.11.3-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:925c6f09d0053b1c0f90b2d92d03b261e889b20d1c9b08a3a51f61afc5f58165"}, + {file = "scipy-1.11.3-cp311-cp311-macosx_12_0_arm64.whl", hash = "sha256:5664e364f90be8219283eeb844323ff8cd79d7acbd64e15eb9c46b9bc7f6a42a"}, + {file = "scipy-1.11.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:00f325434b6424952fbb636506f0567898dca7b0f7654d48f1c382ea338ce9a3"}, + {file = "scipy-1.11.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5f290cf561a4b4edfe8d1001ee4be6da60c1c4ea712985b58bf6bc62badee221"}, + {file = "scipy-1.11.3-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:91770cb3b1e81ae19463b3c235bf1e0e330767dca9eb4cd73ba3ded6c4151e4d"}, + {file = "scipy-1.11.3-cp311-cp311-win_amd64.whl", hash = "sha256:e1f97cd89c0fe1a0685f8f89d85fa305deb3067d0668151571ba50913e445820"}, + {file = "scipy-1.11.3-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:dfcc1552add7cb7c13fb70efcb2389d0624d571aaf2c80b04117e2755a0c5d15"}, + {file = "scipy-1.11.3-cp312-cp312-macosx_12_0_arm64.whl", hash = "sha256:0d3a136ae1ff0883fffbb1b05b0b2fea251cb1046a5077d0b435a1839b3e52b7"}, + {file = "scipy-1.11.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bae66a2d7d5768eaa33008fa5a974389f167183c87bf39160d3fefe6664f8ddc"}, + {file = "scipy-1.11.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d2f6dee6cbb0e263b8142ed587bc93e3ed5e777f1f75448d24fb923d9fd4dce6"}, + {file = "scipy-1.11.3-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:74e89dc5e00201e71dd94f5f382ab1c6a9f3ff806c7d24e4e90928bb1aafb280"}, + {file = "scipy-1.11.3-cp312-cp312-win_amd64.whl", hash = "sha256:90271dbde4be191522b3903fc97334e3956d7cfb9cce3f0718d0ab4fd7d8bfd6"}, + {file = "scipy-1.11.3-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:a63d1ec9cadecce838467ce0631c17c15c7197ae61e49429434ba01d618caa83"}, + {file = "scipy-1.11.3-cp39-cp39-macosx_12_0_arm64.whl", hash = "sha256:5305792c7110e32ff155aed0df46aa60a60fc6e52cd4ee02cdeb67eaccd5356e"}, + {file = "scipy-1.11.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9ea7f579182d83d00fed0e5c11a4aa5ffe01460444219dedc448a36adf0c3917"}, + {file = "scipy-1.11.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c77da50c9a91e23beb63c2a711ef9e9ca9a2060442757dffee34ea41847d8156"}, + {file = "scipy-1.11.3-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:15f237e890c24aef6891c7d008f9ff7e758c6ef39a2b5df264650eb7900403c0"}, + {file = "scipy-1.11.3-cp39-cp39-win_amd64.whl", hash = "sha256:4b4bb134c7aa457e26cc6ea482b016fef45db71417d55cc6d8f43d799cdf9ef2"}, + {file = "scipy-1.11.3.tar.gz", hash = "sha256:bba4d955f54edd61899776bad459bf7326e14b9fa1c552181f0479cc60a568cd"}, +] + +[package.dependencies] +numpy = ">=1.21.6,<1.28.0" + +[package.extras] +dev = ["click", "cython-lint (>=0.12.2)", "doit (>=0.36.0)", "mypy", "pycodestyle", "pydevtool", "rich-click", "ruff", "types-psutil", "typing_extensions"] +doc = ["jupytext", "matplotlib (>2)", "myst-nb", "numpydoc", "pooch", "pydata-sphinx-theme (==0.9.0)", "sphinx (!=4.1.0)", "sphinx-design (>=0.2.0)"] +test = ["asv", "gmpy2", "mpmath", "pooch", "pytest", "pytest-cov", "pytest-timeout", "pytest-xdist", "scikit-umfpack", "threadpoolctl"] + +[[package]] +name = "setuptools" +version = "68.2.2" +description = "Easily download, build, install, upgrade, and uninstall Python packages" +optional = false +python-versions = ">=3.8" +files = [ + {file = "setuptools-68.2.2-py3-none-any.whl", hash = "sha256:b454a35605876da60632df1a60f736524eb73cc47bbc9f3f1ef1b644de74fd2a"}, + {file = "setuptools-68.2.2.tar.gz", hash = "sha256:4ac1475276d2f1c48684874089fefcd83bd7162ddaafb81fac866ba0db282a87"}, +] + +[package.extras] +docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-hoverxref (<2)", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (>=1,<2)", "sphinx-reredirects", "sphinxcontrib-towncrier"] +testing = ["build[virtualenv]", "filelock (>=3.4.0)", "flake8-2020", "ini2toml[lite] (>=0.9)", "jaraco.develop (>=7.21)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pip (>=19.1)", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-mypy (>=0.9.1)", "pytest-perf", "pytest-ruff", "pytest-timeout", "pytest-xdist", "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.1)", "pytest", "pytest-enabler", "pytest-xdist", "tomli", "virtualenv (>=13.0.0)", "wheel"] + +[[package]] +name = "sympy" +version = "1.12" +description = "Computer algebra system (CAS) in Python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "sympy-1.12-py3-none-any.whl", hash = "sha256:c3588cd4295d0c0f603d0f2ae780587e64e2efeedb3521e46b9bb1d08d184fa5"}, + {file = "sympy-1.12.tar.gz", hash = "sha256:ebf595c8dac3e0fdc4152c51878b498396ec7f30e7a914d6071e674d49420fb8"}, +] + +[package.dependencies] +mpmath = ">=0.19" + +[[package]] +name = "tomli" +version = "2.0.1" +description = "A lil' TOML parser" +optional = false +python-versions = ">=3.7" +files = [ + {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, + {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, +] + +[[package]] +name = "types-pkg-resources" +version = "0.1.3" +description = "Typing stubs for pkg_resources" +optional = false +python-versions = "*" +files = [ + {file = "types-pkg_resources-0.1.3.tar.gz", hash = "sha256:834a9b8d3dbea343562fd99d5d3359a726f6bf9d3733bccd2b4f3096fbab9dae"}, + {file = "types_pkg_resources-0.1.3-py2.py3-none-any.whl", hash = "sha256:0cb9972cee992249f93fff1a491bf2dc3ce674e5a1926e27d4f0866f7d9b6d9c"}, +] + +[[package]] +name = "typing-extensions" +version = "4.8.0" +description = "Backported and Experimental Type Hints for Python 3.8+" +optional = false +python-versions = ">=3.8" +files = [ + {file = "typing_extensions-4.8.0-py3-none-any.whl", hash = "sha256:8f92fc8806f9a6b641eaa5318da32b44d401efaac0f6678c9bc448ba3605faa0"}, + {file = "typing_extensions-4.8.0.tar.gz", hash = "sha256:df8e4339e9cb77357558cbdbceca33c303714cf861d1eef15e1070055ae8b7ef"}, +] + +[metadata] +lock-version = "2.0" +python-versions = "^3.10,<3.12" +content-hash = "a0758aed63a08f8e0dda701bf8b583f00288fc07bb3f7e7dee5d21abf521a67c" diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..9772c101 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,45 @@ +[tool.poetry] +name = "pytket-tk2" +version = "0.1.0" +description = "pytket extension for the tket 2 compiler" +classifiers = [] # TODO +authors = [] # TODO +maintainers = [] # TODO +include = ["pyproject.toml"] +license = "Apache-2.0" +readme = "README.md" + +packages = [{ include = "pytket-tk2" }] + +[tool.poetry.dependencies] +python = "^3.10,<3.12" + +[tool.poetry.dev-dependencies] +maturin = "^1.3.0" +pytket = "*" +pytest = "^7.1.2" +ruff = "^0.1.3" + +[build-system] +requires = ["maturin~=1.3"] +build-backend = "maturin" + +[project] +name = "pytket_tk2" +version = "0.1.0" +description = "pytket extension for the tket 2 compiler" +authors = [] # TODO +classifiers = [] # TODO +requires-python = ">=3.10" +license = "Apache-2.0" + +[project.urls] +homepage = "https://github.com/CQCL/tket2" +repository = "https://github.com/CQCL/tket2" + +[tool.maturin] +python-source = "pytket-tk2" + +[tool.pytest.ini_options] +# Lark throws deprecation warnings for `src_parse` and `src_constants`. +filterwarnings = "ignore::DeprecationWarning:lark.*" diff --git a/pyrs/pyproject.toml b/pyrs/pyproject.toml deleted file mode 100644 index 019c5658..00000000 --- a/pyrs/pyproject.toml +++ /dev/null @@ -1,13 +0,0 @@ -[build-system] -requires = ["maturin~=1.3"] -build-backend = "maturin" - -[project] -name = "pyrs" -requires-python = ">=3.6" -classifiers = [ - "Programming Language :: Rust", - "Programming Language :: Python :: Implementation :: CPython", - "Programming Language :: Python :: Implementation :: PyPy", -] -dependencies = ["pytket~=1.0", "pytest~=7.1"] diff --git a/pyrs/pyrs/__init__.py b/pyrs/pyrs/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pyrs/requirements.txt b/pyrs/requirements.txt deleted file mode 100644 index e854c1b6..00000000 --- a/pyrs/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -# pyrs dependencies \ No newline at end of file diff --git a/pyrs/.gitignore b/pytket-tk2/.gitignore similarity index 100% rename from pyrs/.gitignore rename to pytket-tk2/.gitignore diff --git a/pyrs/Cargo.toml b/pytket-tk2/Cargo.toml similarity index 94% rename from pyrs/Cargo.toml rename to pytket-tk2/Cargo.toml index 49a8e3de..9a5d45a7 100644 --- a/pyrs/Cargo.toml +++ b/pytket-tk2/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "pyrs" +name = "pytket-tk2" edition = { workspace = true } version = { workspace = true } rust-version = { workspace = true } @@ -8,7 +8,7 @@ license-file = { workspace = true } # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [lib] -name = "pyrs" +name = "pytket_tk2" crate-type = ["cdylib"] [dependencies] diff --git a/pyrs/README.md b/pytket-tk2/README.md similarity index 90% rename from pyrs/README.md rename to pytket-tk2/README.md index 620dff0a..da6ed2da 100644 --- a/pyrs/README.md +++ b/pytket-tk2/README.md @@ -1,8 +1,8 @@ -## pyrs +## pytket-tk2 This package uses [pyo3](https://pyo3.rs/v0.16.4/) and [maturin](https://github.com/PyO3/maturin) to bind TKET2 functionality to -python as the `pyrs` package. +python as the `pytket_tk2` package. Recommended: diff --git a/pyrs/dev-requirements.txt b/pytket-tk2/dev-requirements.txt similarity index 100% rename from pyrs/dev-requirements.txt rename to pytket-tk2/dev-requirements.txt diff --git a/pytket-tk2/pyproject.toml b/pytket-tk2/pyproject.toml new file mode 100644 index 00000000..ef7208bd --- /dev/null +++ b/pytket-tk2/pyproject.toml @@ -0,0 +1,12 @@ +[build-system] +requires = ["maturin~=1.3"] +build-backend = "maturin" + +[project] +name = "pytket_tk2" +version = "0.1.0" +description = "pytket extension for the tket 2 compiler" +authors = [] # TODO +classifiers = [] # TODO +requires-python = ">=3.10" +license = "Apache-2.0" diff --git a/pytket-tk2/pytket_tk2/__init__.py b/pytket-tk2/pytket_tk2/__init__.py new file mode 100644 index 00000000..47d28f97 --- /dev/null +++ b/pytket-tk2/pytket_tk2/__init__.py @@ -0,0 +1,5 @@ +from .pytket_tk2 import * + +__doc__ = pytket_tk2.__doc__ +if hasattr(pytket_tk2, "__all__"): + __all__ = pytket_tk2.__all__ diff --git a/pyrs/pyrs/custom_base.py b/pytket-tk2/pytket_tk2/custom_base.py similarity index 82% rename from pyrs/pyrs/custom_base.py rename to pytket-tk2/pytket_tk2/custom_base.py index 894eec87..84516e9c 100644 --- a/pyrs/pyrs/custom_base.py +++ b/pytket-tk2/pytket_tk2/custom_base.py @@ -1,5 +1,5 @@ # from abc import ABC, abstractmethod -# from pyrs.pyrs import RsCircuit, Signature +# from pytket_tk2 import RsCircuit, Signature # class CustomOpBase(ABC): diff --git a/pyrs/pyrs/data/nam_6_3.rwr b/pytket-tk2/pytket_tk2/data/nam_6_3.rwr similarity index 100% rename from pyrs/pyrs/data/nam_6_3.rwr rename to pytket-tk2/pytket_tk2/data/nam_6_3.rwr diff --git a/pyrs/pyrs/passes.py b/pytket-tk2/pytket_tk2/passes.py similarity index 86% rename from pyrs/pyrs/passes.py rename to pytket-tk2/pytket_tk2/passes.py index 05b6c89f..06f0dac8 100644 --- a/pyrs/pyrs/passes.py +++ b/pytket-tk2/pytket_tk2/passes.py @@ -1,10 +1,10 @@ from pathlib import Path from typing import Optional -import pkg_resources +import importlib from pytket import Circuit from pytket.passes import CustomPass -from pyrs.pyrs import passes, optimiser +from pytket_tk2 import passes, optimiser def taso_pass( @@ -23,7 +23,9 @@ def taso_pass( The arguments `max_threads`, `timeout`, `log_dir` and `rebase` are optional and will be passed on to the TASO optimiser if provided.""" if rewriter is None: - rewriter = pkg_resources.resource_filename("pyrs", "data/nam_6_3.rwr") + rewriter = Path( + importlib.resources.files("pytket_tk2").joinpath("data/nam_6_3.rwr") + ) opt = optimiser.TasoOptimiser.load_precompiled(rewriter) def apply(circuit: Circuit) -> Circuit: diff --git a/pytket-tk2/requirements.txt b/pytket-tk2/requirements.txt new file mode 100644 index 00000000..1ab89afc --- /dev/null +++ b/pytket-tk2/requirements.txt @@ -0,0 +1 @@ +# pytket-tk2 dependencies \ No newline at end of file diff --git a/pyrs/src/circuit.rs b/pytket-tk2/src/circuit.rs similarity index 100% rename from pyrs/src/circuit.rs rename to pytket-tk2/src/circuit.rs diff --git a/pyrs/src/lib.rs b/pytket-tk2/src/lib.rs similarity index 97% rename from pyrs/src/lib.rs rename to pytket-tk2/src/lib.rs index 36ac11b3..7f9b909e 100644 --- a/pyrs/src/lib.rs +++ b/pytket-tk2/src/lib.rs @@ -66,7 +66,7 @@ impl RuleMatcher { /// The Python bindings to TKET2. #[pymodule] -fn pyrs(py: Python, m: &PyModule) -> PyResult<()> { +fn pytket_tk2(py: Python, m: &PyModule) -> PyResult<()> { add_circuit_module(py, m)?; add_pattern_module(py, m)?; add_pass_module(py, m)?; diff --git a/pyrs/src/optimiser.rs b/pytket-tk2/src/optimiser.rs similarity index 100% rename from pyrs/src/optimiser.rs rename to pytket-tk2/src/optimiser.rs diff --git a/pyrs/src/pass.rs b/pytket-tk2/src/pass.rs similarity index 100% rename from pyrs/src/pass.rs rename to pytket-tk2/src/pass.rs diff --git a/pyrs/test/test_bindings.py b/pytket-tk2/test/test_bindings.py similarity index 98% rename from pyrs/test/test_bindings.py rename to pytket-tk2/test/test_bindings.py index 0a1c66fb..47ffaab8 100644 --- a/pyrs/test/test_bindings.py +++ b/pytket-tk2/test/test_bindings.py @@ -1,5 +1,5 @@ from dataclasses import dataclass -from pyrs.pyrs import passes, circuit, pattern +from pytket_tk2 import passes, circuit, pattern from pytket.circuit import Circuit @@ -77,7 +77,7 @@ def test_multiple_rules(): # from functools import wraps # import pytest -# from pyrs.pyrs import ( +# from pytket_tk2 import ( # RsCircuit, # WireType, # RsOpType, @@ -96,7 +96,7 @@ def test_multiple_rules(): # decompose_custom_pass, # count_pycustom, # ) -# from pyrs.custom_base import CustomOpBase +# from pytket_tk2.custom_base import CustomOpBase # from pytket import Circuit, OpType, Qubit diff --git a/pyrs/test/test_optimiser.py b/pytket-tk2/test/test_optimiser.py similarity index 51% rename from pyrs/test/test_optimiser.py rename to pytket-tk2/test/test_optimiser.py index de213d82..4bb2ecf2 100644 --- a/pyrs/test/test_optimiser.py +++ b/pytket-tk2/test/test_optimiser.py @@ -1,14 +1,14 @@ from pytket import Circuit -from pyrs.pyrs import optimiser +from pytket_tk2 import optimiser def test_simple_optimiser(): - """ a simple circuit matching test """ + """a simple circuit matching test""" c = Circuit(3).CX(0, 1).CX(0, 1).CX(1, 2) - opt = optimiser.TasoOptimiser.compile_eccs("../test_files/cx_cx_eccs.json") + opt = optimiser.TasoOptimiser.compile_eccs("test_files/cx_cx_eccs.json") # optimise for 1s cc = opt.optimise(c, 3) exp_c = Circuit(3).CX(1, 2) - assert cc == exp_c \ No newline at end of file + assert cc == exp_c diff --git a/pyrs/test/test_pass.py b/pytket-tk2/test/test_pass.py similarity index 65% rename from pyrs/test/test_pass.py rename to pytket-tk2/test/test_pass.py index 3ad701d8..a26d2cab 100644 --- a/pyrs/test/test_pass.py +++ b/pytket-tk2/test/test_pass.py @@ -1,9 +1,9 @@ from pytket import Circuit, OpType -from pyrs.passes import taso_pass +from pytket_tk2.passes import taso_pass def test_simple_taso_pass_no_opt(): c = Circuit(3).CCX(0, 1, 2) - taso = taso_pass(max_threads = 1, timeout = 0) + taso = taso_pass(max_threads=1, timeout=0) taso.apply(c) assert c.n_gates_of_type(OpType.CX) == 6 diff --git a/pyrs/test/test_portmatching.py b/pytket-tk2/test/test_portmatching.py similarity index 79% rename from pyrs/test/test_portmatching.py rename to pytket-tk2/test/test_portmatching.py index 2f4828bf..8449aa31 100644 --- a/pyrs/test/test_portmatching.py +++ b/pytket-tk2/test/test_portmatching.py @@ -1,10 +1,10 @@ from pytket import Circuit from pytket.qasm import circuit_from_qasm -from pyrs.pyrs import pattern +from pytket_tk2 import pattern def test_simple_matching(): - """ a simple circuit matching test """ + """a simple circuit matching test""" c = Circuit(2).CX(0, 1).H(1).CX(0, 1) p1 = pattern.CircuitPattern(Circuit(2).CX(0, 1).H(1)) @@ -16,7 +16,7 @@ def test_simple_matching(): def test_non_convex_pattern(): - """ two-qubit circuits can't match three-qb ones """ + """two-qubit circuits can't match three-qb ones""" p1 = pattern.CircuitPattern(Circuit(3).CX(0, 1).CX(1, 2)) matcher = pattern.PatternMatcher(iter([p1])) @@ -31,8 +31,8 @@ def test_non_convex_pattern(): def test_larger_matching(): - """ a larger crafted circuit with matches WIP """ - c = circuit_from_qasm("test/test_files/circ.qasm") + """a larger crafted circuit with matches WIP""" + c = circuit_from_qasm("test_files/simple.qasm") p1 = pattern.CircuitPattern(Circuit(2).CX(0, 1).H(1)) p2 = pattern.CircuitPattern(Circuit(2).H(0).CX(1, 0)) @@ -41,4 +41,4 @@ def test_larger_matching(): matcher = pattern.PatternMatcher(iter([p1, p2, p3, p4])) - assert len(matcher.find_matches(c)) == 6 \ No newline at end of file + assert len(matcher.find_matches(c)) == 6 diff --git a/pyrs/test/test_files/circ.qasm b/test_files/simple.qasm similarity index 100% rename from pyrs/test/test_files/circ.qasm rename to test_files/simple.qasm diff --git a/tket2/src/json.rs b/tket2/src/json.rs index 21590610..72e01ef7 100644 --- a/tket2/src/json.rs +++ b/tket2/src/json.rs @@ -106,7 +106,7 @@ pub enum OpConvertError { #[cfg(feature = "pyo3")] create_exception!( - pyrs, + pytket_tk2, PyOpConvertError, PyException, "Error type for conversion between tket2's `Op` and `OpType`" diff --git a/tket2/src/passes/commutation.rs b/tket2/src/passes/commutation.rs index bbca13ff..6c9cbaf6 100644 --- a/tket2/src/passes/commutation.rs +++ b/tket2/src/passes/commutation.rs @@ -204,7 +204,7 @@ pub enum PullForwardError { #[cfg(feature = "pyo3")] create_exception!( - pyrs, + pytket_tk2, PyPullForwardError, PyException, "Error in applying PullForward rewrite." diff --git a/tket2/src/portmatching/pattern.rs b/tket2/src/portmatching/pattern.rs index fce1e05e..b32e0123 100644 --- a/tket2/src/portmatching/pattern.rs +++ b/tket2/src/portmatching/pattern.rs @@ -138,7 +138,7 @@ impl From for InvalidPattern { #[cfg(feature = "pyo3")] create_exception!( - pyrs, + pytket_tk2, PyInvalidPatternError, PyException, "Invalid circuit pattern" From eee99cb875dab4c920092c94acca4ad8284540c7 Mon Sep 17 00:00:00 2001 From: Agustin Borgna Date: Thu, 2 Nov 2023 15:15:24 +0000 Subject: [PATCH 03/13] Update paths in CI --- .github/workflows/ci.yml | 26 +++++++++++++++----------- pytket-tk2/dev-requirements.txt | 2 +- pytket-tk2/pytket_tk2/__init__.py | 8 ++++---- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8cf7d526..10227d12 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,14 +29,22 @@ jobs: with: components: rustfmt, clippy - uses: mozilla-actions/sccache-action@v0.0.3 - - name: Check formatting + - name: Check rust formatting run: cargo fmt -- --check + - name: Check python formatting + uses: chartboost/ruff-action@v1 + with: + args: format --check - name: Run clippy run: cargo clippy --all-targets --all-features --workspace -- -D warnings - name: Build docs run: cargo doc --no-deps --all-features env: RUSTDOCFLAGS: "-Dwarnings" + - name: Python lints + uses: chartboost/ruff-action@v1 + with: + args: check benches: # Not required, we can ignore it for the merge queue check. @@ -102,12 +110,11 @@ jobs: - name: Build pyo3 bindings run: | pip install -r requirements.txt - cd pyrs - maturin build - pip install ../target/wheels/*.whl + maturin build -m pytket-tk2/Cargo.toml + pip install target/wheels/*.whl - name: Test pyo3 bindings run: | - cd pyrs + pip install pytest -r pytket-tk2/dev-requirements.txt pytest coverage: @@ -151,13 +158,10 @@ jobs: run: | pip install -r requirements.txt pip install pytest-cov - cd pyrs - maturin build - pip install ../target/wheels/*.whl + maturin build -m pytket-tk2/Cargo.toml + pip install target/wheels/*.whl - name: Run python tests with coverage instrumentation - run: | - cd pyrs - pytest --cov=./ --cov-report=xml + run: pytest --cov=./ --cov-report=xml - name: Upload python coverage to codecov.io uses: codecov/codecov-action@v3 with: diff --git a/pytket-tk2/dev-requirements.txt b/pytket-tk2/dev-requirements.txt index 2406e2fe..9768808e 100644 --- a/pytket-tk2/dev-requirements.txt +++ b/pytket-tk2/dev-requirements.txt @@ -3,7 +3,7 @@ # Development requirements maturin # Build wheels -black # Code formatting +ruff # Code formatting pytket # TKET1 jupyterlab # For running the examples graphviz # Visualisation of Hugrs in the notebooks \ No newline at end of file diff --git a/pytket-tk2/pytket_tk2/__init__.py b/pytket-tk2/pytket_tk2/__init__.py index 47d28f97..afab926b 100644 --- a/pytket-tk2/pytket_tk2/__init__.py +++ b/pytket-tk2/pytket_tk2/__init__.py @@ -1,5 +1,5 @@ -from .pytket_tk2 import * +from .pytket_tk2 import * # noqa: F403,F405 -__doc__ = pytket_tk2.__doc__ -if hasattr(pytket_tk2, "__all__"): - __all__ = pytket_tk2.__all__ +__doc__ = pytket_tk2.__doc__ # noqa: F405 +if hasattr(pytket_tk2, "__all__"): # noqa: F405 + __all__ = pytket_tk2.__all__ # noqa: F405 From 68b380a14ed4b9cb4816099bbd4c92a5dad19bca Mon Sep 17 00:00:00 2001 From: Agustin Borgna Date: Thu, 2 Nov 2023 15:51:51 +0000 Subject: [PATCH 04/13] refactor: Move tket2 code to a workspace member --- Cargo.toml | 78 +++---------------- compile-rewriter/Cargo.toml | 9 ++- pyrs/Cargo.toml | 2 +- taso-optimiser/Cargo.toml | 9 ++- tket2/Cargo.toml | 68 ++++++++++++++++ {benches => tket2/benches}/bench_main.rs | 0 .../benches}/benchmarks/generators.rs | 0 {benches => tket2/benches}/benchmarks/hash.rs | 0 {benches => tket2/benches}/benchmarks/mod.rs | 0 {src => tket2/src}/circuit.rs | 0 {src => tket2/src}/circuit/command.rs | 0 {src => tket2/src}/circuit/cost.rs | 0 {src => tket2/src}/circuit/hash.rs | 0 {src => tket2/src}/circuit/units.rs | 0 {src => tket2/src}/circuit/units/filter.rs | 0 {src => tket2/src}/extension.rs | 0 {src => tket2/src}/json.rs | 2 +- {src => tket2/src}/json/decoder.rs | 0 {src => tket2/src}/json/encoder.rs | 0 {src => tket2/src}/json/op.rs | 0 {src => tket2/src}/json/tests.rs | 2 +- {src => tket2/src}/lib.rs | 0 {src => tket2/src}/ops.rs | 0 {src => tket2/src}/optimiser.rs | 0 {src => tket2/src}/optimiser/taso.rs | 2 +- .../src}/optimiser/taso/eq_circ_class.rs | 0 .../src}/optimiser/taso/hugr_pchannel.rs | 0 .../src}/optimiser/taso/hugr_pqueue.rs | 0 {src => tket2/src}/optimiser/taso/log.rs | 0 .../src}/optimiser/taso/qtz_circuit.rs | 4 +- {src => tket2/src}/optimiser/taso/worker.rs | 0 {src => tket2/src}/passes.rs | 0 {src => tket2/src}/passes/_classical.rs | 0 {src => tket2/src}/passes/_squash.rs | 0 {src => tket2/src}/passes/chunks.rs | 0 {src => tket2/src}/passes/commutation.rs | 2 +- {src => tket2/src}/portmatching.rs | 0 {src => tket2/src}/portmatching/matcher.rs | 0 {src => tket2/src}/portmatching/pattern.rs | 2 +- {src => tket2/src}/portmatching/pyo3.rs | 0 {src => tket2/src}/rewrite.rs | 0 {src => tket2/src}/rewrite/ecc_rewriter.rs | 4 +- {src => tket2/src}/rewrite/strategy.rs | 0 {src => tket2/src}/utils.rs | 0 44 files changed, 101 insertions(+), 83 deletions(-) create mode 100644 tket2/Cargo.toml rename {benches => tket2/benches}/bench_main.rs (100%) rename {benches => tket2/benches}/benchmarks/generators.rs (100%) rename {benches => tket2/benches}/benchmarks/hash.rs (100%) rename {benches => tket2/benches}/benchmarks/mod.rs (100%) rename {src => tket2/src}/circuit.rs (100%) rename {src => tket2/src}/circuit/command.rs (100%) rename {src => tket2/src}/circuit/cost.rs (100%) rename {src => tket2/src}/circuit/hash.rs (100%) rename {src => tket2/src}/circuit/units.rs (100%) rename {src => tket2/src}/circuit/units/filter.rs (100%) rename {src => tket2/src}/extension.rs (100%) rename {src => tket2/src}/json.rs (99%) rename {src => tket2/src}/json/decoder.rs (100%) rename {src => tket2/src}/json/encoder.rs (100%) rename {src => tket2/src}/json/op.rs (100%) rename {src => tket2/src}/json/tests.rs (99%) rename {src => tket2/src}/lib.rs (100%) rename {src => tket2/src}/ops.rs (100%) rename {src => tket2/src}/optimiser.rs (100%) rename {src => tket2/src}/optimiser/taso.rs (99%) rename {src => tket2/src}/optimiser/taso/eq_circ_class.rs (100%) rename {src => tket2/src}/optimiser/taso/hugr_pchannel.rs (100%) rename {src => tket2/src}/optimiser/taso/hugr_pqueue.rs (100%) rename {src => tket2/src}/optimiser/taso/log.rs (100%) rename {src => tket2/src}/optimiser/taso/qtz_circuit.rs (96%) rename {src => tket2/src}/optimiser/taso/worker.rs (100%) rename {src => tket2/src}/passes.rs (100%) rename {src => tket2/src}/passes/_classical.rs (100%) rename {src => tket2/src}/passes/_squash.rs (100%) rename {src => tket2/src}/passes/chunks.rs (100%) rename {src => tket2/src}/passes/commutation.rs (99%) rename {src => tket2/src}/portmatching.rs (100%) rename {src => tket2/src}/portmatching/matcher.rs (100%) rename {src => tket2/src}/portmatching/pattern.rs (99%) rename {src => tket2/src}/portmatching/pyo3.rs (100%) rename {src => tket2/src}/rewrite.rs (100%) rename {src => tket2/src}/rewrite/ecc_rewriter.rs (99%) rename {src => tket2/src}/rewrite/strategy.rs (100%) rename {src => tket2/src}/utils.rs (100%) diff --git a/Cargo.toml b/Cargo.toml index 6bea0559..33f9c941 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,78 +1,22 @@ -[package] -name = "tket2" -version = "0.1.0" -edition = "2021" - -[lib] -bench = false -name = "tket2" -path = "src/lib.rs" - [profile.release] lto = "thin" -[dependencies] -lazy_static = "1.4.0" -cgmath = "0.18.0" -num-rational = "0.4" -num-complex = { version = "0.4", optional = true } -tket-json-rs = { workspace = true } -rayon = "1.5" -thiserror = "1.0.28" -serde = { version = "1.0", features = ["derive"] } -serde_json = "1.0" -downcast-rs = "1.2.0" -priority-queue = "1.3.0" -smol_str = "0.2.0" -typetag = "0.2.8" -itertools = { workspace = true } -petgraph = { version = "0.6.3", default-features = false } -serde_yaml = "0.9.22" -# portmatching = { version = "0.2.0", optional = true, features = ["serde"]} -portmatching = { optional = true, git = "https://github.com/lmondada/portmatching", rev = "738c91c", features = [ - "serde", -] } -derive_more = "0.99.17" -quantinuum-hugr = { workspace = true } -portgraph = { workspace = true, features = ["serde"] } -pyo3 = { workspace = true, optional = true, features = ["multiple-pymethods"] } -strum_macros = "0.25.2" -strum = "0.25.0" -fxhash = "0.2.1" -rmp-serde = { version = "1.1.2", optional = true } -delegate = "0.10.0" -csv = { version = "1.2.2" } -chrono = { version = "0.4.30" } -bytemuck = "1.14.0" -stringreader = "0.1.1" -crossbeam-channel = "0.5.8" -tracing = { workspace = true } - -[features] -pyo3 = [ - "dep:pyo3", - "tket-json-rs/pyo3", - "portgraph/pyo3", - "quantinuum-hugr/pyo3", -] -portmatching = ["dep:portmatching", "dep:rmp-serde"] - -[dev-dependencies] -rstest = "0.18.1" -criterion = { version = "0.5.1", features = ["html_reports"] } -webbrowser = "0.8.10" -urlencoding = "2.1.2" - -[[bench]] -name = "bench_main" -harness = false - [workspace] +resolver = "2" +members = ["tket2", "pyrs", "compile-rewriter", "taso-optimiser"] +default-members = ["tket2"] -members = ["pyrs", "compile-rewriter", "taso-optimiser"] +[workspace.package] +version = "0.1.0" +rust-version = "1.70" +edition = "2021" +homepage = "https://github.com/CQCL/tket2" +license-file = "LICENCE" +# authors [workspace.dependencies] +tket2 = { path = "./tket2" } quantinuum-hugr = { git = "https://github.com/CQCL-DEV/hugr", rev = "0beb165" } portgraph = { version = "0.10" } pyo3 = { version = "0.20" } diff --git a/compile-rewriter/Cargo.toml b/compile-rewriter/Cargo.toml index c7cb8b9e..513b744a 100644 --- a/compile-rewriter/Cargo.toml +++ b/compile-rewriter/Cargo.toml @@ -1,12 +1,15 @@ [package] name = "compile-matcher" -version = "0.1.0" -edition = "2021" +edition = { workspace = true } +version = { workspace = true } +rust-version = { workspace = true } +homepage = { workspace = true } +license-file = { workspace = true } # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] clap = { version = "4.4.2", features = ["derive"] } -tket2 = { path = "../", features = ["portmatching"] } +tket2 = { workspace = true, features = ["portmatching"] } quantinuum-hugr = { workspace = true } itertools = { workspace = true } diff --git a/pyrs/Cargo.toml b/pyrs/Cargo.toml index ab53c31f..89c98c06 100644 --- a/pyrs/Cargo.toml +++ b/pyrs/Cargo.toml @@ -9,7 +9,7 @@ name = "pyrs" crate-type = ["cdylib"] [dependencies] -tket2 = { path = "../", features = ["pyo3", "portmatching"] } +tket2 = { workspace = true, features = ["pyo3", "portmatching"] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" tket-json-rs = { workspace = true, features = ["pyo3"] } diff --git a/taso-optimiser/Cargo.toml b/taso-optimiser/Cargo.toml index 5d82ccb7..a8fcd5af 100644 --- a/taso-optimiser/Cargo.toml +++ b/taso-optimiser/Cargo.toml @@ -1,14 +1,17 @@ [package] name = "taso-optimiser" -version = "0.1.0" -edition = "2021" +edition = { workspace = true } +version = { workspace = true } +rust-version = { workspace = true } +homepage = { workspace = true } +license-file = { workspace = true } # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] clap = { version = "4.4.2", features = ["derive"] } serde_json = "1.0" -tket2 = { path = "../", features = ["portmatching"] } +tket2 = { workspace = true, features = ["portmatching"] } quantinuum-hugr = { workspace = true } itertools = { workspace = true } tket-json-rs = { workspace = true } diff --git a/tket2/Cargo.toml b/tket2/Cargo.toml new file mode 100644 index 00000000..94328feb --- /dev/null +++ b/tket2/Cargo.toml @@ -0,0 +1,68 @@ +[package] +name = "tket2" +edition = { workspace = true } +version = { workspace = true } +rust-version = { workspace = true } +homepage = { workspace = true } +license-file = { workspace = true } + +[lib] +bench = false +name = "tket2" +path = "src/lib.rs" + +[features] +pyo3 = [ + "dep:pyo3", + "tket-json-rs/pyo3", + "portgraph/pyo3", + "quantinuum-hugr/pyo3", +] +portmatching = ["dep:portmatching", "dep:rmp-serde"] + +[dependencies] +lazy_static = "1.4.0" +cgmath = "0.18.0" +num-rational = "0.4" +num-complex = { version = "0.4", optional = true } +tket-json-rs = { workspace = true } +rayon = "1.5" +thiserror = "1.0.28" +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" +downcast-rs = "1.2.0" +priority-queue = "1.3.0" +smol_str = "0.2.0" +typetag = "0.2.8" +itertools = { workspace = true } +petgraph = { version = "0.6.3", default-features = false } +serde_yaml = "0.9.22" +# portmatching = { version = "0.2.0", optional = true, features = ["serde"]} +portmatching = { optional = true, git = "https://github.com/lmondada/portmatching", rev = "738c91c", features = [ + "serde", +] } +derive_more = "0.99.17" +quantinuum-hugr = { workspace = true } +portgraph = { workspace = true, features = ["serde"] } +pyo3 = { workspace = true, optional = true, features = ["multiple-pymethods"] } +strum_macros = "0.25.2" +strum = "0.25.0" +fxhash = "0.2.1" +rmp-serde = { version = "1.1.2", optional = true } +delegate = "0.10.0" +csv = { version = "1.2.2" } +chrono = { version = "0.4.30" } +bytemuck = "1.14.0" +stringreader = "0.1.1" +crossbeam-channel = "0.5.8" +tracing = { workspace = true } + +[dev-dependencies] +rstest = "0.18.1" +criterion = { version = "0.5.1", features = ["html_reports"] } +webbrowser = "0.8.10" +urlencoding = "2.1.2" + +[[bench]] +name = "bench_main" +harness = false diff --git a/benches/bench_main.rs b/tket2/benches/bench_main.rs similarity index 100% rename from benches/bench_main.rs rename to tket2/benches/bench_main.rs diff --git a/benches/benchmarks/generators.rs b/tket2/benches/benchmarks/generators.rs similarity index 100% rename from benches/benchmarks/generators.rs rename to tket2/benches/benchmarks/generators.rs diff --git a/benches/benchmarks/hash.rs b/tket2/benches/benchmarks/hash.rs similarity index 100% rename from benches/benchmarks/hash.rs rename to tket2/benches/benchmarks/hash.rs diff --git a/benches/benchmarks/mod.rs b/tket2/benches/benchmarks/mod.rs similarity index 100% rename from benches/benchmarks/mod.rs rename to tket2/benches/benchmarks/mod.rs diff --git a/src/circuit.rs b/tket2/src/circuit.rs similarity index 100% rename from src/circuit.rs rename to tket2/src/circuit.rs diff --git a/src/circuit/command.rs b/tket2/src/circuit/command.rs similarity index 100% rename from src/circuit/command.rs rename to tket2/src/circuit/command.rs diff --git a/src/circuit/cost.rs b/tket2/src/circuit/cost.rs similarity index 100% rename from src/circuit/cost.rs rename to tket2/src/circuit/cost.rs diff --git a/src/circuit/hash.rs b/tket2/src/circuit/hash.rs similarity index 100% rename from src/circuit/hash.rs rename to tket2/src/circuit/hash.rs diff --git a/src/circuit/units.rs b/tket2/src/circuit/units.rs similarity index 100% rename from src/circuit/units.rs rename to tket2/src/circuit/units.rs diff --git a/src/circuit/units/filter.rs b/tket2/src/circuit/units/filter.rs similarity index 100% rename from src/circuit/units/filter.rs rename to tket2/src/circuit/units/filter.rs diff --git a/src/extension.rs b/tket2/src/extension.rs similarity index 100% rename from src/extension.rs rename to tket2/src/extension.rs diff --git a/src/json.rs b/tket2/src/json.rs similarity index 99% rename from src/json.rs rename to tket2/src/json.rs index 21590610..72e01ef7 100644 --- a/src/json.rs +++ b/tket2/src/json.rs @@ -106,7 +106,7 @@ pub enum OpConvertError { #[cfg(feature = "pyo3")] create_exception!( - pyrs, + pytket_tk2, PyOpConvertError, PyException, "Error type for conversion between tket2's `Op` and `OpType`" diff --git a/src/json/decoder.rs b/tket2/src/json/decoder.rs similarity index 100% rename from src/json/decoder.rs rename to tket2/src/json/decoder.rs diff --git a/src/json/encoder.rs b/tket2/src/json/encoder.rs similarity index 100% rename from src/json/encoder.rs rename to tket2/src/json/encoder.rs diff --git a/src/json/op.rs b/tket2/src/json/op.rs similarity index 100% rename from src/json/op.rs rename to tket2/src/json/op.rs diff --git a/src/json/tests.rs b/tket2/src/json/tests.rs similarity index 99% rename from src/json/tests.rs rename to tket2/src/json/tests.rs index 195ee444..21a3d982 100644 --- a/src/json/tests.rs +++ b/tket2/src/json/tests.rs @@ -74,7 +74,7 @@ fn json_roundtrip(#[case] circ_s: &str, #[case] num_commands: usize, #[case] num #[rstest] #[cfg_attr(miri, ignore)] // Opening files is not supported in (isolated) miri -#[case::barenco_tof_10("test_files/barenco_tof_10.json")] +#[case::barenco_tof_10("../test_files/barenco_tof_10.json")] fn json_file_roundtrip(#[case] circ: impl AsRef) { let reader = BufReader::new(std::fs::File::open(circ).unwrap()); let ser: circuit_json::SerialCircuit = serde_json::from_reader(reader).unwrap(); diff --git a/src/lib.rs b/tket2/src/lib.rs similarity index 100% rename from src/lib.rs rename to tket2/src/lib.rs diff --git a/src/ops.rs b/tket2/src/ops.rs similarity index 100% rename from src/ops.rs rename to tket2/src/ops.rs diff --git a/src/optimiser.rs b/tket2/src/optimiser.rs similarity index 100% rename from src/optimiser.rs rename to tket2/src/optimiser.rs diff --git a/src/optimiser/taso.rs b/tket2/src/optimiser/taso.rs similarity index 99% rename from src/optimiser/taso.rs rename to tket2/src/optimiser/taso.rs index a54a6471..ff906770 100644 --- a/src/optimiser/taso.rs +++ b/tket2/src/optimiser/taso.rs @@ -459,7 +459,7 @@ mod tests { #[fixture] fn taso_opt() -> DefaultTasoOptimiser { - TasoOptimiser::default_with_eccs_json_file("test_files/small_eccs.json").unwrap() + TasoOptimiser::default_with_eccs_json_file("../test_files/small_eccs.json").unwrap() } #[rstest] diff --git a/src/optimiser/taso/eq_circ_class.rs b/tket2/src/optimiser/taso/eq_circ_class.rs similarity index 100% rename from src/optimiser/taso/eq_circ_class.rs rename to tket2/src/optimiser/taso/eq_circ_class.rs diff --git a/src/optimiser/taso/hugr_pchannel.rs b/tket2/src/optimiser/taso/hugr_pchannel.rs similarity index 100% rename from src/optimiser/taso/hugr_pchannel.rs rename to tket2/src/optimiser/taso/hugr_pchannel.rs diff --git a/src/optimiser/taso/hugr_pqueue.rs b/tket2/src/optimiser/taso/hugr_pqueue.rs similarity index 100% rename from src/optimiser/taso/hugr_pqueue.rs rename to tket2/src/optimiser/taso/hugr_pqueue.rs diff --git a/src/optimiser/taso/log.rs b/tket2/src/optimiser/taso/log.rs similarity index 100% rename from src/optimiser/taso/log.rs rename to tket2/src/optimiser/taso/log.rs diff --git a/src/optimiser/taso/qtz_circuit.rs b/tket2/src/optimiser/taso/qtz_circuit.rs similarity index 96% rename from src/optimiser/taso/qtz_circuit.rs rename to tket2/src/optimiser/taso/qtz_circuit.rs index 11ea2982..ef5cd19b 100644 --- a/src/optimiser/taso/qtz_circuit.rs +++ b/tket2/src/optimiser/taso/qtz_circuit.rs @@ -145,7 +145,7 @@ mod tests { #[cfg_attr(miri, ignore)] // Opening files is not supported in (isolated) miri fn test_read_rep() { let rep_map: HashMap = - load_representative_set("test_files/h_rz_cxrepresentative_set.json"); + load_representative_set("../test_files/h_rz_cxrepresentative_set.json"); for c in rep_map.values().take(1) { println!("{}", c.dot_string()); @@ -156,7 +156,7 @@ mod tests { #[cfg_attr(miri, ignore)] // Opening files is not supported in (isolated) miri fn test_read_complete() { let _ecc: HashMap> = - load_ecc_set("test_files/h_rz_cxcomplete_ECC_set.json").unwrap(); + load_ecc_set("../test_files/h_rz_cxcomplete_ECC_set.json").unwrap(); // ecc.values() // .flatten() diff --git a/src/optimiser/taso/worker.rs b/tket2/src/optimiser/taso/worker.rs similarity index 100% rename from src/optimiser/taso/worker.rs rename to tket2/src/optimiser/taso/worker.rs diff --git a/src/passes.rs b/tket2/src/passes.rs similarity index 100% rename from src/passes.rs rename to tket2/src/passes.rs diff --git a/src/passes/_classical.rs b/tket2/src/passes/_classical.rs similarity index 100% rename from src/passes/_classical.rs rename to tket2/src/passes/_classical.rs diff --git a/src/passes/_squash.rs b/tket2/src/passes/_squash.rs similarity index 100% rename from src/passes/_squash.rs rename to tket2/src/passes/_squash.rs diff --git a/src/passes/chunks.rs b/tket2/src/passes/chunks.rs similarity index 100% rename from src/passes/chunks.rs rename to tket2/src/passes/chunks.rs diff --git a/src/passes/commutation.rs b/tket2/src/passes/commutation.rs similarity index 99% rename from src/passes/commutation.rs rename to tket2/src/passes/commutation.rs index bbca13ff..6c9cbaf6 100644 --- a/src/passes/commutation.rs +++ b/tket2/src/passes/commutation.rs @@ -204,7 +204,7 @@ pub enum PullForwardError { #[cfg(feature = "pyo3")] create_exception!( - pyrs, + pytket_tk2, PyPullForwardError, PyException, "Error in applying PullForward rewrite." diff --git a/src/portmatching.rs b/tket2/src/portmatching.rs similarity index 100% rename from src/portmatching.rs rename to tket2/src/portmatching.rs diff --git a/src/portmatching/matcher.rs b/tket2/src/portmatching/matcher.rs similarity index 100% rename from src/portmatching/matcher.rs rename to tket2/src/portmatching/matcher.rs diff --git a/src/portmatching/pattern.rs b/tket2/src/portmatching/pattern.rs similarity index 99% rename from src/portmatching/pattern.rs rename to tket2/src/portmatching/pattern.rs index fce1e05e..b32e0123 100644 --- a/src/portmatching/pattern.rs +++ b/tket2/src/portmatching/pattern.rs @@ -138,7 +138,7 @@ impl From for InvalidPattern { #[cfg(feature = "pyo3")] create_exception!( - pyrs, + pytket_tk2, PyInvalidPatternError, PyException, "Invalid circuit pattern" diff --git a/src/portmatching/pyo3.rs b/tket2/src/portmatching/pyo3.rs similarity index 100% rename from src/portmatching/pyo3.rs rename to tket2/src/portmatching/pyo3.rs diff --git a/src/rewrite.rs b/tket2/src/rewrite.rs similarity index 100% rename from src/rewrite.rs rename to tket2/src/rewrite.rs diff --git a/src/rewrite/ecc_rewriter.rs b/tket2/src/rewrite/ecc_rewriter.rs similarity index 99% rename from src/rewrite/ecc_rewriter.rs rename to tket2/src/rewrite/ecc_rewriter.rs index feabd8f5..dede628a 100644 --- a/src/rewrite/ecc_rewriter.rs +++ b/tket2/src/rewrite/ecc_rewriter.rs @@ -335,7 +335,7 @@ mod tests { fn ecc_rewriter_from_file() { // In this example, all circuits are valid patterns, thus // PatternID == TargetID. - let test_file = "test_files/small_eccs.json"; + let test_file = "../test_files/small_eccs.json"; let rewriter = ECCRewriter::try_from_eccs_json_file(test_file).unwrap(); assert_eq!(rewriter.rewrite_rules.len(), rewriter.matcher.n_patterns()); assert_eq!(rewriter.targets.len(), 5 * 4 + 5 * 3); @@ -370,7 +370,7 @@ mod tests { /// obtain convex patterns #[test] fn ecc_rewriter_empty_params() { - let test_file = "test_files/cx_cx_eccs.json"; + let test_file = "../test_files/cx_cx_eccs.json"; let rewriter = ECCRewriter::try_from_eccs_json_file(test_file).unwrap(); let cx_cx = cx_cx(); diff --git a/src/rewrite/strategy.rs b/tket2/src/rewrite/strategy.rs similarity index 100% rename from src/rewrite/strategy.rs rename to tket2/src/rewrite/strategy.rs diff --git a/src/utils.rs b/tket2/src/utils.rs similarity index 100% rename from src/utils.rs rename to tket2/src/utils.rs From 0dc12303d9dfaf7bd80b7379c1cd79a622c24d22 Mon Sep 17 00:00:00 2001 From: Agustin Borgna Date: Thu, 2 Nov 2023 15:51:51 +0000 Subject: [PATCH 05/13] refactor: Move tket2 code to a workspace member --- Cargo.toml | 78 +++---------------- compile-rewriter/Cargo.toml | 9 ++- pyrs/Cargo.toml | 2 +- taso-optimiser/Cargo.toml | 9 ++- tket2/Cargo.toml | 68 ++++++++++++++++ {benches => tket2/benches}/bench_main.rs | 0 .../benches}/benchmarks/generators.rs | 0 {benches => tket2/benches}/benchmarks/hash.rs | 0 {benches => tket2/benches}/benchmarks/mod.rs | 0 {src => tket2/src}/circuit.rs | 0 {src => tket2/src}/circuit/command.rs | 0 {src => tket2/src}/circuit/cost.rs | 0 {src => tket2/src}/circuit/hash.rs | 0 {src => tket2/src}/circuit/units.rs | 0 {src => tket2/src}/circuit/units/filter.rs | 0 {src => tket2/src}/extension.rs | 0 {src => tket2/src}/json.rs | 0 {src => tket2/src}/json/decoder.rs | 0 {src => tket2/src}/json/encoder.rs | 0 {src => tket2/src}/json/op.rs | 0 {src => tket2/src}/json/tests.rs | 2 +- {src => tket2/src}/lib.rs | 0 {src => tket2/src}/ops.rs | 0 {src => tket2/src}/optimiser.rs | 0 {src => tket2/src}/optimiser/taso.rs | 2 +- .../src}/optimiser/taso/eq_circ_class.rs | 0 .../src}/optimiser/taso/hugr_pchannel.rs | 0 .../src}/optimiser/taso/hugr_pqueue.rs | 0 {src => tket2/src}/optimiser/taso/log.rs | 0 .../src}/optimiser/taso/qtz_circuit.rs | 4 +- {src => tket2/src}/optimiser/taso/worker.rs | 0 {src => tket2/src}/passes.rs | 0 {src => tket2/src}/passes/_classical.rs | 0 {src => tket2/src}/passes/_squash.rs | 0 {src => tket2/src}/passes/chunks.rs | 0 {src => tket2/src}/passes/commutation.rs | 0 {src => tket2/src}/portmatching.rs | 0 {src => tket2/src}/portmatching/matcher.rs | 0 {src => tket2/src}/portmatching/pattern.rs | 0 {src => tket2/src}/portmatching/pyo3.rs | 0 {src => tket2/src}/rewrite.rs | 0 {src => tket2/src}/rewrite/ecc_rewriter.rs | 4 +- {src => tket2/src}/rewrite/strategy.rs | 0 {src => tket2/src}/utils.rs | 0 44 files changed, 98 insertions(+), 80 deletions(-) create mode 100644 tket2/Cargo.toml rename {benches => tket2/benches}/bench_main.rs (100%) rename {benches => tket2/benches}/benchmarks/generators.rs (100%) rename {benches => tket2/benches}/benchmarks/hash.rs (100%) rename {benches => tket2/benches}/benchmarks/mod.rs (100%) rename {src => tket2/src}/circuit.rs (100%) rename {src => tket2/src}/circuit/command.rs (100%) rename {src => tket2/src}/circuit/cost.rs (100%) rename {src => tket2/src}/circuit/hash.rs (100%) rename {src => tket2/src}/circuit/units.rs (100%) rename {src => tket2/src}/circuit/units/filter.rs (100%) rename {src => tket2/src}/extension.rs (100%) rename {src => tket2/src}/json.rs (100%) rename {src => tket2/src}/json/decoder.rs (100%) rename {src => tket2/src}/json/encoder.rs (100%) rename {src => tket2/src}/json/op.rs (100%) rename {src => tket2/src}/json/tests.rs (99%) rename {src => tket2/src}/lib.rs (100%) rename {src => tket2/src}/ops.rs (100%) rename {src => tket2/src}/optimiser.rs (100%) rename {src => tket2/src}/optimiser/taso.rs (99%) rename {src => tket2/src}/optimiser/taso/eq_circ_class.rs (100%) rename {src => tket2/src}/optimiser/taso/hugr_pchannel.rs (100%) rename {src => tket2/src}/optimiser/taso/hugr_pqueue.rs (100%) rename {src => tket2/src}/optimiser/taso/log.rs (100%) rename {src => tket2/src}/optimiser/taso/qtz_circuit.rs (96%) rename {src => tket2/src}/optimiser/taso/worker.rs (100%) rename {src => tket2/src}/passes.rs (100%) rename {src => tket2/src}/passes/_classical.rs (100%) rename {src => tket2/src}/passes/_squash.rs (100%) rename {src => tket2/src}/passes/chunks.rs (100%) rename {src => tket2/src}/passes/commutation.rs (100%) rename {src => tket2/src}/portmatching.rs (100%) rename {src => tket2/src}/portmatching/matcher.rs (100%) rename {src => tket2/src}/portmatching/pattern.rs (100%) rename {src => tket2/src}/portmatching/pyo3.rs (100%) rename {src => tket2/src}/rewrite.rs (100%) rename {src => tket2/src}/rewrite/ecc_rewriter.rs (99%) rename {src => tket2/src}/rewrite/strategy.rs (100%) rename {src => tket2/src}/utils.rs (100%) diff --git a/Cargo.toml b/Cargo.toml index 6bea0559..33f9c941 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,78 +1,22 @@ -[package] -name = "tket2" -version = "0.1.0" -edition = "2021" - -[lib] -bench = false -name = "tket2" -path = "src/lib.rs" - [profile.release] lto = "thin" -[dependencies] -lazy_static = "1.4.0" -cgmath = "0.18.0" -num-rational = "0.4" -num-complex = { version = "0.4", optional = true } -tket-json-rs = { workspace = true } -rayon = "1.5" -thiserror = "1.0.28" -serde = { version = "1.0", features = ["derive"] } -serde_json = "1.0" -downcast-rs = "1.2.0" -priority-queue = "1.3.0" -smol_str = "0.2.0" -typetag = "0.2.8" -itertools = { workspace = true } -petgraph = { version = "0.6.3", default-features = false } -serde_yaml = "0.9.22" -# portmatching = { version = "0.2.0", optional = true, features = ["serde"]} -portmatching = { optional = true, git = "https://github.com/lmondada/portmatching", rev = "738c91c", features = [ - "serde", -] } -derive_more = "0.99.17" -quantinuum-hugr = { workspace = true } -portgraph = { workspace = true, features = ["serde"] } -pyo3 = { workspace = true, optional = true, features = ["multiple-pymethods"] } -strum_macros = "0.25.2" -strum = "0.25.0" -fxhash = "0.2.1" -rmp-serde = { version = "1.1.2", optional = true } -delegate = "0.10.0" -csv = { version = "1.2.2" } -chrono = { version = "0.4.30" } -bytemuck = "1.14.0" -stringreader = "0.1.1" -crossbeam-channel = "0.5.8" -tracing = { workspace = true } - -[features] -pyo3 = [ - "dep:pyo3", - "tket-json-rs/pyo3", - "portgraph/pyo3", - "quantinuum-hugr/pyo3", -] -portmatching = ["dep:portmatching", "dep:rmp-serde"] - -[dev-dependencies] -rstest = "0.18.1" -criterion = { version = "0.5.1", features = ["html_reports"] } -webbrowser = "0.8.10" -urlencoding = "2.1.2" - -[[bench]] -name = "bench_main" -harness = false - [workspace] +resolver = "2" +members = ["tket2", "pyrs", "compile-rewriter", "taso-optimiser"] +default-members = ["tket2"] -members = ["pyrs", "compile-rewriter", "taso-optimiser"] +[workspace.package] +version = "0.1.0" +rust-version = "1.70" +edition = "2021" +homepage = "https://github.com/CQCL/tket2" +license-file = "LICENCE" +# authors [workspace.dependencies] +tket2 = { path = "./tket2" } quantinuum-hugr = { git = "https://github.com/CQCL-DEV/hugr", rev = "0beb165" } portgraph = { version = "0.10" } pyo3 = { version = "0.20" } diff --git a/compile-rewriter/Cargo.toml b/compile-rewriter/Cargo.toml index c7cb8b9e..513b744a 100644 --- a/compile-rewriter/Cargo.toml +++ b/compile-rewriter/Cargo.toml @@ -1,12 +1,15 @@ [package] name = "compile-matcher" -version = "0.1.0" -edition = "2021" +edition = { workspace = true } +version = { workspace = true } +rust-version = { workspace = true } +homepage = { workspace = true } +license-file = { workspace = true } # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] clap = { version = "4.4.2", features = ["derive"] } -tket2 = { path = "../", features = ["portmatching"] } +tket2 = { workspace = true, features = ["portmatching"] } quantinuum-hugr = { workspace = true } itertools = { workspace = true } diff --git a/pyrs/Cargo.toml b/pyrs/Cargo.toml index ab53c31f..89c98c06 100644 --- a/pyrs/Cargo.toml +++ b/pyrs/Cargo.toml @@ -9,7 +9,7 @@ name = "pyrs" crate-type = ["cdylib"] [dependencies] -tket2 = { path = "../", features = ["pyo3", "portmatching"] } +tket2 = { workspace = true, features = ["pyo3", "portmatching"] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" tket-json-rs = { workspace = true, features = ["pyo3"] } diff --git a/taso-optimiser/Cargo.toml b/taso-optimiser/Cargo.toml index 5d82ccb7..a8fcd5af 100644 --- a/taso-optimiser/Cargo.toml +++ b/taso-optimiser/Cargo.toml @@ -1,14 +1,17 @@ [package] name = "taso-optimiser" -version = "0.1.0" -edition = "2021" +edition = { workspace = true } +version = { workspace = true } +rust-version = { workspace = true } +homepage = { workspace = true } +license-file = { workspace = true } # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] clap = { version = "4.4.2", features = ["derive"] } serde_json = "1.0" -tket2 = { path = "../", features = ["portmatching"] } +tket2 = { workspace = true, features = ["portmatching"] } quantinuum-hugr = { workspace = true } itertools = { workspace = true } tket-json-rs = { workspace = true } diff --git a/tket2/Cargo.toml b/tket2/Cargo.toml new file mode 100644 index 00000000..94328feb --- /dev/null +++ b/tket2/Cargo.toml @@ -0,0 +1,68 @@ +[package] +name = "tket2" +edition = { workspace = true } +version = { workspace = true } +rust-version = { workspace = true } +homepage = { workspace = true } +license-file = { workspace = true } + +[lib] +bench = false +name = "tket2" +path = "src/lib.rs" + +[features] +pyo3 = [ + "dep:pyo3", + "tket-json-rs/pyo3", + "portgraph/pyo3", + "quantinuum-hugr/pyo3", +] +portmatching = ["dep:portmatching", "dep:rmp-serde"] + +[dependencies] +lazy_static = "1.4.0" +cgmath = "0.18.0" +num-rational = "0.4" +num-complex = { version = "0.4", optional = true } +tket-json-rs = { workspace = true } +rayon = "1.5" +thiserror = "1.0.28" +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" +downcast-rs = "1.2.0" +priority-queue = "1.3.0" +smol_str = "0.2.0" +typetag = "0.2.8" +itertools = { workspace = true } +petgraph = { version = "0.6.3", default-features = false } +serde_yaml = "0.9.22" +# portmatching = { version = "0.2.0", optional = true, features = ["serde"]} +portmatching = { optional = true, git = "https://github.com/lmondada/portmatching", rev = "738c91c", features = [ + "serde", +] } +derive_more = "0.99.17" +quantinuum-hugr = { workspace = true } +portgraph = { workspace = true, features = ["serde"] } +pyo3 = { workspace = true, optional = true, features = ["multiple-pymethods"] } +strum_macros = "0.25.2" +strum = "0.25.0" +fxhash = "0.2.1" +rmp-serde = { version = "1.1.2", optional = true } +delegate = "0.10.0" +csv = { version = "1.2.2" } +chrono = { version = "0.4.30" } +bytemuck = "1.14.0" +stringreader = "0.1.1" +crossbeam-channel = "0.5.8" +tracing = { workspace = true } + +[dev-dependencies] +rstest = "0.18.1" +criterion = { version = "0.5.1", features = ["html_reports"] } +webbrowser = "0.8.10" +urlencoding = "2.1.2" + +[[bench]] +name = "bench_main" +harness = false diff --git a/benches/bench_main.rs b/tket2/benches/bench_main.rs similarity index 100% rename from benches/bench_main.rs rename to tket2/benches/bench_main.rs diff --git a/benches/benchmarks/generators.rs b/tket2/benches/benchmarks/generators.rs similarity index 100% rename from benches/benchmarks/generators.rs rename to tket2/benches/benchmarks/generators.rs diff --git a/benches/benchmarks/hash.rs b/tket2/benches/benchmarks/hash.rs similarity index 100% rename from benches/benchmarks/hash.rs rename to tket2/benches/benchmarks/hash.rs diff --git a/benches/benchmarks/mod.rs b/tket2/benches/benchmarks/mod.rs similarity index 100% rename from benches/benchmarks/mod.rs rename to tket2/benches/benchmarks/mod.rs diff --git a/src/circuit.rs b/tket2/src/circuit.rs similarity index 100% rename from src/circuit.rs rename to tket2/src/circuit.rs diff --git a/src/circuit/command.rs b/tket2/src/circuit/command.rs similarity index 100% rename from src/circuit/command.rs rename to tket2/src/circuit/command.rs diff --git a/src/circuit/cost.rs b/tket2/src/circuit/cost.rs similarity index 100% rename from src/circuit/cost.rs rename to tket2/src/circuit/cost.rs diff --git a/src/circuit/hash.rs b/tket2/src/circuit/hash.rs similarity index 100% rename from src/circuit/hash.rs rename to tket2/src/circuit/hash.rs diff --git a/src/circuit/units.rs b/tket2/src/circuit/units.rs similarity index 100% rename from src/circuit/units.rs rename to tket2/src/circuit/units.rs diff --git a/src/circuit/units/filter.rs b/tket2/src/circuit/units/filter.rs similarity index 100% rename from src/circuit/units/filter.rs rename to tket2/src/circuit/units/filter.rs diff --git a/src/extension.rs b/tket2/src/extension.rs similarity index 100% rename from src/extension.rs rename to tket2/src/extension.rs diff --git a/src/json.rs b/tket2/src/json.rs similarity index 100% rename from src/json.rs rename to tket2/src/json.rs diff --git a/src/json/decoder.rs b/tket2/src/json/decoder.rs similarity index 100% rename from src/json/decoder.rs rename to tket2/src/json/decoder.rs diff --git a/src/json/encoder.rs b/tket2/src/json/encoder.rs similarity index 100% rename from src/json/encoder.rs rename to tket2/src/json/encoder.rs diff --git a/src/json/op.rs b/tket2/src/json/op.rs similarity index 100% rename from src/json/op.rs rename to tket2/src/json/op.rs diff --git a/src/json/tests.rs b/tket2/src/json/tests.rs similarity index 99% rename from src/json/tests.rs rename to tket2/src/json/tests.rs index 195ee444..21a3d982 100644 --- a/src/json/tests.rs +++ b/tket2/src/json/tests.rs @@ -74,7 +74,7 @@ fn json_roundtrip(#[case] circ_s: &str, #[case] num_commands: usize, #[case] num #[rstest] #[cfg_attr(miri, ignore)] // Opening files is not supported in (isolated) miri -#[case::barenco_tof_10("test_files/barenco_tof_10.json")] +#[case::barenco_tof_10("../test_files/barenco_tof_10.json")] fn json_file_roundtrip(#[case] circ: impl AsRef) { let reader = BufReader::new(std::fs::File::open(circ).unwrap()); let ser: circuit_json::SerialCircuit = serde_json::from_reader(reader).unwrap(); diff --git a/src/lib.rs b/tket2/src/lib.rs similarity index 100% rename from src/lib.rs rename to tket2/src/lib.rs diff --git a/src/ops.rs b/tket2/src/ops.rs similarity index 100% rename from src/ops.rs rename to tket2/src/ops.rs diff --git a/src/optimiser.rs b/tket2/src/optimiser.rs similarity index 100% rename from src/optimiser.rs rename to tket2/src/optimiser.rs diff --git a/src/optimiser/taso.rs b/tket2/src/optimiser/taso.rs similarity index 99% rename from src/optimiser/taso.rs rename to tket2/src/optimiser/taso.rs index a54a6471..ff906770 100644 --- a/src/optimiser/taso.rs +++ b/tket2/src/optimiser/taso.rs @@ -459,7 +459,7 @@ mod tests { #[fixture] fn taso_opt() -> DefaultTasoOptimiser { - TasoOptimiser::default_with_eccs_json_file("test_files/small_eccs.json").unwrap() + TasoOptimiser::default_with_eccs_json_file("../test_files/small_eccs.json").unwrap() } #[rstest] diff --git a/src/optimiser/taso/eq_circ_class.rs b/tket2/src/optimiser/taso/eq_circ_class.rs similarity index 100% rename from src/optimiser/taso/eq_circ_class.rs rename to tket2/src/optimiser/taso/eq_circ_class.rs diff --git a/src/optimiser/taso/hugr_pchannel.rs b/tket2/src/optimiser/taso/hugr_pchannel.rs similarity index 100% rename from src/optimiser/taso/hugr_pchannel.rs rename to tket2/src/optimiser/taso/hugr_pchannel.rs diff --git a/src/optimiser/taso/hugr_pqueue.rs b/tket2/src/optimiser/taso/hugr_pqueue.rs similarity index 100% rename from src/optimiser/taso/hugr_pqueue.rs rename to tket2/src/optimiser/taso/hugr_pqueue.rs diff --git a/src/optimiser/taso/log.rs b/tket2/src/optimiser/taso/log.rs similarity index 100% rename from src/optimiser/taso/log.rs rename to tket2/src/optimiser/taso/log.rs diff --git a/src/optimiser/taso/qtz_circuit.rs b/tket2/src/optimiser/taso/qtz_circuit.rs similarity index 96% rename from src/optimiser/taso/qtz_circuit.rs rename to tket2/src/optimiser/taso/qtz_circuit.rs index 11ea2982..ef5cd19b 100644 --- a/src/optimiser/taso/qtz_circuit.rs +++ b/tket2/src/optimiser/taso/qtz_circuit.rs @@ -145,7 +145,7 @@ mod tests { #[cfg_attr(miri, ignore)] // Opening files is not supported in (isolated) miri fn test_read_rep() { let rep_map: HashMap = - load_representative_set("test_files/h_rz_cxrepresentative_set.json"); + load_representative_set("../test_files/h_rz_cxrepresentative_set.json"); for c in rep_map.values().take(1) { println!("{}", c.dot_string()); @@ -156,7 +156,7 @@ mod tests { #[cfg_attr(miri, ignore)] // Opening files is not supported in (isolated) miri fn test_read_complete() { let _ecc: HashMap> = - load_ecc_set("test_files/h_rz_cxcomplete_ECC_set.json").unwrap(); + load_ecc_set("../test_files/h_rz_cxcomplete_ECC_set.json").unwrap(); // ecc.values() // .flatten() diff --git a/src/optimiser/taso/worker.rs b/tket2/src/optimiser/taso/worker.rs similarity index 100% rename from src/optimiser/taso/worker.rs rename to tket2/src/optimiser/taso/worker.rs diff --git a/src/passes.rs b/tket2/src/passes.rs similarity index 100% rename from src/passes.rs rename to tket2/src/passes.rs diff --git a/src/passes/_classical.rs b/tket2/src/passes/_classical.rs similarity index 100% rename from src/passes/_classical.rs rename to tket2/src/passes/_classical.rs diff --git a/src/passes/_squash.rs b/tket2/src/passes/_squash.rs similarity index 100% rename from src/passes/_squash.rs rename to tket2/src/passes/_squash.rs diff --git a/src/passes/chunks.rs b/tket2/src/passes/chunks.rs similarity index 100% rename from src/passes/chunks.rs rename to tket2/src/passes/chunks.rs diff --git a/src/passes/commutation.rs b/tket2/src/passes/commutation.rs similarity index 100% rename from src/passes/commutation.rs rename to tket2/src/passes/commutation.rs diff --git a/src/portmatching.rs b/tket2/src/portmatching.rs similarity index 100% rename from src/portmatching.rs rename to tket2/src/portmatching.rs diff --git a/src/portmatching/matcher.rs b/tket2/src/portmatching/matcher.rs similarity index 100% rename from src/portmatching/matcher.rs rename to tket2/src/portmatching/matcher.rs diff --git a/src/portmatching/pattern.rs b/tket2/src/portmatching/pattern.rs similarity index 100% rename from src/portmatching/pattern.rs rename to tket2/src/portmatching/pattern.rs diff --git a/src/portmatching/pyo3.rs b/tket2/src/portmatching/pyo3.rs similarity index 100% rename from src/portmatching/pyo3.rs rename to tket2/src/portmatching/pyo3.rs diff --git a/src/rewrite.rs b/tket2/src/rewrite.rs similarity index 100% rename from src/rewrite.rs rename to tket2/src/rewrite.rs diff --git a/src/rewrite/ecc_rewriter.rs b/tket2/src/rewrite/ecc_rewriter.rs similarity index 99% rename from src/rewrite/ecc_rewriter.rs rename to tket2/src/rewrite/ecc_rewriter.rs index feabd8f5..dede628a 100644 --- a/src/rewrite/ecc_rewriter.rs +++ b/tket2/src/rewrite/ecc_rewriter.rs @@ -335,7 +335,7 @@ mod tests { fn ecc_rewriter_from_file() { // In this example, all circuits are valid patterns, thus // PatternID == TargetID. - let test_file = "test_files/small_eccs.json"; + let test_file = "../test_files/small_eccs.json"; let rewriter = ECCRewriter::try_from_eccs_json_file(test_file).unwrap(); assert_eq!(rewriter.rewrite_rules.len(), rewriter.matcher.n_patterns()); assert_eq!(rewriter.targets.len(), 5 * 4 + 5 * 3); @@ -370,7 +370,7 @@ mod tests { /// obtain convex patterns #[test] fn ecc_rewriter_empty_params() { - let test_file = "test_files/cx_cx_eccs.json"; + let test_file = "../test_files/cx_cx_eccs.json"; let rewriter = ECCRewriter::try_from_eccs_json_file(test_file).unwrap(); let cx_cx = cx_cx(); diff --git a/src/rewrite/strategy.rs b/tket2/src/rewrite/strategy.rs similarity index 100% rename from src/rewrite/strategy.rs rename to tket2/src/rewrite/strategy.rs diff --git a/src/utils.rs b/tket2/src/utils.rs similarity index 100% rename from src/utils.rs rename to tket2/src/utils.rs From ea84f57f845257f8d03b0323cce8716d362dd2be Mon Sep 17 00:00:00 2001 From: Agustin Borgna Date: Thu, 2 Nov 2023 16:21:53 +0000 Subject: [PATCH 06/13] fix missing requirements on py-coverage --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 10227d12..169f4c5b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -161,7 +161,9 @@ jobs: maturin build -m pytket-tk2/Cargo.toml pip install target/wheels/*.whl - name: Run python tests with coverage instrumentation - run: pytest --cov=./ --cov-report=xml + run: | + pip install pytest -r pytket-tk2/dev-requirements.txt + pytest --cov=./ --cov-report=xml - name: Upload python coverage to codecov.io uses: codecov/codecov-action@v3 with: From 912515654797b0ad507c6a105b4274f86e8e63dc Mon Sep 17 00:00:00 2001 From: Agustin Borgna Date: Thu, 2 Nov 2023 16:41:11 +0000 Subject: [PATCH 07/13] Configure maturin's Cargo.toml path directly in pyproject --- .github/workflows/ci.yml | 4 ++-- DEVELOPMENT.md | 2 +- justfile | 4 ++-- pyproject.toml | 1 + 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 169f4c5b..8e8f25a9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -110,7 +110,7 @@ jobs: - name: Build pyo3 bindings run: | pip install -r requirements.txt - maturin build -m pytket-tk2/Cargo.toml + maturin build pip install target/wheels/*.whl - name: Test pyo3 bindings run: | @@ -158,7 +158,7 @@ jobs: run: | pip install -r requirements.txt pip install pytest-cov - maturin build -m pytket-tk2/Cargo.toml + maturin build pip install target/wheels/*.whl - name: Run python tests with coverage instrumentation run: | diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index fc49d6b0..2f2e1530 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -62,7 +62,7 @@ cargo +nightly miri test To run the python tests, run: ```bash -maturin develop -m pytket-tk2/Cargo.toml +maturin develop pytest ``` diff --git a/justfile b/justfile index 05e57f49..a190bde1 100644 --- a/justfile +++ b/justfile @@ -12,11 +12,11 @@ fix: # Build the python package wheels pybuild: - maturin build -m pytket-tk2/Cargo.toml --release + maturin build --release # Build the python package for local development pydevelop: - maturin develop -m pytket-tk2/Cargo.toml + maturin develop # Run the python tests pytest: pydevelop diff --git a/pyproject.toml b/pyproject.toml index 9772c101..e891a273 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,6 +38,7 @@ homepage = "https://github.com/CQCL/tket2" repository = "https://github.com/CQCL/tket2" [tool.maturin] +manifest-path = "pytket-tk2/Cargo.toml" python-source = "pytket-tk2" [tool.pytest.ini_options] From ce956023dc95bd809553a1eeca6266fd3b910828 Mon Sep 17 00:00:00 2001 From: Agustin Borgna Date: Thu, 2 Nov 2023 16:58:53 +0000 Subject: [PATCH 08/13] Drop unused files --- .github/workflows/ci.yml | 12 ++++-------- .gitmodules | 3 --- .../dev-requirements.txt => dev-requirements.txt | 3 ++- ext/symengine.rs | 1 - pytket-tk2/pyproject.toml | 12 ------------ pytket-tk2/requirements.txt | 1 - 6 files changed, 6 insertions(+), 26 deletions(-) delete mode 100644 .gitmodules rename pytket-tk2/dev-requirements.txt => dev-requirements.txt (81%) delete mode 160000 ext/symengine.rs delete mode 100644 pytket-tk2/pyproject.toml delete mode 100644 pytket-tk2/requirements.txt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8e8f25a9..f4e037e1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -109,13 +109,11 @@ jobs: cache: 'pip' - name: Build pyo3 bindings run: | - pip install -r requirements.txt + pip install -r dev-requirements.txt maturin build pip install target/wheels/*.whl - name: Test pyo3 bindings - run: | - pip install pytest -r pytket-tk2/dev-requirements.txt - pytest + run: pytest coverage: if: github.event_name != 'merge_group' @@ -156,14 +154,12 @@ jobs: cache: 'pip' - name: Build pyo3 bindings run: | - pip install -r requirements.txt + pip install -r dev-requirements.txt pip install pytest-cov maturin build pip install target/wheels/*.whl - name: Run python tests with coverage instrumentation - run: | - pip install pytest -r pytket-tk2/dev-requirements.txt - pytest --cov=./ --cov-report=xml + run: pytest --cov=./ --cov-report=xml - name: Upload python coverage to codecov.io uses: codecov/codecov-action@v3 with: diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 8014a43a..00000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "ext/symengine.rs"] - path = ext/symengine.rs - url = git@github.com:podo-os/symengine.rs.git diff --git a/pytket-tk2/dev-requirements.txt b/dev-requirements.txt similarity index 81% rename from pytket-tk2/dev-requirements.txt rename to dev-requirements.txt index 9768808e..da3643d0 100644 --- a/pytket-tk2/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,8 +1,9 @@ -# Use common dependencies +# Runtime requirements -r requirements.txt # Development requirements maturin # Build wheels +pytest # Unit testing ruff # Code formatting pytket # TKET1 jupyterlab # For running the examples diff --git a/ext/symengine.rs b/ext/symengine.rs deleted file mode 160000 index 05ae9caf..00000000 --- a/ext/symengine.rs +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 05ae9caf81173095938632454b2f1d6b412adb86 diff --git a/pytket-tk2/pyproject.toml b/pytket-tk2/pyproject.toml deleted file mode 100644 index ef7208bd..00000000 --- a/pytket-tk2/pyproject.toml +++ /dev/null @@ -1,12 +0,0 @@ -[build-system] -requires = ["maturin~=1.3"] -build-backend = "maturin" - -[project] -name = "pytket_tk2" -version = "0.1.0" -description = "pytket extension for the tket 2 compiler" -authors = [] # TODO -classifiers = [] # TODO -requires-python = ">=3.10" -license = "Apache-2.0" diff --git a/pytket-tk2/requirements.txt b/pytket-tk2/requirements.txt deleted file mode 100644 index 1ab89afc..00000000 --- a/pytket-tk2/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -# pytket-tk2 dependencies \ No newline at end of file From d9a96fc2eed46688af8246e125baa353c3a34822 Mon Sep 17 00:00:00 2001 From: Agustin Borgna Date: Fri, 3 Nov 2023 10:41:26 +0000 Subject: [PATCH 09/13] s/pytket2-tk2/tket2/ --- .gitignore | 2 +- Cargo.toml | 5 +++- README.md | 2 +- devenv.nix | 2 +- poetry.lock | 28 +++++++++++++++++- pyproject.toml | 10 +++---- pytket-tk2/pytket_tk2/__init__.py | 5 ---- {pytket-tk2 => tket2-py}/.gitignore | 0 {pytket-tk2 => tket2-py}/Cargo.toml | 7 +++-- {pytket-tk2 => tket2-py}/README.md | 4 +-- {pytket-tk2 => tket2-py}/src/circuit.rs | 0 {pytket-tk2 => tket2-py}/src/lib.rs | 10 +++---- {pytket-tk2 => tket2-py}/src/optimiser.rs | 0 {pytket-tk2 => tket2-py}/src/pass.rs | 0 .../test/test_bindings.py | 6 ++-- .../test/test_optimiser.py | 2 +- {pytket-tk2 => tket2-py}/test/test_pass.py | 2 +- .../test/test_portmatching.py | 2 +- tket2-py/tket2/__init__.py | 5 ++++ .../tket2}/custom_base.py | 2 +- .../tket2}/data/nam_6_3.rwr | Bin .../pytket_tk2 => tket2-py/tket2}/passes.py | 6 ++-- tket2/Cargo.toml | 5 +--- tket2/src/json.rs | 2 +- tket2/src/passes/commutation.rs | 2 +- tket2/src/portmatching/pattern.rs | 2 +- 26 files changed, 69 insertions(+), 42 deletions(-) delete mode 100644 pytket-tk2/pytket_tk2/__init__.py rename {pytket-tk2 => tket2-py}/.gitignore (100%) rename {pytket-tk2 => tket2-py}/Cargo.toml (84%) rename {pytket-tk2 => tket2-py}/README.md (90%) rename {pytket-tk2 => tket2-py}/src/circuit.rs (100%) rename {pytket-tk2 => tket2-py}/src/lib.rs (91%) rename {pytket-tk2 => tket2-py}/src/optimiser.rs (100%) rename {pytket-tk2 => tket2-py}/src/pass.rs (100%) rename {pytket-tk2 => tket2-py}/test/test_bindings.py (98%) rename {pytket-tk2 => tket2-py}/test/test_optimiser.py (90%) rename {pytket-tk2 => tket2-py}/test/test_pass.py (84%) rename {pytket-tk2 => tket2-py}/test/test_portmatching.py (97%) create mode 100644 tket2-py/tket2/__init__.py rename {pytket-tk2/pytket_tk2 => tket2-py/tket2}/custom_base.py (82%) rename {pytket-tk2/pytket_tk2 => tket2-py/tket2}/data/nam_6_3.rwr (100%) rename {pytket-tk2/pytket_tk2 => tket2-py/tket2}/passes.py (87%) diff --git a/.gitignore b/.gitignore index 22dc2f45..a2d0ce18 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ /target Cargo.lock -pytket-tk2/target/ +tket2-py/target/ __pycache__ .ipynb_checkpoints diff --git a/Cargo.toml b/Cargo.toml index b6266141..0d9821f5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ lto = "thin" [workspace] resolver = "2" -members = ["tket2", "pytket-tk2", "compile-rewriter", "taso-optimiser"] +members = ["tket2", "tket2-py", "compile-rewriter", "taso-optimiser"] default-members = ["tket2"] [workspace.package] @@ -23,3 +23,6 @@ pyo3 = { version = "0.20" } itertools = { version = "0.11.0" } tket-json-rs = "0.2.0" tracing = "0.1.37" +portmatching = { git = "https://github.com/lmondada/portmatching", rev = "738c91c", features = [ + "serde", +] } diff --git a/README.md b/README.md index 30993746..eff080f0 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Version 2 of the TKET compiler. ## Features - `pyo3` -This optional feature enables some python bindings via pyo3. See the `pytket-tk2` folder for more. +This optional feature enables some python bindings via pyo3. See the `tket2-py` folder for more. - `portmatching` This enables pattern matching using the `portmatching` crate. diff --git a/devenv.nix b/devenv.nix index 134d9584..88389e65 100644 --- a/devenv.nix +++ b/devenv.nix @@ -39,7 +39,7 @@ enable = true; venv.enable = true; - venv.requirements = "-r ${config.env.DEVENV_ROOT}/pytket-tk2/dev-requirements.txt"; + venv.requirements = "-r ${config.env.DEVENV_ROOT}/tket2-py/dev-requirements.txt"; }; # https://devenv.sh/pre-commit-hooks/ diff --git a/poetry.lock b/poetry.lock index 7e135809..6f787a2f 100644 --- a/poetry.lock +++ b/poetry.lock @@ -360,6 +360,32 @@ files = [ [package.dependencies] setuptools = "*" +[[package]] +name = "ruff" +version = "0.1.3" +description = "An extremely fast Python linter, written in Rust." +optional = false +python-versions = ">=3.7" +files = [ + {file = "ruff-0.1.3-py3-none-macosx_10_7_x86_64.whl", hash = "sha256:b46d43d51f7061652eeadb426a9e3caa1e0002470229ab2fc19de8a7b0766901"}, + {file = "ruff-0.1.3-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:b8afeb9abd26b4029c72adc9921b8363374f4e7edb78385ffaa80278313a15f9"}, + {file = "ruff-0.1.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ca3cf365bf32e9ba7e6db3f48a4d3e2c446cd19ebee04f05338bc3910114528b"}, + {file = "ruff-0.1.3-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:4874c165f96c14a00590dcc727a04dca0cfd110334c24b039458c06cf78a672e"}, + {file = "ruff-0.1.3-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:eec2dd31eed114e48ea42dbffc443e9b7221976554a504767ceaee3dd38edeb8"}, + {file = "ruff-0.1.3-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:dc3ec4edb3b73f21b4aa51337e16674c752f1d76a4a543af56d7d04e97769613"}, + {file = "ruff-0.1.3-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:2e3de9ed2e39160800281848ff4670e1698037ca039bda7b9274f849258d26ce"}, + {file = "ruff-0.1.3-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:1c595193881922cc0556a90f3af99b1c5681f0c552e7a2a189956141d8666fe8"}, + {file = "ruff-0.1.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0f75e670d529aa2288cd00fc0e9b9287603d95e1536d7a7e0cafe00f75e0dd9d"}, + {file = "ruff-0.1.3-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:76dd49f6cd945d82d9d4a9a6622c54a994689d8d7b22fa1322983389b4892e20"}, + {file = "ruff-0.1.3-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:918b454bc4f8874a616f0d725590277c42949431ceb303950e87fef7a7d94cb3"}, + {file = "ruff-0.1.3-py3-none-musllinux_1_2_i686.whl", hash = "sha256:d8859605e729cd5e53aa38275568dbbdb4fe882d2ea2714c5453b678dca83784"}, + {file = "ruff-0.1.3-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:0b6c55f5ef8d9dd05b230bb6ab80bc4381ecb60ae56db0330f660ea240cb0d4a"}, + {file = "ruff-0.1.3-py3-none-win32.whl", hash = "sha256:3e7afcbdcfbe3399c34e0f6370c30f6e529193c731b885316c5a09c9e4317eef"}, + {file = "ruff-0.1.3-py3-none-win_amd64.whl", hash = "sha256:7a18df6638cec4a5bd75350639b2bb2a2366e01222825562c7346674bdceb7ea"}, + {file = "ruff-0.1.3-py3-none-win_arm64.whl", hash = "sha256:12fd53696c83a194a2db7f9a46337ce06445fb9aa7d25ea6f293cf75b21aca9f"}, + {file = "ruff-0.1.3.tar.gz", hash = "sha256:3ba6145369a151401d5db79f0a47d50e470384d0d89d0d6f7fab0b589ad07c34"}, +] + [[package]] name = "scipy" version = "1.11.3" @@ -468,4 +494,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = "^3.10,<3.12" -content-hash = "a0758aed63a08f8e0dda701bf8b583f00288fc07bb3f7e7dee5d21abf521a67c" +content-hash = "39977310b3f63b5ecc392fd34e41b53d89a560c11963772ce5a86f9b11b4bcac" diff --git a/pyproject.toml b/pyproject.toml index e891a273..ed961731 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [tool.poetry] -name = "pytket-tk2" +name = "tket2-py" version = "0.1.0" description = "pytket extension for the tket 2 compiler" classifiers = [] # TODO @@ -9,7 +9,7 @@ include = ["pyproject.toml"] license = "Apache-2.0" readme = "README.md" -packages = [{ include = "pytket-tk2" }] +packages = [{ include = "tket2-py" }] [tool.poetry.dependencies] python = "^3.10,<3.12" @@ -25,7 +25,7 @@ requires = ["maturin~=1.3"] build-backend = "maturin" [project] -name = "pytket_tk2" +name = "tket2" version = "0.1.0" description = "pytket extension for the tket 2 compiler" authors = [] # TODO @@ -38,8 +38,8 @@ homepage = "https://github.com/CQCL/tket2" repository = "https://github.com/CQCL/tket2" [tool.maturin] -manifest-path = "pytket-tk2/Cargo.toml" -python-source = "pytket-tk2" +manifest-path = "tket2-py/Cargo.toml" +python-source = "tket2-py" [tool.pytest.ini_options] # Lark throws deprecation warnings for `src_parse` and `src_constants`. diff --git a/pytket-tk2/pytket_tk2/__init__.py b/pytket-tk2/pytket_tk2/__init__.py deleted file mode 100644 index afab926b..00000000 --- a/pytket-tk2/pytket_tk2/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -from .pytket_tk2 import * # noqa: F403,F405 - -__doc__ = pytket_tk2.__doc__ # noqa: F405 -if hasattr(pytket_tk2, "__all__"): # noqa: F405 - __all__ = pytket_tk2.__all__ # noqa: F405 diff --git a/pytket-tk2/.gitignore b/tket2-py/.gitignore similarity index 100% rename from pytket-tk2/.gitignore rename to tket2-py/.gitignore diff --git a/pytket-tk2/Cargo.toml b/tket2-py/Cargo.toml similarity index 84% rename from pytket-tk2/Cargo.toml rename to tket2-py/Cargo.toml index 9a5d45a7..0dc9b67d 100644 --- a/pytket-tk2/Cargo.toml +++ b/tket2-py/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "pytket-tk2" +name = "tket2-py" edition = { workspace = true } version = { workspace = true } rust-version = { workspace = true } @@ -8,7 +8,7 @@ license-file = { workspace = true } # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [lib] -name = "pytket_tk2" +name = "tket2" crate-type = ["cdylib"] [dependencies] @@ -20,3 +20,6 @@ quantinuum-hugr = { workspace = true } portgraph = { workspace = true, features = ["pyo3", "serde"] } pyo3 = { workspace = true, features = ["extension-module"] } num_cpus = "1.16.0" +derive_more = "0.99.17" +itertools = { workspace = true } +portmatching = { workspace = true } diff --git a/pytket-tk2/README.md b/tket2-py/README.md similarity index 90% rename from pytket-tk2/README.md rename to tket2-py/README.md index da6ed2da..609ea527 100644 --- a/pytket-tk2/README.md +++ b/tket2-py/README.md @@ -1,8 +1,8 @@ -## pytket-tk2 +## tket2-py This package uses [pyo3](https://pyo3.rs/v0.16.4/) and [maturin](https://github.com/PyO3/maturin) to bind TKET2 functionality to -python as the `pytket_tk2` package. +python as the `tket2` package. Recommended: diff --git a/pytket-tk2/src/circuit.rs b/tket2-py/src/circuit.rs similarity index 100% rename from pytket-tk2/src/circuit.rs rename to tket2-py/src/circuit.rs diff --git a/pytket-tk2/src/lib.rs b/tket2-py/src/lib.rs similarity index 91% rename from pytket-tk2/src/lib.rs rename to tket2-py/src/lib.rs index 7f9b909e..315eaae5 100644 --- a/pytket-tk2/src/lib.rs +++ b/tket2-py/src/lib.rs @@ -11,10 +11,9 @@ use pass::add_pass_module; use hugr::Hugr; use pyo3::prelude::*; -use tket2::{ - portmatching::{pyo3::PyPatternMatch, CircuitPattern, PatternMatcher}, - rewrite::CircuitRewrite, -}; +use tket2::portmatching::pyo3::PyPatternMatch; +use tket2::portmatching::{CircuitPattern, PatternMatcher}; +use tket2::rewrite::CircuitRewrite; #[derive(Clone)] #[pyclass] @@ -66,7 +65,8 @@ impl RuleMatcher { /// The Python bindings to TKET2. #[pymodule] -fn pytket_tk2(py: Python, m: &PyModule) -> PyResult<()> { +#[pyo3(name = "tket2")] +fn tket2_py(py: Python, m: &PyModule) -> PyResult<()> { add_circuit_module(py, m)?; add_pattern_module(py, m)?; add_pass_module(py, m)?; diff --git a/pytket-tk2/src/optimiser.rs b/tket2-py/src/optimiser.rs similarity index 100% rename from pytket-tk2/src/optimiser.rs rename to tket2-py/src/optimiser.rs diff --git a/pytket-tk2/src/pass.rs b/tket2-py/src/pass.rs similarity index 100% rename from pytket-tk2/src/pass.rs rename to tket2-py/src/pass.rs diff --git a/pytket-tk2/test/test_bindings.py b/tket2-py/test/test_bindings.py similarity index 98% rename from pytket-tk2/test/test_bindings.py rename to tket2-py/test/test_bindings.py index 47ffaab8..e06cf840 100644 --- a/pytket-tk2/test/test_bindings.py +++ b/tket2-py/test/test_bindings.py @@ -1,5 +1,5 @@ from dataclasses import dataclass -from pytket_tk2 import passes, circuit, pattern +from tket2 import passes, circuit, pattern from pytket.circuit import Circuit @@ -77,7 +77,7 @@ def test_multiple_rules(): # from functools import wraps # import pytest -# from pytket_tk2 import ( +# from tket2 import ( # RsCircuit, # WireType, # RsOpType, @@ -96,7 +96,7 @@ def test_multiple_rules(): # decompose_custom_pass, # count_pycustom, # ) -# from pytket_tk2.custom_base import CustomOpBase +# from tket2.custom_base import CustomOpBase # from pytket import Circuit, OpType, Qubit diff --git a/pytket-tk2/test/test_optimiser.py b/tket2-py/test/test_optimiser.py similarity index 90% rename from pytket-tk2/test/test_optimiser.py rename to tket2-py/test/test_optimiser.py index 4bb2ecf2..ed49e802 100644 --- a/pytket-tk2/test/test_optimiser.py +++ b/tket2-py/test/test_optimiser.py @@ -1,5 +1,5 @@ from pytket import Circuit -from pytket_tk2 import optimiser +from tket2 import optimiser def test_simple_optimiser(): diff --git a/pytket-tk2/test/test_pass.py b/tket2-py/test/test_pass.py similarity index 84% rename from pytket-tk2/test/test_pass.py rename to tket2-py/test/test_pass.py index a26d2cab..392a48eb 100644 --- a/pytket-tk2/test/test_pass.py +++ b/tket2-py/test/test_pass.py @@ -1,5 +1,5 @@ from pytket import Circuit, OpType -from pytket_tk2.passes import taso_pass +from tket2.passes import taso_pass def test_simple_taso_pass_no_opt(): diff --git a/pytket-tk2/test/test_portmatching.py b/tket2-py/test/test_portmatching.py similarity index 97% rename from pytket-tk2/test/test_portmatching.py rename to tket2-py/test/test_portmatching.py index 8449aa31..d55cf9d4 100644 --- a/pytket-tk2/test/test_portmatching.py +++ b/tket2-py/test/test_portmatching.py @@ -1,6 +1,6 @@ from pytket import Circuit from pytket.qasm import circuit_from_qasm -from pytket_tk2 import pattern +from tket2 import pattern def test_simple_matching(): diff --git a/tket2-py/tket2/__init__.py b/tket2-py/tket2/__init__.py new file mode 100644 index 00000000..8bed83d8 --- /dev/null +++ b/tket2-py/tket2/__init__.py @@ -0,0 +1,5 @@ +from .tket2 import * # noqa: F403,F405 + +__doc__ = tket2.__doc__ # noqa: F405 +if hasattr(tket2, "__all__"): # noqa: F405 + __all__ = tket2.__all__ # noqa: F405 diff --git a/pytket-tk2/pytket_tk2/custom_base.py b/tket2-py/tket2/custom_base.py similarity index 82% rename from pytket-tk2/pytket_tk2/custom_base.py rename to tket2-py/tket2/custom_base.py index 84516e9c..3851edaf 100644 --- a/pytket-tk2/pytket_tk2/custom_base.py +++ b/tket2-py/tket2/custom_base.py @@ -1,5 +1,5 @@ # from abc import ABC, abstractmethod -# from pytket_tk2 import RsCircuit, Signature +# from tket2 import RsCircuit, Signature # class CustomOpBase(ABC): diff --git a/pytket-tk2/pytket_tk2/data/nam_6_3.rwr b/tket2-py/tket2/data/nam_6_3.rwr similarity index 100% rename from pytket-tk2/pytket_tk2/data/nam_6_3.rwr rename to tket2-py/tket2/data/nam_6_3.rwr diff --git a/pytket-tk2/pytket_tk2/passes.py b/tket2-py/tket2/passes.py similarity index 87% rename from pytket-tk2/pytket_tk2/passes.py rename to tket2-py/tket2/passes.py index 06f0dac8..b1cb76ed 100644 --- a/pytket-tk2/pytket_tk2/passes.py +++ b/tket2-py/tket2/passes.py @@ -4,7 +4,7 @@ from pytket import Circuit from pytket.passes import CustomPass -from pytket_tk2 import passes, optimiser +from tket2 import passes, optimiser def taso_pass( @@ -23,9 +23,7 @@ def taso_pass( The arguments `max_threads`, `timeout`, `log_dir` and `rebase` are optional and will be passed on to the TASO optimiser if provided.""" if rewriter is None: - rewriter = Path( - importlib.resources.files("pytket_tk2").joinpath("data/nam_6_3.rwr") - ) + rewriter = Path(importlib.resources.files("tket2").joinpath("data/nam_6_3.rwr")) opt = optimiser.TasoOptimiser.load_precompiled(rewriter) def apply(circuit: Circuit) -> Circuit: diff --git a/tket2/Cargo.toml b/tket2/Cargo.toml index 94328feb..712655c1 100644 --- a/tket2/Cargo.toml +++ b/tket2/Cargo.toml @@ -37,10 +37,7 @@ typetag = "0.2.8" itertools = { workspace = true } petgraph = { version = "0.6.3", default-features = false } serde_yaml = "0.9.22" -# portmatching = { version = "0.2.0", optional = true, features = ["serde"]} -portmatching = { optional = true, git = "https://github.com/lmondada/portmatching", rev = "738c91c", features = [ - "serde", -] } +portmatching = { workspace = true, optional = true, features = ["serde"] } derive_more = "0.99.17" quantinuum-hugr = { workspace = true } portgraph = { workspace = true, features = ["serde"] } diff --git a/tket2/src/json.rs b/tket2/src/json.rs index 72e01ef7..62b0c982 100644 --- a/tket2/src/json.rs +++ b/tket2/src/json.rs @@ -106,7 +106,7 @@ pub enum OpConvertError { #[cfg(feature = "pyo3")] create_exception!( - pytket_tk2, + tket2, PyOpConvertError, PyException, "Error type for conversion between tket2's `Op` and `OpType`" diff --git a/tket2/src/passes/commutation.rs b/tket2/src/passes/commutation.rs index 6c9cbaf6..e9148cab 100644 --- a/tket2/src/passes/commutation.rs +++ b/tket2/src/passes/commutation.rs @@ -204,7 +204,7 @@ pub enum PullForwardError { #[cfg(feature = "pyo3")] create_exception!( - pytket_tk2, + tket2, PyPullForwardError, PyException, "Error in applying PullForward rewrite." diff --git a/tket2/src/portmatching/pattern.rs b/tket2/src/portmatching/pattern.rs index b32e0123..9154e9bf 100644 --- a/tket2/src/portmatching/pattern.rs +++ b/tket2/src/portmatching/pattern.rs @@ -138,7 +138,7 @@ impl From for InvalidPattern { #[cfg(feature = "pyo3")] create_exception!( - pytket_tk2, + tket2, PyInvalidPatternError, PyException, "Invalid circuit pattern" From 2b7eb39172e362ebd4264805015a3b5db2a8fa1b Mon Sep 17 00:00:00 2001 From: Agustin Borgna Date: Fri, 3 Nov 2023 10:46:09 +0000 Subject: [PATCH 10/13] Ignore poetry lock file --- .gitignore | 8 +- poetry.lock | 497 ---------------------------------------------------- 2 files changed, 7 insertions(+), 498 deletions(-) delete mode 100644 poetry.lock diff --git a/.gitignore b/.gitignore index a2d0ce18..a74e7b4f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,12 @@ +# Build artifacts /target -Cargo.lock tket2-py/target/ + +# Lock files +Cargo.lock +poetry.lock + +# Python caches __pycache__ .ipynb_checkpoints diff --git a/poetry.lock b/poetry.lock deleted file mode 100644 index 6f787a2f..00000000 --- a/poetry.lock +++ /dev/null @@ -1,497 +0,0 @@ -# This file is automatically @generated by Poetry 1.6.1 and should not be changed by hand. - -[[package]] -name = "colorama" -version = "0.4.6" -description = "Cross-platform colored terminal text." -optional = false -python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" -files = [ - {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, - {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, -] - -[[package]] -name = "exceptiongroup" -version = "1.1.3" -description = "Backport of PEP 654 (exception groups)" -optional = false -python-versions = ">=3.7" -files = [ - {file = "exceptiongroup-1.1.3-py3-none-any.whl", hash = "sha256:343280667a4585d195ca1cf9cef84a4e178c4b6cf2274caef9859782b567d5e3"}, - {file = "exceptiongroup-1.1.3.tar.gz", hash = "sha256:097acd85d473d75af5bb98e41b61ff7fe35efe6675e4f9370ec6ec5126d160e9"}, -] - -[package.extras] -test = ["pytest (>=6)"] - -[[package]] -name = "graphviz" -version = "0.20.1" -description = "Simple Python interface for Graphviz" -optional = false -python-versions = ">=3.7" -files = [ - {file = "graphviz-0.20.1-py3-none-any.whl", hash = "sha256:587c58a223b51611c0cf461132da386edd896a029524ca61a1462b880bf97977"}, - {file = "graphviz-0.20.1.zip", hash = "sha256:8c58f14adaa3b947daf26c19bc1e98c4e0702cdc31cf99153e6f06904d492bf8"}, -] - -[package.extras] -dev = ["flake8", "pep8-naming", "tox (>=3)", "twine", "wheel"] -docs = ["sphinx (>=5)", "sphinx-autodoc-typehints", "sphinx-rtd-theme"] -test = ["coverage", "mock (>=4)", "pytest (>=7)", "pytest-cov", "pytest-mock (>=3)"] - -[[package]] -name = "iniconfig" -version = "2.0.0" -description = "brain-dead simple config-ini parsing" -optional = false -python-versions = ">=3.7" -files = [ - {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, - {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, -] - -[[package]] -name = "jinja2" -version = "3.1.2" -description = "A very fast and expressive template engine." -optional = false -python-versions = ">=3.7" -files = [ - {file = "Jinja2-3.1.2-py3-none-any.whl", hash = "sha256:6088930bfe239f0e6710546ab9c19c9ef35e29792895fed6e6e31a023a182a61"}, - {file = "Jinja2-3.1.2.tar.gz", hash = "sha256:31351a702a408a9e7595a8fc6150fc3f43bb6bf7e319770cbc0db9df9437e852"}, -] - -[package.dependencies] -MarkupSafe = ">=2.0" - -[package.extras] -i18n = ["Babel (>=2.7)"] - -[[package]] -name = "lark-parser" -version = "0.12.0" -description = "a modern parsing library" -optional = false -python-versions = "*" -files = [ - {file = "lark-parser-0.12.0.tar.gz", hash = "sha256:15967db1f1214013dca65b1180745047b9be457d73da224fcda3d9dd4e96a138"}, - {file = "lark_parser-0.12.0-py2.py3-none-any.whl", hash = "sha256:0eaf30cb5ba787fe404d73a7d6e61df97b21d5a63ac26c5008c78a494373c675"}, -] - -[package.extras] -atomic-cache = ["atomicwrites"] -nearley = ["js2py"] -regex = ["regex"] - -[[package]] -name = "markupsafe" -version = "2.1.3" -description = "Safely add untrusted strings to HTML/XML markup." -optional = false -python-versions = ">=3.7" -files = [ - {file = "MarkupSafe-2.1.3-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:cd0f502fe016460680cd20aaa5a76d241d6f35a1c3350c474bac1273803893fa"}, - {file = "MarkupSafe-2.1.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:e09031c87a1e51556fdcb46e5bd4f59dfb743061cf93c4d6831bf894f125eb57"}, - {file = "MarkupSafe-2.1.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:68e78619a61ecf91e76aa3e6e8e33fc4894a2bebe93410754bd28fce0a8a4f9f"}, - {file = "MarkupSafe-2.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:65c1a9bcdadc6c28eecee2c119465aebff8f7a584dd719facdd9e825ec61ab52"}, - {file = "MarkupSafe-2.1.3-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:525808b8019e36eb524b8c68acdd63a37e75714eac50e988180b169d64480a00"}, - {file = "MarkupSafe-2.1.3-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:962f82a3086483f5e5f64dbad880d31038b698494799b097bc59c2edf392fce6"}, - {file = "MarkupSafe-2.1.3-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:aa7bd130efab1c280bed0f45501b7c8795f9fdbeb02e965371bbef3523627779"}, - {file = "MarkupSafe-2.1.3-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:c9c804664ebe8f83a211cace637506669e7890fec1b4195b505c214e50dd4eb7"}, - {file = "MarkupSafe-2.1.3-cp310-cp310-win32.whl", hash = "sha256:10bbfe99883db80bdbaff2dcf681dfc6533a614f700da1287707e8a5d78a8431"}, - {file = "MarkupSafe-2.1.3-cp310-cp310-win_amd64.whl", hash = "sha256:1577735524cdad32f9f694208aa75e422adba74f1baee7551620e43a3141f559"}, - {file = "MarkupSafe-2.1.3-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:ad9e82fb8f09ade1c3e1b996a6337afac2b8b9e365f926f5a61aacc71adc5b3c"}, - {file = "MarkupSafe-2.1.3-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:3c0fae6c3be832a0a0473ac912810b2877c8cb9d76ca48de1ed31e1c68386575"}, - {file = "MarkupSafe-2.1.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b076b6226fb84157e3f7c971a47ff3a679d837cf338547532ab866c57930dbee"}, - {file = "MarkupSafe-2.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bfce63a9e7834b12b87c64d6b155fdd9b3b96191b6bd334bf37db7ff1fe457f2"}, - {file = "MarkupSafe-2.1.3-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:338ae27d6b8745585f87218a3f23f1512dbf52c26c28e322dbe54bcede54ccb9"}, - {file = "MarkupSafe-2.1.3-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:e4dd52d80b8c83fdce44e12478ad2e85c64ea965e75d66dbeafb0a3e77308fcc"}, - {file = "MarkupSafe-2.1.3-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:df0be2b576a7abbf737b1575f048c23fb1d769f267ec4358296f31c2479db8f9"}, - {file = "MarkupSafe-2.1.3-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:5bbe06f8eeafd38e5d0a4894ffec89378b6c6a625ff57e3028921f8ff59318ac"}, - {file = "MarkupSafe-2.1.3-cp311-cp311-win32.whl", hash = "sha256:dd15ff04ffd7e05ffcb7fe79f1b98041b8ea30ae9234aed2a9168b5797c3effb"}, - {file = "MarkupSafe-2.1.3-cp311-cp311-win_amd64.whl", hash = "sha256:134da1eca9ec0ae528110ccc9e48041e0828d79f24121a1a146161103c76e686"}, - {file = "MarkupSafe-2.1.3-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:f698de3fd0c4e6972b92290a45bd9b1536bffe8c6759c62471efaa8acb4c37bc"}, - {file = "MarkupSafe-2.1.3-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:aa57bd9cf8ae831a362185ee444e15a93ecb2e344c8e52e4d721ea3ab6ef1823"}, - {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ffcc3f7c66b5f5b7931a5aa68fc9cecc51e685ef90282f4a82f0f5e9b704ad11"}, - {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:47d4f1c5f80fc62fdd7777d0d40a2e9dda0a05883ab11374334f6c4de38adffd"}, - {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1f67c7038d560d92149c060157d623c542173016c4babc0c1913cca0564b9939"}, - {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:9aad3c1755095ce347e26488214ef77e0485a3c34a50c5a5e2471dff60b9dd9c"}, - {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:14ff806850827afd6b07a5f32bd917fb7f45b046ba40c57abdb636674a8b559c"}, - {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8f9293864fe09b8149f0cc42ce56e3f0e54de883a9de90cd427f191c346eb2e1"}, - {file = "MarkupSafe-2.1.3-cp312-cp312-win32.whl", hash = "sha256:715d3562f79d540f251b99ebd6d8baa547118974341db04f5ad06d5ea3eb8007"}, - {file = "MarkupSafe-2.1.3-cp312-cp312-win_amd64.whl", hash = "sha256:1b8dd8c3fd14349433c79fa8abeb573a55fc0fdd769133baac1f5e07abf54aeb"}, - {file = "MarkupSafe-2.1.3-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:8e254ae696c88d98da6555f5ace2279cf7cd5b3f52be2b5cf97feafe883b58d2"}, - {file = "MarkupSafe-2.1.3-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cb0932dc158471523c9637e807d9bfb93e06a95cbf010f1a38b98623b929ef2b"}, - {file = "MarkupSafe-2.1.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9402b03f1a1b4dc4c19845e5c749e3ab82d5078d16a2a4c2cd2df62d57bb0707"}, - {file = "MarkupSafe-2.1.3-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ca379055a47383d02a5400cb0d110cef0a776fc644cda797db0c5696cfd7e18e"}, - {file = "MarkupSafe-2.1.3-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:b7ff0f54cb4ff66dd38bebd335a38e2c22c41a8ee45aa608efc890ac3e3931bc"}, - {file = "MarkupSafe-2.1.3-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:c011a4149cfbcf9f03994ec2edffcb8b1dc2d2aede7ca243746df97a5d41ce48"}, - {file = "MarkupSafe-2.1.3-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:56d9f2ecac662ca1611d183feb03a3fa4406469dafe241673d521dd5ae92a155"}, - {file = "MarkupSafe-2.1.3-cp37-cp37m-win32.whl", hash = "sha256:8758846a7e80910096950b67071243da3e5a20ed2546e6392603c096778d48e0"}, - {file = "MarkupSafe-2.1.3-cp37-cp37m-win_amd64.whl", hash = "sha256:787003c0ddb00500e49a10f2844fac87aa6ce977b90b0feaaf9de23c22508b24"}, - {file = "MarkupSafe-2.1.3-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:2ef12179d3a291be237280175b542c07a36e7f60718296278d8593d21ca937d4"}, - {file = "MarkupSafe-2.1.3-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:2c1b19b3aaacc6e57b7e25710ff571c24d6c3613a45e905b1fde04d691b98ee0"}, - {file = "MarkupSafe-2.1.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8afafd99945ead6e075b973fefa56379c5b5c53fd8937dad92c662da5d8fd5ee"}, - {file = "MarkupSafe-2.1.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8c41976a29d078bb235fea9b2ecd3da465df42a562910f9022f1a03107bd02be"}, - {file = "MarkupSafe-2.1.3-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d080e0a5eb2529460b30190fcfcc4199bd7f827663f858a226a81bc27beaa97e"}, - {file = "MarkupSafe-2.1.3-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:69c0f17e9f5a7afdf2cc9fb2d1ce6aabdb3bafb7f38017c0b77862bcec2bbad8"}, - {file = "MarkupSafe-2.1.3-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:504b320cd4b7eff6f968eddf81127112db685e81f7e36e75f9f84f0df46041c3"}, - {file = "MarkupSafe-2.1.3-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:42de32b22b6b804f42c5d98be4f7e5e977ecdd9ee9b660fda1a3edf03b11792d"}, - {file = "MarkupSafe-2.1.3-cp38-cp38-win32.whl", hash = "sha256:ceb01949af7121f9fc39f7d27f91be8546f3fb112c608bc4029aef0bab86a2a5"}, - {file = "MarkupSafe-2.1.3-cp38-cp38-win_amd64.whl", hash = "sha256:1b40069d487e7edb2676d3fbdb2b0829ffa2cd63a2ec26c4938b2d34391b4ecc"}, - {file = "MarkupSafe-2.1.3-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:8023faf4e01efadfa183e863fefde0046de576c6f14659e8782065bcece22198"}, - {file = "MarkupSafe-2.1.3-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:6b2b56950d93e41f33b4223ead100ea0fe11f8e6ee5f641eb753ce4b77a7042b"}, - {file = "MarkupSafe-2.1.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9dcdfd0eaf283af041973bff14a2e143b8bd64e069f4c383416ecd79a81aab58"}, - {file = "MarkupSafe-2.1.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:05fb21170423db021895e1ea1e1f3ab3adb85d1c2333cbc2310f2a26bc77272e"}, - {file = "MarkupSafe-2.1.3-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:282c2cb35b5b673bbcadb33a585408104df04f14b2d9b01d4c345a3b92861c2c"}, - {file = "MarkupSafe-2.1.3-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:ab4a0df41e7c16a1392727727e7998a467472d0ad65f3ad5e6e765015df08636"}, - {file = "MarkupSafe-2.1.3-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:7ef3cb2ebbf91e330e3bb937efada0edd9003683db6b57bb108c4001f37a02ea"}, - {file = "MarkupSafe-2.1.3-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:0a4e4a1aff6c7ac4cd55792abf96c915634c2b97e3cc1c7129578aa68ebd754e"}, - {file = "MarkupSafe-2.1.3-cp39-cp39-win32.whl", hash = "sha256:fec21693218efe39aa7f8599346e90c705afa52c5b31ae019b2e57e8f6542bb2"}, - {file = "MarkupSafe-2.1.3-cp39-cp39-win_amd64.whl", hash = "sha256:3fd4abcb888d15a94f32b75d8fd18ee162ca0c064f35b11134be77050296d6ba"}, - {file = "MarkupSafe-2.1.3.tar.gz", hash = "sha256:af598ed32d6ae86f1b747b82783958b1a4ab8f617b06fe68795c7f026abbdcad"}, -] - -[[package]] -name = "maturin" -version = "1.3.1" -description = "Build and publish crates with pyo3, rust-cpython and cffi bindings as well as rust binaries as python packages" -optional = false -python-versions = ">=3.7" -files = [ - {file = "maturin-1.3.1-py3-none-linux_armv6l.whl", hash = "sha256:925f8324d9bbe8fad90b73ebc6c7f6f594645e7f13af50bded72606b6c233208"}, - {file = "maturin-1.3.1-py3-none-macosx_10_7_x86_64.whl", hash = "sha256:f3c2c694b76e63e78c353e4a2a74f8baff5ac6becf807f23435d28e47a567d63"}, - {file = "maturin-1.3.1-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:13188296f389d05043b8bd2265df66692490b61ba219ae7d5abc09e81e5659ce"}, - {file = "maturin-1.3.1-py3-none-manylinux_2_12_i686.manylinux2010_i686.musllinux_1_1_i686.whl", hash = "sha256:11bbf9978695ac066729af08bc24123317ca3fad51757b0fbdfe811212896714"}, - {file = "maturin-1.3.1-py3-none-manylinux_2_12_x86_64.manylinux2010_x86_64.musllinux_1_1_x86_64.whl", hash = "sha256:d566d2f424fa3f5cd6bd3033fd300b80654884abd061bd53c68f4717753e7d58"}, - {file = "maturin-1.3.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_1_aarch64.whl", hash = "sha256:c0e2b8171f1a70270b86ed72397ba548e3bf4d914f24cd50a228ed85a9d5e914"}, - {file = "maturin-1.3.1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.musllinux_1_1_armv7l.whl", hash = "sha256:804c6706588a9ca78f18f1a10adf9d24099b9cd3c2917628063ba8d4418b8a50"}, - {file = "maturin-1.3.1-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.musllinux_1_1_ppc64le.whl", hash = "sha256:c533d02563bb185125488cdcf161cc6ba2cdd4812ebff1b6504d1b29880ba1f8"}, - {file = "maturin-1.3.1-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:066b0c515505d4a4c526a9afc26fad4f010972d60937530dc4949dda0f49aa61"}, - {file = "maturin-1.3.1-py3-none-win32.whl", hash = "sha256:4835c332e3b632547db12e6a70abc18cb90ba9df06200dd9a7cc73424919901d"}, - {file = "maturin-1.3.1-py3-none-win_amd64.whl", hash = "sha256:871268417d6b3e2b46018c54a0522efc018bc4918b885d005df90b338e0674c7"}, - {file = "maturin-1.3.1-py3-none-win_arm64.whl", hash = "sha256:659a601c27984a50350f792447ff65ec60309423747f5304c98cb7b7fbb63d39"}, - {file = "maturin-1.3.1.tar.gz", hash = "sha256:efa194e99ae5fff185263d8244acacb12ae256ea73aba62c9446f6075ffc7ac1"}, -] - -[package.dependencies] -tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} - -[package.extras] -patchelf = ["patchelf"] -zig = ["ziglang (>=0.10.0,<0.11.0)"] - -[[package]] -name = "mpmath" -version = "1.3.0" -description = "Python library for arbitrary-precision floating-point arithmetic" -optional = false -python-versions = "*" -files = [ - {file = "mpmath-1.3.0-py3-none-any.whl", hash = "sha256:a0b2b9fe80bbcd81a6647ff13108738cfb482d481d826cc0e02f5b35e5c88d2c"}, - {file = "mpmath-1.3.0.tar.gz", hash = "sha256:7a28eb2a9774d00c7bc92411c19a89209d5da7c4c9a9e227be8330a23a25b91f"}, -] - -[package.extras] -develop = ["codecov", "pycodestyle", "pytest (>=4.6)", "pytest-cov", "wheel"] -docs = ["sphinx"] -gmpy = ["gmpy2 (>=2.1.0a4)"] -tests = ["pytest (>=4.6)"] - -[[package]] -name = "networkx" -version = "3.2.1" -description = "Python package for creating and manipulating graphs and networks" -optional = false -python-versions = ">=3.9" -files = [ - {file = "networkx-3.2.1-py3-none-any.whl", hash = "sha256:f18c69adc97877c42332c170849c96cefa91881c99a7cb3e95b7c659ebdc1ec2"}, - {file = "networkx-3.2.1.tar.gz", hash = "sha256:9f1bb5cf3409bf324e0a722c20bdb4c20ee39bf1c30ce8ae499c8502b0b5e0c6"}, -] - -[package.extras] -default = ["matplotlib (>=3.5)", "numpy (>=1.22)", "pandas (>=1.4)", "scipy (>=1.9,!=1.11.0,!=1.11.1)"] -developer = ["changelist (==0.4)", "mypy (>=1.1)", "pre-commit (>=3.2)", "rtoml"] -doc = ["nb2plots (>=0.7)", "nbconvert (<7.9)", "numpydoc (>=1.6)", "pillow (>=9.4)", "pydata-sphinx-theme (>=0.14)", "sphinx (>=7)", "sphinx-gallery (>=0.14)", "texext (>=0.6.7)"] -extra = ["lxml (>=4.6)", "pydot (>=1.4.2)", "pygraphviz (>=1.11)", "sympy (>=1.10)"] -test = ["pytest (>=7.2)", "pytest-cov (>=4.0)"] - -[[package]] -name = "numpy" -version = "1.26.1" -description = "Fundamental package for array computing in Python" -optional = false -python-versions = "<3.13,>=3.9" -files = [ - {file = "numpy-1.26.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:82e871307a6331b5f09efda3c22e03c095d957f04bf6bc1804f30048d0e5e7af"}, - {file = "numpy-1.26.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:cdd9ec98f0063d93baeb01aad472a1a0840dee302842a2746a7a8e92968f9575"}, - {file = "numpy-1.26.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d78f269e0c4fd365fc2992c00353e4530d274ba68f15e968d8bc3c69ce5f5244"}, - {file = "numpy-1.26.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8ab9163ca8aeb7fd32fe93866490654d2f7dda4e61bc6297bf72ce07fdc02f67"}, - {file = "numpy-1.26.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:78ca54b2f9daffa5f323f34cdf21e1d9779a54073f0018a3094ab907938331a2"}, - {file = "numpy-1.26.1-cp310-cp310-win32.whl", hash = "sha256:d1cfc92db6af1fd37a7bb58e55c8383b4aa1ba23d012bdbba26b4bcca45ac297"}, - {file = "numpy-1.26.1-cp310-cp310-win_amd64.whl", hash = "sha256:d2984cb6caaf05294b8466966627e80bf6c7afd273279077679cb010acb0e5ab"}, - {file = "numpy-1.26.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:cd7837b2b734ca72959a1caf3309457a318c934abef7a43a14bb984e574bbb9a"}, - {file = "numpy-1.26.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:1c59c046c31a43310ad0199d6299e59f57a289e22f0f36951ced1c9eac3665b9"}, - {file = "numpy-1.26.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d58e8c51a7cf43090d124d5073bc29ab2755822181fcad978b12e144e5e5a4b3"}, - {file = "numpy-1.26.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6081aed64714a18c72b168a9276095ef9155dd7888b9e74b5987808f0dd0a974"}, - {file = "numpy-1.26.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:97e5d6a9f0702c2863aaabf19f0d1b6c2628fbe476438ce0b5ce06e83085064c"}, - {file = "numpy-1.26.1-cp311-cp311-win32.whl", hash = "sha256:b9d45d1dbb9de84894cc50efece5b09939752a2d75aab3a8b0cef6f3a35ecd6b"}, - {file = "numpy-1.26.1-cp311-cp311-win_amd64.whl", hash = "sha256:3649d566e2fc067597125428db15d60eb42a4e0897fc48d28cb75dc2e0454e53"}, - {file = "numpy-1.26.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:1d1bd82d539607951cac963388534da3b7ea0e18b149a53cf883d8f699178c0f"}, - {file = "numpy-1.26.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:afd5ced4e5a96dac6725daeb5242a35494243f2239244fad10a90ce58b071d24"}, - {file = "numpy-1.26.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a03fb25610ef560a6201ff06df4f8105292ba56e7cdd196ea350d123fc32e24e"}, - {file = "numpy-1.26.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dcfaf015b79d1f9f9c9fd0731a907407dc3e45769262d657d754c3a028586124"}, - {file = "numpy-1.26.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:e509cbc488c735b43b5ffea175235cec24bbc57b227ef1acc691725beb230d1c"}, - {file = "numpy-1.26.1-cp312-cp312-win32.whl", hash = "sha256:af22f3d8e228d84d1c0c44c1fbdeb80f97a15a0abe4f080960393a00db733b66"}, - {file = "numpy-1.26.1-cp312-cp312-win_amd64.whl", hash = "sha256:9f42284ebf91bdf32fafac29d29d4c07e5e9d1af862ea73686581773ef9e73a7"}, - {file = "numpy-1.26.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:bb894accfd16b867d8643fc2ba6c8617c78ba2828051e9a69511644ce86ce83e"}, - {file = "numpy-1.26.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:e44ccb93f30c75dfc0c3aa3ce38f33486a75ec9abadabd4e59f114994a9c4617"}, - {file = "numpy-1.26.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9696aa2e35cc41e398a6d42d147cf326f8f9d81befcb399bc1ed7ffea339b64e"}, - {file = "numpy-1.26.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a5b411040beead47a228bde3b2241100454a6abde9df139ed087bd73fc0a4908"}, - {file = "numpy-1.26.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:1e11668d6f756ca5ef534b5be8653d16c5352cbb210a5c2a79ff288e937010d5"}, - {file = "numpy-1.26.1-cp39-cp39-win32.whl", hash = "sha256:d1d2c6b7dd618c41e202c59c1413ef9b2c8e8a15f5039e344af64195459e3104"}, - {file = "numpy-1.26.1-cp39-cp39-win_amd64.whl", hash = "sha256:59227c981d43425ca5e5c01094d59eb14e8772ce6975d4b2fc1e106a833d5ae2"}, - {file = "numpy-1.26.1-pp39-pypy39_pp73-macosx_10_9_x86_64.whl", hash = "sha256:06934e1a22c54636a059215d6da99e23286424f316fddd979f5071093b648668"}, - {file = "numpy-1.26.1-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:76ff661a867d9272cd2a99eed002470f46dbe0943a5ffd140f49be84f68ffc42"}, - {file = "numpy-1.26.1-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:6965888d65d2848e8768824ca8288db0a81263c1efccec881cb35a0d805fcd2f"}, - {file = "numpy-1.26.1.tar.gz", hash = "sha256:c8c6c72d4a9f831f328efb1312642a1cafafaa88981d9ab76368d50d07d93cbe"}, -] - -[[package]] -name = "packaging" -version = "23.2" -description = "Core utilities for Python packages" -optional = false -python-versions = ">=3.7" -files = [ - {file = "packaging-23.2-py3-none-any.whl", hash = "sha256:8c491190033a9af7e1d931d0b5dacc2ef47509b34dd0de67ed209b5203fc88c7"}, - {file = "packaging-23.2.tar.gz", hash = "sha256:048fb0e9405036518eaaf48a55953c750c11e1a1b68e0dd1a9d62ed0c092cfc5"}, -] - -[[package]] -name = "pluggy" -version = "1.3.0" -description = "plugin and hook calling mechanisms for python" -optional = false -python-versions = ">=3.8" -files = [ - {file = "pluggy-1.3.0-py3-none-any.whl", hash = "sha256:d89c696a773f8bd377d18e5ecda92b7a3793cbe66c87060a6fb58c7b6e1061f7"}, - {file = "pluggy-1.3.0.tar.gz", hash = "sha256:cf61ae8f126ac6f7c451172cf30e3e43d3ca77615509771b3a984a0730651e12"}, -] - -[package.extras] -dev = ["pre-commit", "tox"] -testing = ["pytest", "pytest-benchmark"] - -[[package]] -name = "pytest" -version = "7.4.3" -description = "pytest: simple powerful testing with Python" -optional = false -python-versions = ">=3.7" -files = [ - {file = "pytest-7.4.3-py3-none-any.whl", hash = "sha256:0d009c083ea859a71b76adf7c1d502e4bc170b80a8ef002da5806527b9591fac"}, - {file = "pytest-7.4.3.tar.gz", hash = "sha256:d989d136982de4e3b29dabcc838ad581c64e8ed52c11fbe86ddebd9da0818cd5"}, -] - -[package.dependencies] -colorama = {version = "*", markers = "sys_platform == \"win32\""} -exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} -iniconfig = "*" -packaging = "*" -pluggy = ">=0.12,<2.0" -tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} - -[package.extras] -testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] - -[[package]] -name = "pytket" -version = "1.21.0" -description = "Python module for interfacing with the CQC tket library of quantum software" -optional = false -python-versions = ">=3.9" -files = [ - {file = "pytket-1.21.0-cp310-cp310-macosx_10_14_x86_64.whl", hash = "sha256:36b684fd48d4b142b08dc1722a5115c4f56f88951fefc84661a9370730acee68"}, - {file = "pytket-1.21.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:3987c23d8fbc5735dc57d0c19399c107ad318175e2d172f37a866be025d5fd6e"}, - {file = "pytket-1.21.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:166ace1a61c2b0f66ec6d538ac064676865ef8aa91e621f439afaa46af16cb9d"}, - {file = "pytket-1.21.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:17ccdd443bf2aee3d9eaeb1c64174acde72d430828ba09123a90ad3af458cdcf"}, - {file = "pytket-1.21.0-cp310-cp310-win_amd64.whl", hash = "sha256:b103ee6aa4dbe041edeed82b70df5e5b9ac31fdd284f06068b6bedaf52db4c9b"}, - {file = "pytket-1.21.0-cp311-cp311-macosx_10_14_x86_64.whl", hash = "sha256:6d76d01cfacfd1622685aee6d258163b5efc002ee95aa0ddf25ed7c59adcba3c"}, - {file = "pytket-1.21.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:f5fffbc51bea4655a5c8c4e9898bd6ab60eb3e2ffe017dfad0622718ab036621"}, - {file = "pytket-1.21.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d2b6d81b550c728ac2d73c1cf0adc91ef092cdf1b10aa7e5039abd94711374b3"}, - {file = "pytket-1.21.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:00ac3df11370acd0bedccb97a2260483fc99f9020fa28548ddb55bfa9c08e8ca"}, - {file = "pytket-1.21.0-cp311-cp311-win_amd64.whl", hash = "sha256:bb47cbe505b88035246bef18c571f8592c10e4582c72d9f4b67886364fb7df88"}, - {file = "pytket-1.21.0-cp39-cp39-macosx_10_14_x86_64.whl", hash = "sha256:efa05518436e091c8bd2fc5ef5ed9cea86bf0c5a793138dff2674b8fe27e37bd"}, - {file = "pytket-1.21.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:a4ce6c8a582e0d33cdd2ade1cafc94adccc27f2f60c4a495e3e7ec2a399ada1c"}, - {file = "pytket-1.21.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7ef81b83c9d1de50e3bea44a0dea136833c2fe11bcbaf282bd6dbd754cab2589"}, - {file = "pytket-1.21.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:957e8558600a801de72911183c5fd15c6154736926dfa65b51b4664416c1ee7a"}, - {file = "pytket-1.21.0-cp39-cp39-win_amd64.whl", hash = "sha256:53a4b2967d9f434fe400d8096b9eae19beb482de32f7509354116c06f904a8df"}, -] - -[package.dependencies] -graphviz = ">=0.14,<1.0" -jinja2 = ">=3.0,<4.0" -lark-parser = ">=0.7,<1.0" -networkx = ">=2.8.8" -numpy = ">=1.21.4,<2.0" -qwasm = ">=1.0,<2.0" -scipy = ">=1.7.2,<2.0" -sympy = ">=1.6,<2.0" -types-pkg-resources = "*" -typing-extensions = ">=4.2,<5.0" - -[package.extras] -zx = ["autoray (>=0.6.1)", "quimb (>=1.5,<2.0)"] - -[[package]] -name = "qwasm" -version = "1.0.1" -description = "WebAssembly decoder & disassembler" -optional = false -python-versions = "*" -files = [ - {file = "qwasm-1.0.1-py3-none-any.whl", hash = "sha256:c4c82a3f962d29314634868e06375f0cb4676c3d5266fbe137f6cd67321b0ef1"}, - {file = "qwasm-1.0.1.tar.gz", hash = "sha256:01f5dfe27159b7fdd9d02cd299833225d528fa383d1278268e5e1526357950fb"}, -] - -[package.dependencies] -setuptools = "*" - -[[package]] -name = "ruff" -version = "0.1.3" -description = "An extremely fast Python linter, written in Rust." -optional = false -python-versions = ">=3.7" -files = [ - {file = "ruff-0.1.3-py3-none-macosx_10_7_x86_64.whl", hash = "sha256:b46d43d51f7061652eeadb426a9e3caa1e0002470229ab2fc19de8a7b0766901"}, - {file = "ruff-0.1.3-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:b8afeb9abd26b4029c72adc9921b8363374f4e7edb78385ffaa80278313a15f9"}, - {file = "ruff-0.1.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ca3cf365bf32e9ba7e6db3f48a4d3e2c446cd19ebee04f05338bc3910114528b"}, - {file = "ruff-0.1.3-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:4874c165f96c14a00590dcc727a04dca0cfd110334c24b039458c06cf78a672e"}, - {file = "ruff-0.1.3-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:eec2dd31eed114e48ea42dbffc443e9b7221976554a504767ceaee3dd38edeb8"}, - {file = "ruff-0.1.3-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:dc3ec4edb3b73f21b4aa51337e16674c752f1d76a4a543af56d7d04e97769613"}, - {file = "ruff-0.1.3-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:2e3de9ed2e39160800281848ff4670e1698037ca039bda7b9274f849258d26ce"}, - {file = "ruff-0.1.3-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:1c595193881922cc0556a90f3af99b1c5681f0c552e7a2a189956141d8666fe8"}, - {file = "ruff-0.1.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0f75e670d529aa2288cd00fc0e9b9287603d95e1536d7a7e0cafe00f75e0dd9d"}, - {file = "ruff-0.1.3-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:76dd49f6cd945d82d9d4a9a6622c54a994689d8d7b22fa1322983389b4892e20"}, - {file = "ruff-0.1.3-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:918b454bc4f8874a616f0d725590277c42949431ceb303950e87fef7a7d94cb3"}, - {file = "ruff-0.1.3-py3-none-musllinux_1_2_i686.whl", hash = "sha256:d8859605e729cd5e53aa38275568dbbdb4fe882d2ea2714c5453b678dca83784"}, - {file = "ruff-0.1.3-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:0b6c55f5ef8d9dd05b230bb6ab80bc4381ecb60ae56db0330f660ea240cb0d4a"}, - {file = "ruff-0.1.3-py3-none-win32.whl", hash = "sha256:3e7afcbdcfbe3399c34e0f6370c30f6e529193c731b885316c5a09c9e4317eef"}, - {file = "ruff-0.1.3-py3-none-win_amd64.whl", hash = "sha256:7a18df6638cec4a5bd75350639b2bb2a2366e01222825562c7346674bdceb7ea"}, - {file = "ruff-0.1.3-py3-none-win_arm64.whl", hash = "sha256:12fd53696c83a194a2db7f9a46337ce06445fb9aa7d25ea6f293cf75b21aca9f"}, - {file = "ruff-0.1.3.tar.gz", hash = "sha256:3ba6145369a151401d5db79f0a47d50e470384d0d89d0d6f7fab0b589ad07c34"}, -] - -[[package]] -name = "scipy" -version = "1.11.3" -description = "Fundamental algorithms for scientific computing in Python" -optional = false -python-versions = "<3.13,>=3.9" -files = [ - {file = "scipy-1.11.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:370f569c57e1d888304052c18e58f4a927338eafdaef78613c685ca2ea0d1fa0"}, - {file = "scipy-1.11.3-cp310-cp310-macosx_12_0_arm64.whl", hash = "sha256:9885e3e4f13b2bd44aaf2a1a6390a11add9f48d5295f7a592393ceb8991577a3"}, - {file = "scipy-1.11.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e04aa19acc324a1a076abb4035dabe9b64badb19f76ad9c798bde39d41025cdc"}, - {file = "scipy-1.11.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3e1a8a4657673bfae1e05e1e1d6e94b0cabe5ed0c7c144c8aa7b7dbb774ce5c1"}, - {file = "scipy-1.11.3-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:7abda0e62ef00cde826d441485e2e32fe737bdddee3324e35c0e01dee65e2a88"}, - {file = "scipy-1.11.3-cp310-cp310-win_amd64.whl", hash = "sha256:033c3fd95d55012dd1148b201b72ae854d5086d25e7c316ec9850de4fe776929"}, - {file = "scipy-1.11.3-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:925c6f09d0053b1c0f90b2d92d03b261e889b20d1c9b08a3a51f61afc5f58165"}, - {file = "scipy-1.11.3-cp311-cp311-macosx_12_0_arm64.whl", hash = "sha256:5664e364f90be8219283eeb844323ff8cd79d7acbd64e15eb9c46b9bc7f6a42a"}, - {file = "scipy-1.11.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:00f325434b6424952fbb636506f0567898dca7b0f7654d48f1c382ea338ce9a3"}, - {file = "scipy-1.11.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5f290cf561a4b4edfe8d1001ee4be6da60c1c4ea712985b58bf6bc62badee221"}, - {file = "scipy-1.11.3-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:91770cb3b1e81ae19463b3c235bf1e0e330767dca9eb4cd73ba3ded6c4151e4d"}, - {file = "scipy-1.11.3-cp311-cp311-win_amd64.whl", hash = "sha256:e1f97cd89c0fe1a0685f8f89d85fa305deb3067d0668151571ba50913e445820"}, - {file = "scipy-1.11.3-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:dfcc1552add7cb7c13fb70efcb2389d0624d571aaf2c80b04117e2755a0c5d15"}, - {file = "scipy-1.11.3-cp312-cp312-macosx_12_0_arm64.whl", hash = "sha256:0d3a136ae1ff0883fffbb1b05b0b2fea251cb1046a5077d0b435a1839b3e52b7"}, - {file = "scipy-1.11.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bae66a2d7d5768eaa33008fa5a974389f167183c87bf39160d3fefe6664f8ddc"}, - {file = "scipy-1.11.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d2f6dee6cbb0e263b8142ed587bc93e3ed5e777f1f75448d24fb923d9fd4dce6"}, - {file = "scipy-1.11.3-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:74e89dc5e00201e71dd94f5f382ab1c6a9f3ff806c7d24e4e90928bb1aafb280"}, - {file = "scipy-1.11.3-cp312-cp312-win_amd64.whl", hash = "sha256:90271dbde4be191522b3903fc97334e3956d7cfb9cce3f0718d0ab4fd7d8bfd6"}, - {file = "scipy-1.11.3-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:a63d1ec9cadecce838467ce0631c17c15c7197ae61e49429434ba01d618caa83"}, - {file = "scipy-1.11.3-cp39-cp39-macosx_12_0_arm64.whl", hash = "sha256:5305792c7110e32ff155aed0df46aa60a60fc6e52cd4ee02cdeb67eaccd5356e"}, - {file = "scipy-1.11.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9ea7f579182d83d00fed0e5c11a4aa5ffe01460444219dedc448a36adf0c3917"}, - {file = "scipy-1.11.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c77da50c9a91e23beb63c2a711ef9e9ca9a2060442757dffee34ea41847d8156"}, - {file = "scipy-1.11.3-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:15f237e890c24aef6891c7d008f9ff7e758c6ef39a2b5df264650eb7900403c0"}, - {file = "scipy-1.11.3-cp39-cp39-win_amd64.whl", hash = "sha256:4b4bb134c7aa457e26cc6ea482b016fef45db71417d55cc6d8f43d799cdf9ef2"}, - {file = "scipy-1.11.3.tar.gz", hash = "sha256:bba4d955f54edd61899776bad459bf7326e14b9fa1c552181f0479cc60a568cd"}, -] - -[package.dependencies] -numpy = ">=1.21.6,<1.28.0" - -[package.extras] -dev = ["click", "cython-lint (>=0.12.2)", "doit (>=0.36.0)", "mypy", "pycodestyle", "pydevtool", "rich-click", "ruff", "types-psutil", "typing_extensions"] -doc = ["jupytext", "matplotlib (>2)", "myst-nb", "numpydoc", "pooch", "pydata-sphinx-theme (==0.9.0)", "sphinx (!=4.1.0)", "sphinx-design (>=0.2.0)"] -test = ["asv", "gmpy2", "mpmath", "pooch", "pytest", "pytest-cov", "pytest-timeout", "pytest-xdist", "scikit-umfpack", "threadpoolctl"] - -[[package]] -name = "setuptools" -version = "68.2.2" -description = "Easily download, build, install, upgrade, and uninstall Python packages" -optional = false -python-versions = ">=3.8" -files = [ - {file = "setuptools-68.2.2-py3-none-any.whl", hash = "sha256:b454a35605876da60632df1a60f736524eb73cc47bbc9f3f1ef1b644de74fd2a"}, - {file = "setuptools-68.2.2.tar.gz", hash = "sha256:4ac1475276d2f1c48684874089fefcd83bd7162ddaafb81fac866ba0db282a87"}, -] - -[package.extras] -docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-hoverxref (<2)", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (>=1,<2)", "sphinx-reredirects", "sphinxcontrib-towncrier"] -testing = ["build[virtualenv]", "filelock (>=3.4.0)", "flake8-2020", "ini2toml[lite] (>=0.9)", "jaraco.develop (>=7.21)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pip (>=19.1)", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-mypy (>=0.9.1)", "pytest-perf", "pytest-ruff", "pytest-timeout", "pytest-xdist", "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.1)", "pytest", "pytest-enabler", "pytest-xdist", "tomli", "virtualenv (>=13.0.0)", "wheel"] - -[[package]] -name = "sympy" -version = "1.12" -description = "Computer algebra system (CAS) in Python" -optional = false -python-versions = ">=3.8" -files = [ - {file = "sympy-1.12-py3-none-any.whl", hash = "sha256:c3588cd4295d0c0f603d0f2ae780587e64e2efeedb3521e46b9bb1d08d184fa5"}, - {file = "sympy-1.12.tar.gz", hash = "sha256:ebf595c8dac3e0fdc4152c51878b498396ec7f30e7a914d6071e674d49420fb8"}, -] - -[package.dependencies] -mpmath = ">=0.19" - -[[package]] -name = "tomli" -version = "2.0.1" -description = "A lil' TOML parser" -optional = false -python-versions = ">=3.7" -files = [ - {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, - {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, -] - -[[package]] -name = "types-pkg-resources" -version = "0.1.3" -description = "Typing stubs for pkg_resources" -optional = false -python-versions = "*" -files = [ - {file = "types-pkg_resources-0.1.3.tar.gz", hash = "sha256:834a9b8d3dbea343562fd99d5d3359a726f6bf9d3733bccd2b4f3096fbab9dae"}, - {file = "types_pkg_resources-0.1.3-py2.py3-none-any.whl", hash = "sha256:0cb9972cee992249f93fff1a491bf2dc3ce674e5a1926e27d4f0866f7d9b6d9c"}, -] - -[[package]] -name = "typing-extensions" -version = "4.8.0" -description = "Backported and Experimental Type Hints for Python 3.8+" -optional = false -python-versions = ">=3.8" -files = [ - {file = "typing_extensions-4.8.0-py3-none-any.whl", hash = "sha256:8f92fc8806f9a6b641eaa5318da32b44d401efaac0f6678c9bc448ba3605faa0"}, - {file = "typing_extensions-4.8.0.tar.gz", hash = "sha256:df8e4339e9cb77357558cbdbceca33c303714cf861d1eef15e1070055ae8b7ef"}, -] - -[metadata] -lock-version = "2.0" -python-versions = "^3.10,<3.12" -content-hash = "39977310b3f63b5ecc392fd34e41b53d89a560c11963772ce5a86f9b11b4bcac" From e37748faf61212a11087b9af0ed27f7b7d9d516d Mon Sep 17 00:00:00 2001 From: Agustin Borgna Date: Fri, 3 Nov 2023 14:34:06 +0000 Subject: [PATCH 11/13] Add ruff checks to `pre-commit` --- .github/pre-commit | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/pre-commit b/.github/pre-commit index d7693569..f02a1536 100755 --- a/.github/pre-commit +++ b/.github/pre-commit @@ -11,8 +11,15 @@ fi if ! cargo fmt -- --check then - echo "There are some code style issues." - echo "Run cargo fmt first." + echo "There are some rust code style issues." + echo "Run `cargo fmt` first." + exit 1 +fi + +if ! ruff format --check . +then + echo "There are some python code style issues." + echo "Run `ruff format .` first." exit 1 fi @@ -28,4 +35,10 @@ then exit 1 fi +if ! ruff check +then + echo "There are some python linting issues." + exit 1 +fi + exit 0 From 315f085967eda2780d620d2768d3c80aa0032100 Mon Sep 17 00:00:00 2001 From: Agustin Borgna Date: Fri, 3 Nov 2023 14:37:13 +0000 Subject: [PATCH 12/13] Drop unrelated `Cargo.toml` changes --- .github/pre-commit | 6 ++++-- Cargo.toml | 3 --- tket2-py/Cargo.toml | 1 - tket2/Cargo.toml | 5 ++++- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/pre-commit b/.github/pre-commit index f02a1536..b5ac4209 100755 --- a/.github/pre-commit +++ b/.github/pre-commit @@ -16,7 +16,8 @@ then exit 1 fi -if ! ruff format --check . +# Run `ruff` python formatting if it is available +if command -v ruff &> /dev/null && ! ruff format --check . then echo "There are some python code style issues." echo "Run `ruff format .` first." @@ -35,7 +36,8 @@ then exit 1 fi -if ! ruff check +# Run `ruff` python linting if it is available +if command -v ruff &> /dev/null && ! ruff check . then echo "There are some python linting issues." exit 1 diff --git a/Cargo.toml b/Cargo.toml index 0d9821f5..b6c886f0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,6 +23,3 @@ pyo3 = { version = "0.20" } itertools = { version = "0.11.0" } tket-json-rs = "0.2.0" tracing = "0.1.37" -portmatching = { git = "https://github.com/lmondada/portmatching", rev = "738c91c", features = [ - "serde", -] } diff --git a/tket2-py/Cargo.toml b/tket2-py/Cargo.toml index 0dc9b67d..b6de354a 100644 --- a/tket2-py/Cargo.toml +++ b/tket2-py/Cargo.toml @@ -22,4 +22,3 @@ pyo3 = { workspace = true, features = ["extension-module"] } num_cpus = "1.16.0" derive_more = "0.99.17" itertools = { workspace = true } -portmatching = { workspace = true } diff --git a/tket2/Cargo.toml b/tket2/Cargo.toml index 712655c1..94328feb 100644 --- a/tket2/Cargo.toml +++ b/tket2/Cargo.toml @@ -37,7 +37,10 @@ typetag = "0.2.8" itertools = { workspace = true } petgraph = { version = "0.6.3", default-features = false } serde_yaml = "0.9.22" -portmatching = { workspace = true, optional = true, features = ["serde"] } +# portmatching = { version = "0.2.0", optional = true, features = ["serde"]} +portmatching = { optional = true, git = "https://github.com/lmondada/portmatching", rev = "738c91c", features = [ + "serde", +] } derive_more = "0.99.17" quantinuum-hugr = { workspace = true } portgraph = { workspace = true, features = ["serde"] } From 0e8aba8c960d2dd300b48dd643b9efee6d26ee4a Mon Sep 17 00:00:00 2001 From: Agustin Borgna Date: Fri, 3 Nov 2023 14:46:50 +0000 Subject: [PATCH 13/13] Drop python version upper limit in poetry config --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index ed961731..58b7864b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,7 @@ readme = "README.md" packages = [{ include = "tket2-py" }] [tool.poetry.dependencies] -python = "^3.10,<3.12" +python = ">=3.10" [tool.poetry.dev-dependencies] maturin = "^1.3.0"