Skip to content
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

feat: Improved representation for metadata in hugr-model #1849

Merged
merged 1 commit into from
Jan 16, 2025

Conversation

zrho
Copy link
Contributor

@zrho zrho commented Jan 8, 2025

Closes #1848 by using a term-based representation for metadata items.

@hugrbot
Copy link
Collaborator

hugrbot commented Jan 8, 2025

This PR contains breaking changes to the public Rust API.
Please deprecate the old API instead (if possible), or mark the PR with a ! to indicate a breaking change.

cargo-semver-checks summary

--- failure enum_variant_added: enum variant added on exhaustive enum ---

Description:
A publicly-visible enum without #[non_exhaustive] has a new variant.
      ref: https://doc.rust-lang.org/cargo/reference/semver.html#enum-variant-new
     impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.38.0/src/lints/enum_variant_added.ron

Failed in:
variant Term:Meta in /home/runner/work/hugr/hugr/PR_BRANCH/hugr-model/src/v0/mod.rs:720

--- failure struct_missing: pub struct removed or renamed ---

Description:
A publicly-visible struct cannot be imported by its prior path. A `pub use` may have been removed, or the struct itself may have been renamed or removed entirely.
      ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
     impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.38.0/src/lints/struct_missing.ron

Failed in:
struct hugr_model::v0::MetaItem, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-model/src/v0/mod.rs:506

Copy link

codecov bot commented Jan 8, 2025

Codecov Report

Attention: Patch coverage is 71.05263% with 11 lines in your changes missing coverage. Please review.

Project coverage is 86.52%. Comparing base (87cb536) to head (06e0f36).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
hugr-core/src/import.rs 66.66% 1 Missing and 2 partials ⚠️
hugr-model/src/v0/binary/write.rs 40.00% 3 Missing ⚠️
hugr-model/src/v0/text/print.rs 60.00% 2 Missing ⚠️
hugr-core/src/export.rs 92.30% 1 Missing ⚠️
hugr-model/src/v0/binary/read.rs 66.66% 1 Missing ⚠️
hugr-model/src/v0/text/parse.rs 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1849      +/-   ##
==========================================
- Coverage   86.54%   86.52%   -0.02%     
==========================================
  Files         194      194              
  Lines       35264    35250      -14     
  Branches    32077    32063      -14     
==========================================
- Hits        30518    30500      -18     
- Misses       2969     2974       +5     
+ Partials     1777     1776       -1     
Flag Coverage Δ
python 92.31% <ø> (ø)
rust 85.94% <71.05%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Moved names for compat.* constructors to model.
@zrho zrho force-pushed the zrho/model-better-meta branch from e1aeb18 to 06e0f36 Compare January 13, 2025 12:39
@zrho zrho marked this pull request as ready for review January 13, 2025 12:50
@zrho zrho requested a review from a team as a code owner January 13, 2025 12:50
@zrho zrho requested a review from croyzor January 13, 2025 12:50
Copy link
Contributor

@croyzor croyzor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zrho zrho added this pull request to the merge queue Jan 16, 2025
Merged via the queue into main with commit b38a2e8 Jan 16, 2025
21 of 23 checks passed
@zrho zrho deleted the zrho/model-better-meta branch January 16, 2025 14:53
@hugrbot hugrbot mentioned this pull request Jan 16, 2025
github-merge-queue bot pushed a commit that referenced this pull request Jan 20, 2025
## 🤖 New release
* `hugr`: 0.14.1 -> 0.14.2 (✓ API compatible changes)
* `hugr-core`: 0.14.1 -> 0.14.2 (✓ API compatible changes)
* `hugr-model`: 0.16.0 -> 0.17.0 (⚠️ API breaking changes)
* `hugr-llvm`: 0.14.1 -> 0.14.2 (✓ API compatible changes)
* `hugr-passes`: 0.14.1 -> 0.14.2 (✓ API compatible changes)
* `hugr-cli`: 0.14.1 -> 0.14.2 (✓ API compatible changes)

### ⚠️ `hugr-model` breaking changes

