-
Notifications
You must be signed in to change notification settings - Fork 7
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
refactor: Add a hugr-core
crate
#1108
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1108 +/- ##
==========================================
- Coverage 86.78% 86.49% -0.29%
==========================================
Files 90 90
Lines 18549 18502 -47
Branches 18156 18109 -47
==========================================
- Hits 16098 16004 -94
- Misses 1606 1656 +50
+ Partials 845 842 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
hugr-core/src/types.rs
Outdated
@@ -260,15 +260,15 @@ impl TypeEnum { | |||
/// | |||
/// Examples: | |||
/// ``` | |||
/// # use hugr::types::{Type, TypeBound}; | |||
/// # use hugr::type_row; | |||
/// # use hugr_core::types::{Type, TypeBound}; |
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.
examples should not mention hugr_core
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.
Fixed in 0f23521.
Note that example lines starting with a #
are not rendered in the docs, so we don't care whether they use hugr
or hugr_core
.
hugr-core/src/builder.rs
Outdated
//! use hugr::types::FunctionType; | ||
//! # use hugr_core::Hugr; | ||
//! # use hugr_core::builder::{BuildError, BuildHandle, Container, DFGBuilder, Dataflow, DataflowHugr, ModuleBuilder, DataflowSubContainer, HugrBuilder}; | ||
//! use hugr_core::extension::prelude::BOOL_T; |
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.
should these have #
in front of them
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.
I missed module-level docs when searching for examples...
I think these give a bit of context to the example below, so it's fine to have them explicit.
I changed all hugr_core::
uses for hugr::
, to avoid further confusions.
@@ -0,0 +1,163 @@ | |||
//! Extensible, graph-based program representation with first-class support for linear types. |
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.
is this a copy paste of the lib docs? another thing to go out of date potentially?
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.
👍
// proptest-derive generates many of these warnings. | ||
// https://github.com/rust-lang/rust/issues/120363 | ||
// https://github.com/proptest-rs/proptest/issues/447 | ||
#![cfg_attr(test, allow(non_local_definitions))] |
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.
this isn't needed any more?
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 only needed in -core, where we define the proptests
## 🤖 New release * `hugr`: 0.4.0 -> 0.5.0 * `hugr-cli`: 0.1.0 * `hugr-core`: 0.1.0 * `hugr-passes`: 0.1.0 <details><summary><i><b>Changelog</b></i></summary><p> ## `hugr` <blockquote> ## 0.5.0 (2024-05-29) ### Bug Fixes - Missing re-exports in `hugr::hugr` ([#1127](#1127)) - Set initial version of hugr-core to 0.1.0 ([#1129](#1129)) ### Features - [**breaking**] Remove `PartialEq` impl for `ConstF64` ([#1079](#1079)) - [**breaking**] Allow "Row Variables" declared as List<Type> ([#804](#804)) - Hugr binary cli tool ([#1096](#1096)) - [**breaking**] Move passes from `algorithms` into a separate crate ([#1100](#1100)) - [**breaking**] Disallow nonlocal value edges into FuncDefn's ([#1061](#1061)) - [**breaking**] Move cli in to hugr-cli sub-crate ([#1107](#1107)) - Add verbosity, return `Hugr` from `run`. ([#1116](#1116)) - Unseal and make public the traits `HugrInternals` and `HugrMutInternals` ([#1122](#1122)) ### Refactor - [**breaking**] No Ports in TypeRow ([#1087](#1087)) - Add a `hugr-core` crate ([#1108](#1108)) </blockquote> ## `hugr-core` <blockquote> ## 0.1.0 (2024-05-29) ### Bug Fixes - Set initial version of hugr-core to 0.1.0 ([#1129](#1129)) ### Features - [**breaking**] Move cli in to hugr-cli sub-crate ([#1107](#1107)) - Make internals of int ops and the "int" CustomType more public. ([#1114](#1114)) - Unseal and make public the traits `HugrInternals` and `HugrMutInternals` ([#1122](#1122)) ### Refactor - Add a `hugr-core` crate ([#1108](#1108)) </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/MarcoIeni/release-plz/). --------- Co-authored-by: Agustin Borgna <[email protected]>
Moves all the code from
hugr
into ahugr-core
subcrate.This way,
hugr-passes
(and any other new subcrate) can depend on the core definitions and get reexported inhugr
.This PR does not. Change any definition or visibility in the code, as the renamed files are noisy enough.
In particular, having
hugr-core
will let us unsealHugrInternals
andHugrMutInternals
so they can be used intket2
, but that's work for another PR.As a bonus, #1100 is no longer a breaking change since we can re-export the library without a cyclic dependency.
Closes #294