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: Packages in hugr-model and envelope support. #2026

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

zrho
Copy link
Contributor

@zrho zrho commented Mar 25, 2025

This PR adds packages to hugr-model with support for envelopes.

  • Packages for both the AST and table representation of hugr-model.
  • Packages in the Python model classes.
  • Reading and writing model envelopes in Rust.
  • Writing model envelopes in Python.

@hugrbot
Copy link
Collaborator

hugrbot commented Mar 25, 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_missing: pub enum removed or renamed ---

Description:
A publicly-visible enum cannot be imported by its prior path. A `pub use` may have been removed, or the enum 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.40.0/src/lints/enum_missing.ron

Failed in:
enum hugr_core::hugr::rewrite::BoundaryPort, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/port_types.rs:14

--- failure enum_no_repr_variant_discriminant_changed: enum variant had its discriminant change value ---

Description:
The enum's variant had its discriminant value change. This breaks downstream code that used its value via a numeric cast like `as isize`.
      ref: https://doc.rust-lang.org/reference/items/enumerations.html#assigning-discriminant-values
     impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.40.0/src/lints/enum_no_repr_variant_discriminant_changed.ron

Failed in:
variant EnvelopeError::SerdeError 6 -> 5 in /home/runner/work/hugr/hugr/PR_BRANCH/hugr-core/src/envelope.rs:163
variant EnvelopeError::IO 7 -> 6 in /home/runner/work/hugr/hugr/PR_BRANCH/hugr-core/src/envelope.rs:168
variant EnvelopeError::Package 8 -> 7 in /home/runner/work/hugr/hugr/PR_BRANCH/hugr-core/src/envelope.rs:173
variant EnvelopeError::PackageEncoding 9 -> 8 in /home/runner/work/hugr/hugr/PR_BRANCH/hugr-core/src/envelope.rs:178
variant EnvelopeError::ModelImport 10 -> 9 in /home/runner/work/hugr/hugr/PR_BRANCH/hugr-core/src/envelope.rs:184
variant EnvelopeError::ModelRead 11 -> 10 in /home/runner/work/hugr/hugr/PR_BRANCH/hugr-core/src/envelope.rs:190
variant EnvelopeError::ModelWrite 12 -> 11 in /home/runner/work/hugr/hugr/PR_BRANCH/hugr-core/src/envelope.rs:196

--- 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.40.0/src/lints/enum_variant_missing.ron

Failed in:
variant EnvelopeError::MultipleHugrs, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/envelope.rs:167

--- failure function_missing: pub fn removed or renamed ---

Description:
A publicly-visible function cannot be imported by its prior path. A `pub use` may have been removed, or the function 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.40.0/src/lints/function_missing.ron

Failed in:
function hugr_core::import::import_hugr, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/import.rs:83
function hugr_core::export::export_hugr, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/export.rs:31

--- failure inherent_method_missing: pub method removed or renamed ---

Description:
A publicly-visible method or associated fn 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.40.0/src/lints/inherent_method_missing.ron

Failed in:
StaticArrayValue::get_contents, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/std_extensions/collections/static_array.rs:73
SimpleReplacement::into_replacement, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/simple_replace.rs:64
SimpleReplacement::is_valid_rewrite, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/simple_replace.rs:75
SimpleReplacement::get_replacement_io, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/simple_replace.rs:97
SimpleReplacement::incoming_boundary, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/simple_replace.rs:111
SimpleReplacement::outgoing_boundary, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/simple_replace.rs:151
SimpleReplacement::host_to_host_boundary, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/simple_replace.rs:189
SimpleReplacement::map_host_output, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/simple_replace.rs:223
SimpleReplacement::map_replacement_input, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/simple_replace.rs:238
SimpleReplacement::all_boundary_edges, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/simple_replace.rs:253
SimpleReplacement::into_replacement, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/simple_replace.rs:64
SimpleReplacement::is_valid_rewrite, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/simple_replace.rs:75
SimpleReplacement::get_replacement_io, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/simple_replace.rs:97
SimpleReplacement::incoming_boundary, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/simple_replace.rs:111
SimpleReplacement::outgoing_boundary, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/simple_replace.rs:151
SimpleReplacement::host_to_host_boundary, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/simple_replace.rs:189
SimpleReplacement::map_host_output, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/simple_replace.rs:223
SimpleReplacement::map_replacement_input, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/simple_replace.rs:238
SimpleReplacement::all_boundary_edges, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/simple_replace.rs:253
SimpleReplacement::into_replacement, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/simple_replace.rs:64
SimpleReplacement::is_valid_rewrite, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/simple_replace.rs:75
SimpleReplacement::get_replacement_io, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/simple_replace.rs:97
SimpleReplacement::incoming_boundary, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/simple_replace.rs:111
SimpleReplacement::outgoing_boundary, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/simple_replace.rs:151
SimpleReplacement::host_to_host_boundary, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/simple_replace.rs:189
SimpleReplacement::map_host_output, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/simple_replace.rs:223
SimpleReplacement::map_replacement_input, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/simple_replace.rs:238
SimpleReplacement::all_boundary_edges, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/simple_replace.rs:253
SimpleReplacement::into_replacement, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/simple_replace.rs:64
SimpleReplacement::is_valid_rewrite, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/simple_replace.rs:75
SimpleReplacement::get_replacement_io, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/simple_replace.rs:97
SimpleReplacement::incoming_boundary, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/simple_replace.rs:111
SimpleReplacement::outgoing_boundary, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/simple_replace.rs:151
SimpleReplacement::host_to_host_boundary, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/simple_replace.rs:189
SimpleReplacement::map_host_output, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/simple_replace.rs:223
SimpleReplacement::map_replacement_input, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/simple_replace.rs:238
SimpleReplacement::all_boundary_edges, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/simple_replace.rs:253

--- 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.40.0/src/lints/struct_missing.ron

Failed in:
struct hugr_core::hugr::rewrite::HostPort, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/port_types.rs:23
struct hugr_core::hugr::rewrite::ReplacementPort, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/port_types.rs:27

--- failure inherent_method_missing: pub method removed or renamed ---

Description:
A publicly-visible method or associated fn 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.40.0/src/lints/inherent_method_missing.ron

Failed in:
CodegenExtsBuilder::add_static_array_extensions, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-llvm/src/extension/collections/static_array.rs:41
CodegenExtsBuilder::add_default_static_array_extensions, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-llvm/src/extension/collections/static_array.rs:47
CodegenExtsBuilder::add_static_array_extensions, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-llvm/src/extension/collections/static_array.rs:41
CodegenExtsBuilder::add_default_static_array_extensions, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-llvm/src/extension/collections/static_array.rs:47

--- failure module_missing: pub module removed or renamed ---

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

Failed in:
mod hugr_llvm::extension::collections::static_array, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-llvm/src/extension/collections/static_array.rs:1

--- 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.40.0/src/lints/struct_missing.ron

Failed in:
struct hugr_llvm::extension::collections::static_array::StaticArrayCodegenExtension, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-llvm/src/extension/collections/static_array.rs:36
struct hugr_llvm::extension::collections::static_array::DefaultStaticArrayCodegen, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-llvm/src/extension/collections/static_array.rs:342

--- failure trait_missing: pub trait removed or renamed ---

Description:
A publicly-visible trait cannot be imported by its prior path. A `pub use` may have been removed, or the trait 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.40.0/src/lints/trait_missing.ron

Failed in:
trait hugr_llvm::extension::collections::static_array::StaticArrayCodegen, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-llvm/src/extension/collections/static_array.rs:148

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.

2 participants