```
--- failure enum_variant_added: enum variant added on exhaustive enum ---

Description:
A publicly-visible enum without #[non_exhaustive] has a new variant.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#enum-variant-new
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.38.0/src/lints/enum_variant_added.ron

Failed in:
  variant Term:Const in /tmp/.tmpszSQ4r/hugr/hugr-model/src/v0/mod.rs:591
  variant Term:ConstFunc in /tmp/.tmpszSQ4r/hugr/hugr-model/src/v0/mod.rs:697
  variant Term:ConstAdt in /tmp/.tmpszSQ4r/hugr/hugr-model/src/v0/mod.rs:703
  variant Term:Bytes in /tmp/.tmpszSQ4r/hugr/hugr-model/src/v0/mod.rs:711
  variant Term:BytesType in /tmp/.tmpszSQ4r/hugr/hugr-model/src/v0/mod.rs:717
  variant Term:Meta in /tmp/.tmpszSQ4r/hugr/hugr-model/src/v0/mod.rs:720
  variant Operation:Const in /tmp/.tmpszSQ4r/hugr/hugr-model/src/v0/mod.rs:409

--- failure enum_variant_missing: pub enum variant removed or renamed ---

Description:
A publicly-visible enum has at least one variant that is no longer available under its prior name. It may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.38.0/src/lints/enum_variant_missing.ron

Failed in:
  variant Term::Quote, previously in file /tmp/.tmp8fke0a/hugr-model/src/v0/mod.rs:565

--- failure struct_missing: pub struct removed or renamed ---

Description:
A publicly-visible struct cannot be imported by its prior path. A `pub use` may have been removed, or the struct itself may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.38.0/src/lints/struct_missing.ron

Failed in:
  struct hugr_model::v0::MetaItem, previously in file /tmp/.tmp8fke0a/hugr-model/src/v0/mod.rs:500
```

<details><summary><i><b>Changelog</b></i></summary><p>

## `hugr`
<blockquote>

##
[0.14.2](hugr-v0.14.1...hugr-v0.14.2)
- 2025-01-20

### Bug Fixes

- Three bugfixes in model import and export. (#1844)

### Documentation

- Fix typo in `DataflowParent` doc (#1865)

### New Features

- Add CallGraph struct, and dead-function-removal pass (#1796)
- `Value::some`, `::none`, and `SumType::new_option` helpers (#1828)
- Constant values in `hugr-model` (#1838)
- *(hugr-llvm)* Emit ipow (#1839)
- Bytes literal in hugr-model. (#1845)
- Improved representation for metadata in `hugr-model` (#1849)

### Testing

- Add tests for constant value deserialization (#1822)
</blockquote>

## `hugr-core`
<blockquote>

##
[0.14.2](hugr-core-v0.14.1...hugr-core-v0.14.2)
- 2025-01-20

### Bug Fixes

- Three bugfixes in model import and export. (#1844)

### Documentation

- Fix typo in `DataflowParent` doc (#1865)

### New Features

- `Value::some`, `::none`, and `SumType::new_option` helpers (#1828)
- Constant values in `hugr-model` (#1838)
- *(hugr-llvm)* Emit ipow (#1839)
- Bytes literal in hugr-model. (#1845)
- Improved representation for metadata in `hugr-model` (#1849)

### Testing

- Add tests for constant value deserialization (#1822)
</blockquote>

## `hugr-model`
<blockquote>

##
[0.17.0](hugr-model-v0.16.0...hugr-model-v0.17.0)
- 2025-01-20

### Bug Fixes

- Three bugfixes in model import and export. (#1844)

### New Features

- Constant values in `hugr-model` (#1838)
- Bytes literal in hugr-model. (#1845)
- Improved representation for metadata in `hugr-model` (#1849)
</blockquote>

## `hugr-llvm`
<blockquote>

##
[0.14.2](hugr-llvm-v0.14.1...hugr-llvm-v0.14.2)
- 2025-01-20

### New Features

- *(hugr-llvm)* Emit more int ops (#1835)
- Constant values in `hugr-model` (#1838)
- *(hugr-llvm)* Emit ipow (#1839)

### Refactor

- *(hugr-llvm)* [**breaking**] Optimise the llvm types used to represent
hugr sums. (#1855)

### Testing

- Fix failing inot test (#1841)
</blockquote>

## `hugr-passes`
<blockquote>

##
[0.14.2](hugr-passes-v0.14.1...hugr-passes-v0.14.2)
- 2025-01-20

### New Features

- Add CallGraph struct, and dead-function-removal pass (#1796)
</blockquote>

## `hugr-cli`
<blockquote>

##
[0.14.1](hugr-cli-v0.14.0...hugr-cli-v0.14.1)
- 2024-12-18

### New Features

- Print `hugr-cli`'s correct version when using '--version' (#1790)
</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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improved representation for metadata in hugr-model
3 participants