-
Notifications
You must be signed in to change notification settings - Fork 13
feat: Version number in hugr binary format. #2468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2468 +/- ##
==========================================
- Coverage 82.39% 82.27% -0.12%
==========================================
Files 248 250 +2
Lines 46339 46502 +163
Branches 41911 42071 +160
==========================================
+ Hits 38180 38261 +81
- Misses 6112 6191 +79
- Partials 2047 2050 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
hugr-model/src/v0/mod.rs
Outdated
| /// The current major version of the `hugr-model` format. | ||
| pub const VERSION_MAJOR: u32 = 0; | ||
|
|
||
| /// The current minor version of the `hugr-model` format. | ||
| pub const VERSION_MINOR: u32 = 0; | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add the current version to the main crate doc, and explain the update/compatibility policy.
I'd also like to enforce we update the version in CI, so it would be better to have a single source of truth for these. Could we have a version.txt that get's include!d and parsed here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where should that version.txt live?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the crate's root, along the Cargo.toml and README.md.
It should normally be included in the packaged crate, but you can check with cargo package --list to verify.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps a name like MODEL_VERSION may be more clear
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's now hugr_model::Version::current(). Alright with you?
2706693 to
796e968
Compare
aborgna-q
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
| .trim() | ||
| .parse() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a const trim_ascii, but const u32::from_ascii is still in nightly u.u
This release fixes multiple inconsistencies between the serialization formats and improves the error messages when loading unsupported envelopes. We now also support nodes with up to `2^32` connections to the same port (up from `2^16`). --- ## 🤖 New release * `hugr-model`: 0.21.0 -> 0.22.0 (✓ API compatible changes) * `hugr-core`: 0.21.0 -> 0.22.0 (✓ API compatible changes) * `hugr-llvm`: 0.21.0 -> 0.22.0 (✓ API compatible changes) * `hugr-passes`: 0.21.0 -> 0.22.0 (✓ API compatible changes) * `hugr-persistent`: 0.1.0 -> 0.2.0 (✓ API compatible changes) * `hugr`: 0.21.0 -> 0.22.0 (✓ API compatible changes) * `hugr-cli`: 0.21.0 -> 0.22.0 (✓ API compatible changes) <details><summary><i><b>Changelog</b></i></summary><p> ## `hugr-model` <blockquote> ## [0.22.0](hugr-model-v0.21.0...hugr-model-v0.22.0) - 2025-07-24 ### New Features - Names of private functions become `core.title` metadata. ([#2448](#2448)) - include generator metatada in model import and cli validate errors ([#2452](#2452)) - Version number in hugr binary format. ([#2468](#2468)) - Use semver crate for -model version, and include in docs ([#2471](#2471)) </blockquote> ## `hugr-core` <blockquote> ## [0.22.0](hugr-core-v0.21.0...hugr-core-v0.22.0) - 2025-07-24 ### Bug Fixes - Ensure SumTypes have the same json encoding in -rs and -py ([#2465](#2465)) ### New Features - Export entrypoint metadata in Python and fix bug in import ([#2434](#2434)) - Names of private functions become `core.title` metadata. ([#2448](#2448)) - [**breaking**] Use binary envelopes for operation lower_func encoding ([#2447](#2447)) - [**breaking**] Update portgraph dependency to 0.15 ([#2455](#2455)) - Detect and fail on unrecognised envelope flags ([#2453](#2453)) - include generator metatada in model import and cli validate errors ([#2452](#2452)) - [**breaking**] Add `insert_region` to HugrMut ([#2463](#2463)) - Non-region entrypoints in `hugr-model`. ([#2467](#2467)) </blockquote> ## `hugr-llvm` <blockquote> ## [0.21.0](hugr-llvm-v0.20.2...hugr-llvm-v0.21.0) - 2025-07-09 ### New Features - [**breaking**] No nested FuncDefns (or AliasDefns) ([#2256](#2256)) - [**breaking**] Split `TypeArg::Sequence` into tuples and lists. ([#2140](#2140)) - [**breaking**] More helpful error messages in model import ([#2272](#2272)) - [**breaking**] Merge `TypeParam` and `TypeArg` into one `Term` type in Rust ([#2309](#2309)) - Add `MakeError` op ([#2377](#2377)) </blockquote> ## `hugr-passes` <blockquote> ## [0.22.0](hugr-passes-v0.21.0...hugr-passes-v0.22.0) - 2025-07-24 ### New Features - ReplaceTypes allows linearizing inside Op replacements ([#2435](#2435)) - Add pass for DFG inlining ([#2460](#2460)) </blockquote> ## `hugr-persistent` <blockquote> ## [0.2.0](hugr-persistent-v0.1.0...hugr-persistent-v0.2.0) - 2025-07-24 ### New Features - [**breaking**] Update portgraph dependency to 0.15 ([#2455](#2455)) </blockquote> ## `hugr` <blockquote> ## [0.22.0](hugr-v0.21.0...hugr-v0.22.0) - 2025-07-24 ### Bug Fixes - Ensure SumTypes have the same json encoding in -rs and -py ([#2465](#2465)) ### New Features - ReplaceTypes allows linearizing inside Op replacements ([#2435](#2435)) - Add pass for DFG inlining ([#2460](#2460)) - Export entrypoint metadata in Python and fix bug in import ([#2434](#2434)) - Names of private functions become `core.title` metadata. ([#2448](#2448)) - [**breaking**] Use binary envelopes for operation lower_func encoding ([#2447](#2447)) - [**breaking**] Update portgraph dependency to 0.15 ([#2455](#2455)) - Detect and fail on unrecognised envelope flags ([#2453](#2453)) - include generator metatada in model import and cli validate errors ([#2452](#2452)) - [**breaking**] Add `insert_region` to HugrMut ([#2463](#2463)) - Non-region entrypoints in `hugr-model`. ([#2467](#2467)) </blockquote> ## `hugr-cli` <blockquote> ## [0.22.0](hugr-cli-v0.21.0...hugr-cli-v0.22.0) - 2025-07-24 ### New Features - include generator metatada in model import and cli validate errors ([#2452](#2452)) </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/release-plz/release-plz/). --------- Co-authored-by: Agustín Borgna <[email protected]>
## 🤖 New release * `hugr-model`: 0.22.0 -> 0.22.1 * `hugr-core`: 0.22.0 -> 0.22.1 * `hugr-llvm`: 0.22.0 -> 0.22.1 * `hugr-passes`: 0.22.0 -> 0.22.1 (✓ API compatible changes) * `hugr`: 0.22.0 -> 0.22.1 (✓ API compatible changes) * `hugr-cli`: 0.22.0 -> 0.22.1 * `hugr-persistent`: 0.2.0 -> 0.2.1 <details><summary><i><b>Changelog</b></i></summary><p> ## `hugr-model` <blockquote> ## [0.22.0](hugr-model-v0.21.0...hugr-model-v0.22.0) - 2025-07-24 ### New Features - Names of private functions become `core.title` metadata. ([#2448](#2448)) - include generator metatada in model import and cli validate errors ([#2452](#2452)) - Version number in hugr binary format. ([#2468](#2468)) - Use semver crate for -model version, and include in docs ([#2471](#2471)) </blockquote> ## `hugr-core` <blockquote> ## [0.22.0](hugr-core-v0.21.0...hugr-core-v0.22.0) - 2025-07-24 ### Bug Fixes - Ensure SumTypes have the same json encoding in -rs and -py ([#2465](#2465)) ### New Features - Export entrypoint metadata in Python and fix bug in import ([#2434](#2434)) - Names of private functions become `core.title` metadata. ([#2448](#2448)) - [**breaking**] Use binary envelopes for operation lower_func encoding ([#2447](#2447)) - [**breaking**] Update portgraph dependency to 0.15 ([#2455](#2455)) - Detect and fail on unrecognised envelope flags ([#2453](#2453)) - include generator metatada in model import and cli validate errors ([#2452](#2452)) - [**breaking**] Add `insert_region` to HugrMut ([#2463](#2463)) - Non-region entrypoints in `hugr-model`. ([#2467](#2467)) </blockquote> ## `hugr-llvm` <blockquote> ## [0.21.0](hugr-llvm-v0.20.2...hugr-llvm-v0.21.0) - 2025-07-09 ### New Features - [**breaking**] No nested FuncDefns (or AliasDefns) ([#2256](#2256)) - [**breaking**] Split `TypeArg::Sequence` into tuples and lists. ([#2140](#2140)) - [**breaking**] More helpful error messages in model import ([#2272](#2272)) - [**breaking**] Merge `TypeParam` and `TypeArg` into one `Term` type in Rust ([#2309](#2309)) - Add `MakeError` op ([#2377](#2377)) </blockquote> ## `hugr-passes` <blockquote> ## [0.22.1](hugr-passes-v0.22.0...hugr-passes-v0.22.1) - 2025-07-28 ### New Features - Include copy_discard_array in DelegatingLinearizer::default ([#2479](#2479)) - Inline calls to functions not on cycles in the call graph ([#2450](#2450)) </blockquote> ## `hugr` <blockquote> ## [0.22.1](hugr-v0.22.0...hugr-v0.22.1) - 2025-07-28 ### New Features - Include copy_discard_array in DelegatingLinearizer::default ([#2479](#2479)) - Inline calls to functions not on cycles in the call graph ([#2450](#2450)) </blockquote> ## `hugr-cli` <blockquote> ## [0.22.0](hugr-cli-v0.21.0...hugr-cli-v0.22.0) - 2025-07-24 ### New Features - include generator metatada in model import and cli validate errors ([#2452](#2452)) </blockquote> ## `hugr-persistent` <blockquote> ## [0.2.0](hugr-persistent-v0.1.0...hugr-persistent-v0.2.0) - 2025-07-24 ### New Features - [**breaking**] Update portgraph dependency to 0.15 ([#2455](#2455)) </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/release-plz/release-plz/).
This PR adds a (major, minor) version number to the binary hugr format and validates it on import.