-
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b709998
refactor: Add a `hugr-core` crate
aborgna-q 0d58e56
Configure CI/metadata for the new package
aborgna-q 5dec197
Simplify README, with less text to go stale
aborgna-q b2ef149
Cleanup main crate docs
aborgna-q 0f23521
Use main crate in doc examples
aborgna-q 407bb18
Fix incorrect feature name
aborgna-q 2cc8776
Simplify hugr-core crate doc
aborgna-q 008e635
Move lint config to workspace Cargo.toml
aborgna-q dc4341b
s/hugr_core::/hugr::/ in all examples
aborgna-q File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
|
||
rust: | ||
- "hugr/**" | ||
- "hugr-passes/**" | ||
- "hugr-*/**" | ||
- "Cargo.toml" | ||
- "specification/schema/**" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Changelog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
[package] | ||
name = "hugr-core" | ||
version = "0.0.0" | ||
edition = { workspace = true } | ||
rust-version = { workspace = true } | ||
|
||
license = { workspace = true } | ||
readme = "README.md" | ||
documentation = "https://docs.rs/hugr/" | ||
homepage = { workspace = true } | ||
repository = { workspace = true } | ||
description = "Quantinuum's Hierarchical Unified Graph Representation" | ||
keywords = ["Quantum", "Quantinuum"] | ||
categories = ["compilers"] | ||
|
||
[lints] | ||
workspace = true | ||
|
||
[features] | ||
extension_inference = [] | ||
cli = ["dep:clap", "dep:clap-stdin"] | ||
|
||
[dependencies] | ||
portgraph = { workspace = true, features = ["serde", "petgraph"] } | ||
thiserror = { workspace = true } | ||
regex = { workspace = true } | ||
cgmath = { workspace = true, features = ["serde"] } | ||
num-rational = { workspace = true, features = ["serde"] } | ||
downcast-rs = { workspace = true } | ||
# Rc used here for Extension, but unfortunately we must turn the feature on globally | ||
serde = { workspace = true, features = ["derive", "rc"] } | ||
serde_yaml = { workspace = true } | ||
typetag = { workspace = true } | ||
smol_str = { workspace = true, features = ["serde"] } | ||
derive_more = { workspace = true } | ||
itertools = { workspace = true } | ||
html-escape = { workspace = true } | ||
bitvec = { workspace = true, features = ["serde"] } | ||
enum_dispatch = { workspace = true } | ||
lazy_static = { workspace = true } | ||
petgraph = { workspace = true } | ||
context-iterators = { workspace = true } | ||
serde_json = { workspace = true } | ||
delegate = { workspace = true } | ||
paste = { workspace = true } | ||
strum = { workspace = true } | ||
strum_macros = { workspace = true } | ||
clap = { workspace = true, features = ["derive"], optional = true } | ||
clap-stdin = { workspace = true, optional = true } | ||
|
||
[dev-dependencies] | ||
rstest = { workspace = true } | ||
webbrowser = { workspace = true } | ||
urlencoding = { workspace = true } | ||
cool_asserts = { workspace = true } | ||
insta = { workspace = true, features = ["yaml"] } | ||
jsonschema = { workspace = true } | ||
proptest = { workspace = true } | ||
proptest-derive = { workspace = true } | ||
regex-syntax = { workspace = true } | ||
assert_cmd = { workspace = true } | ||
predicates = { workspace = true } | ||
assert_fs = { workspace = true } | ||
|
||
# Required for documentation examples | ||
hugr = { path = "../hugr" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
![](/hugr/assets/hugr_logo.svg) | ||
|
||
hugr-core | ||
=============== | ||
|
||
[![build_status][]](https://github.com/CQCL/hugr/actions) | ||
[![crates][]](https://crates.io/crates/hugr-core) | ||
[![msrv][]](https://github.com/CQCL/hugr) | ||
[![codecov][]](https://codecov.io/gh/CQCL/hugr) | ||
|
||
Internal core definitions for the `hugr` package. | ||
Refer to the [main crate](http://crates.io/crates/hugr) for more information. | ||
|
||
Please read the [API documentation here][]. | ||
|
||
## Experimental Features | ||
|
||
- `extension_inference`: | ||
Experimental feature which allows automatic inference of extension usages and | ||
requirements in a HUGR and validation that extensions are correctly specified. | ||
Not enabled by default. | ||
|
||
## Recent Changes | ||
|
||
See [CHANGELOG][] for a list of changes. The minimum supported rust | ||
version will only change on major releases. | ||
|
||
## Development | ||
|
||
See [DEVELOPMENT.md](https://github.com/CQCL/hugr/blob/main/DEVELOPMENT.md) for instructions on setting up the development environment. | ||
|
||
## License | ||
|
||
This project is licensed under Apache License, Version 2.0 ([LICENSE][] or http://www.apache.org/licenses/LICENSE-2.0). | ||
|
||
[API documentation here]: https://docs.rs/hugr-core/ | ||
[build_status]: https://github.com/CQCL/hugr/actions/workflows/ci-rs.yml/badge.svg?branch=main | ||
[msrv]: https://img.shields.io/badge/rust-1.75.0%2B-blue.svg | ||
[crates]: https://img.shields.io/crates/v/hugr-core | ||
[codecov]: https://img.shields.io/codecov/c/gh/CQCL/hugr?logo=codecov | ||
[LICENSE]: https://github.com/CQCL/hugr/blob/main/LICENCE | ||
[CHANGELOG]: https://github.com/CQCL/hugr/blob/main/hugr-core/CHANGELOG.md |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...ts/hugr__hugr__views__tests__dot_cfg.snap → ...gr_core__hugr__views__tests__dot_cfg.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ts/hugr__hugr__views__tests__dot_dfg.snap → ...gr_core__hugr__views__tests__dot_dfg.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
source: hugr/views/tests.rs | ||
source: hugr-core/views/tests.rs | ||
expression: h.dot_string() | ||
--- | ||
digraph { | ||
|
2 changes: 1 addition & 1 deletion
2
...r__hugr__views__tests__dot_empty_dfg.snap → ...e__hugr__views__tests__dot_empty_dfg.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ts/hugr__hugr__views__tests__mmd_cfg.snap → ...gr_core__hugr__views__tests__mmd_cfg.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ts/hugr__hugr__views__tests__mmd_dfg.snap → ...gr_core__hugr__views__tests__mmd_dfg.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...r__hugr__views__tests__mmd_empty_dfg.snap → ...e__hugr__views__tests__mmd_empty_dfg.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
//! Extensible, graph-based program representation with first-class support for linear types. | ||
//! | ||
//! This crate contains the core definitions for the HUGR representation. | ||
//! See the [top-level crate documentation](https://docs.rs/hugr/latest/hugr/) for more information. | ||
|
||
// 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))] | ||
|
||
pub mod builder; | ||
pub mod core; | ||
pub mod extension; | ||
pub mod hugr; | ||
pub mod macros; | ||
pub mod ops; | ||
pub mod std_extensions; | ||
pub mod types; | ||
pub mod utils; | ||
|
||
pub use crate::core::{ | ||
CircuitUnit, Direction, IncomingPort, Node, NodeIndex, OutgoingPort, Port, PortIndex, Wire, | ||
}; | ||
pub use crate::extension::Extension; | ||
pub use crate::hugr::{Hugr, HugrView, SimpleReplacement}; | ||
|
||
#[cfg(feature = "cli")] | ||
pub mod cli; | ||
|
||
#[cfg(test)] | ||
pub mod proptest; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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?