Skip to content

Commit

Permalink
chore!: bump hugr version to 0.10.0 (#508)
Browse files Browse the repository at this point in the history
We remove the cli of tket2-hseries, as the upstream API has changed and
we no longer expect to use this.

BREAKING CHANGE: increased minimum required version of hugr to 0.9.0
  • Loading branch information
doug-q authored Jul 29, 2024
1 parent e272cf7 commit eca258b
Show file tree
Hide file tree
Showing 24 changed files with 71 additions and 245 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ lcov.info

# python hypothesis testing
.hypothesis

# local cargo config
/.cargo/config.toml
68 changes: 6 additions & 62 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ missing_docs = "warn"
[workspace.dependencies]

# Make sure to run `just recompile-eccs` if the hugr serialisation format changes.
hugr = "0.9.1"
hugr-cli = "0.2.1"
hugr-core = "0.6.1"
hugr = "0.10.0"
hugr-core = "0.7.0"
portgraph = "0.12"
pyo3 = "0.21.2"
itertools = "0.13.0"
Expand Down Expand Up @@ -58,7 +57,6 @@ rmp-serde = "1.1.2"
rstest = "0.19.0"
serde = "1.0"
serde_json = "1.0"
serde_yaml = "0.9.22"
smol_str = "0.2.0"
strum = "0.26.3"
strum_macros = "0.26.4"
Expand Down
35 changes: 19 additions & 16 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ python = "^3.10"
# Poetry does not currently follow PEP 621, it will be supported on poetry 2
# https://github.com/python-poetry/poetry/issues/3332
pytket = "1.30.0"
hugr = "^0.4.0"
hugr = "^0.5.0"

[tool.poetry.group.dev.dependencies]
maturin = "^1.7.0"
Expand All @@ -41,7 +41,7 @@ mypy = "^1.11.0"
hypothesis = "^6.108.5"
graphviz = "^0.20"
pre-commit = "^3.8.0"
guppylang = "^0.7.0"
guppylang = {git = "https://github.com/CQCL/guppylang", branch = "doug/hugr-0.10.0"}

[build-system]
requires = ["maturin~=1.7"]
Expand Down Expand Up @@ -74,7 +74,7 @@ requires-python = ">=3.10"
license = { file = "LICENCE" }

# Note: Be sure to update the dependency versions in [tool.poetry.dependencies] as well
dependencies = ['pytket >= 1.29.2, < 2', 'hugr >= 0.4.0, < 0.5']
dependencies = ['pytket >= 1.29.2, < 2', 'hugr >= 0.5.0, < 0.6']

[project.urls]
homepage = "https://github.com/CQCL/tket2"
Expand Down
Binary file modified test_files/eccs/nam_4_2.rwr
Binary file not shown.
Binary file modified test_files/eccs/nam_6_3.rwr
Binary file not shown.
Binary file modified test_files/eccs/small_eccs.rwr
Binary file not shown.
10 changes: 0 additions & 10 deletions tket2-hseries/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,9 @@ description = "TKET2 tool for preparing and validating `Hugr`s for compilation t
keywords = ["Quantum", "Quantinuum"]
categories = ["compilers"]

[features]
default = ["cli"]
cli = ["dep:hugr-cli", "dep:clap"]

[dependencies]
hugr.workspace = true
hugr-cli = { workspace = true, optional = true }
tket2 = { path = "../tket2", version = "0.1.0-alpha.1" }
clap = { workspace = true, optional = true, features = ["derive"] }
lazy_static.workspace = true
serde = { workspace = true, features = ["derive"] }
serde_json.workspace = true
Expand All @@ -34,7 +28,3 @@ cool_asserts.workspace = true

[lints]
workspace = true

[[bin]]
name = "tket2-hseries"
required-features = ["cli"]
50 changes: 0 additions & 50 deletions tket2-hseries/src/cli.rs

This file was deleted.

29 changes: 9 additions & 20 deletions tket2-hseries/src/extension/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use hugr::types::Signature;
use hugr::{
builder::{BuildError, Dataflow},
extension::{
prelude::{self, BOOL_T, PRELUDE, STRING_CUSTOM_TYPE},
prelude::{self, BOOL_T, PRELUDE},
simple_op::{try_from_name, MakeExtensionOp, MakeOpDef, MakeRegisteredOp, OpLoadError},
ExtensionId, ExtensionRegistry, ExtensionSet, OpDef, SignatureFunc,
},
Expand All @@ -20,10 +20,7 @@ use hugr::{
},
},
type_row,
types::{
type_param::{CustomTypeArg, TypeParam},
PolyFuncType, Type, TypeArg,
},
types::{type_param::TypeParam, PolyFuncType, Type, TypeArg},
Extension, Wire,
};

Expand Down Expand Up @@ -170,12 +167,8 @@ impl ResultOpDef {
}

fn result_signature(&self) -> SignatureFunc {
let string_param = TypeParam::Opaque {
ty: STRING_CUSTOM_TYPE,
};

PolyFuncType::new(
[vec![string_param], self.type_params()].concat(),
[vec![TypeParam::String], self.type_params()].concat(),
Signature::new(self.arg_type(), type_row![]),
)
.into()
Expand Down Expand Up @@ -297,17 +290,15 @@ fn concrete_result_op_type_args(
args: &[TypeArg],
) -> Result<(String, Option<u64>, Option<u64>), OpLoadError> {
let err = || hugr::extension::SignatureError::InvalidTypeArgs.into();
let extract_string =
|arg: &CustomTypeArg| arg.value.as_str().map(|s| s.to_string()).ok_or(err());
match args {
[TypeArg::Opaque { arg }] => Ok((extract_string(arg)?, None, None)),
[TypeArg::String { arg }] => Ok((arg.to_owned(), None, None)),

[TypeArg::Opaque { arg }, TypeArg::BoundedNat { n }] => {
Ok((extract_string(arg)?, Some(*n), None))
[TypeArg::String { arg }, TypeArg::BoundedNat { n }] => {
Ok((arg.to_owned(), Some(*n), None))
}

[TypeArg::Opaque { arg }, TypeArg::BoundedNat { n }, TypeArg::BoundedNat { n: m }] => {
Ok((extract_string(arg)?, Some(*n), Some(*m)))
[TypeArg::String { arg }, TypeArg::BoundedNat { n }, TypeArg::BoundedNat { n: m }] => {
Ok((arg.to_owned(), Some(*n), Some(*m)))
}

_ => Err(err()),
Expand All @@ -333,9 +324,7 @@ impl MakeExtensionOp for ResultOp {
}

fn type_args(&self) -> Vec<TypeArg> {
let mut type_args = vec![TypeArg::Opaque {
arg: CustomTypeArg::new(STRING_CUSTOM_TYPE, self.tag.clone().into()).unwrap(),
}];
let mut type_args = vec![self.tag.clone().into()];

match self.args {
ResultArgs::Simple(_) => {}
Expand Down
Loading

0 comments on commit eca258b

Please sign in to comment.