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!: remove the Eq type bound. #1364

Merged
merged 11 commits into from
Jul 26, 2024
Merged

feat!: remove the Eq type bound. #1364

merged 11 commits into from
Jul 26, 2024

Conversation

ss2165
Copy link
Member

@ss2165 ss2165 commented Jul 25, 2024

Closes #1351

BREAKING CHANGE: Eq type bound removed. References to Eq in serialized HUGRs will be treated as Copyable.

@ss2165 ss2165 added the breaking-change Changes that break semver label Jul 25, 2024
@ss2165 ss2165 requested a review from a team as a code owner July 25, 2024 14:11
@ss2165 ss2165 requested a review from mark-koch July 25, 2024 14:11
Copy link

codecov bot commented Jul 25, 2024

Codecov Report

Attention: Patch coverage is 91.89189% with 3 lines in your changes missing coverage. Please review.

Project coverage is 87.65%. Comparing base (657cbb0) to head (5516fdb).

Files Patch % Lines
hugr-py/src/hugr/serialization/tys.py 0.00% 2 Missing ⚠️
hugr-core/src/ops/constant.rs 66.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1364   +/-   ##
=======================================
  Coverage   87.65%   87.65%           
=======================================
  Files         113      113           
  Lines       20027    20030    +3     
  Branches    17760    17764    +4     
=======================================
+ Hits        17554    17557    +3     
  Misses       1698     1698           
  Partials      775      775           
Flag Coverage Δ
python 91.52% <0.00%> (-0.01%) ⬇️
rust 87.15% <97.14%> (+<0.01%) ⬆️

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.

Copy link
Collaborator

@aborgna-q aborgna-q left a comment

Choose a reason for hiding this comment

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

The schema version update is missing things (updating the version tags in the generated jsons, both in the hugr def and in hugr-py). This will probably fail in ci due to the mismatched schema file version vs hugr.get_serialisation_version().

Is this PR meant to complement #1352?

@@ -79,7 +79,7 @@ macro_rules! include_schema {
static ref $name: NamedSchema =
NamedSchema::new("$name", {
let schema_val: serde_json::Value = serde_json::from_str(include_str!(
concat!("../../../../specification/schema/", $path, "_v2.json")
concat!("../../../../specification/schema/", $path, "_v4.json")
Copy link
Collaborator

Choose a reason for hiding this comment

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

v3 is not even merged (#1352) and we are pushing for v4 already? :P

Copy link
Member Author

Choose a reason for hiding this comment

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

yes this is assuming 1352 goes in first

Copy link
Member Author

@ss2165 ss2165 Jul 25, 2024

Choose a reason for hiding this comment

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

shall we just include this in the v3 change?

Copy link
Member Author

@ss2165 ss2165 Jul 25, 2024

Choose a reason for hiding this comment

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

have reverted schema version bump pending #1352

Copy link
Collaborator

@aborgna-q aborgna-q Jul 25, 2024

Choose a reason for hiding this comment

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

👍
If this goes in the same release we should do a single version bump.

hugr-core/src/types/poly_func.rs Outdated Show resolved Hide resolved
hugr-core/src/types/poly_func.rs Outdated Show resolved Hide resolved
@@ -381,18 +381,17 @@ def deserialize(self) -> tys.PolyFuncType:


class TypeBound(Enum):
Eq = "E"
Copyable = "C"
Any = "A"

@staticmethod
def join(*bs: TypeBound) -> TypeBound:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not covered by tests?

Copy link
Member Author

Choose a reason for hiding this comment

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

probably pulled in from guppy, new issue : #1365

specification/hugr.md Outdated Show resolved Hide resolved
ss2165 and others added 2 commits July 25, 2024 16:04
Co-authored-by: Agustín Borgna <121866228+aborgna-q@users.noreply.github.com>
@ss2165 ss2165 removed the request for review from mark-koch July 25, 2024 16:15
aborgna-q and others added 4 commits July 26, 2024 15:10
This is a patch release including only some non-breaking changes since
0.9.0.

## New release
* `hugr`: 0.9.0 -> 0.9.1
* `hugr-core`: 0.6.0 -> 0.6.1
* `hugr-passes`: 0.6.0 -> 0.6.1
* `hugr-cli`: 0.2.0 -> 0.2.1

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

## `hugr`
<blockquote>

## 0.9.1 (2024-07-25)

### Bug Fixes

- Dfg wrapper build handles incorrect output wire numbers
([#1332](#1332))
- Sibling extension panics while computing signature with non-dataflow
nodes ([#1350](#1350))
</blockquote>

## `hugr-core`
<blockquote>

## 0.6.1 (2024-07-25)

### Bug Fixes

- Dfg wrapper build handles incorrect output wire numbers
([#1332](#1332))
- Sibling extension panics while computing signature with non-dataflow
nodes ([#1350](#1350))
</blockquote>

## `hugr-passes`
<blockquote>

## 0.6.1 (2024-07-25)

Nothing here.
</blockquote>

## `hugr-cli`
<blockquote>

## 0.2.1 (2024-07-25)

Nothing here.
</blockquote>


</p></details>

---
This PR was generated by a human.

---------

Co-authored-by: Seyon Sivarajah <seyon.sivarajah@quantinuum.com>
Updates the instructions to use `release-plz` locally. This is easier
and less error prone, since it can reuse the configuration used for
normal releases.
Closes #248 

There are still some visual glitches, but it should be more readable
now.

Adds two invisible order edges to the input nodes, changing this
```mermaid
flowchart
    subgraph CFG
        direction TB
        subgraph Entry
            direction TB
            EntryIn["Input"] -- "P" --> Entry_["P?1"]
            Entry_ -- "[()|(P)]" --> EntryOut["Output"]
            F
        end
        subgraph BB1
            direction TB
            BB1In["Input"]
            BB1_["Const"] -- "[()]" --> BB1Out["Output"]
            G -- "angle" --> BB1Out
        end
        subgraph BB2
            direction TB
            BB2In["Input"] -- "P" --> H -- "P" --> BB2_["P?2"]
            BB2_ -- "[()|()]" --> BB2Out["Output"]
        end
        subgraph BB3
            direction TB
            BB3In["Input"]
            BB3_["Const"] -- "[()]" --> BB3Out["Output"]
            C -- "angle" --> BB3Out
        end
        subgraph Exit
        end
        Entry -- "0" --> BB1
        Entry -- "1" --> BB2
        BB2 -- "0" --> BB1
        BB2 -- "1" --> BB3
        BB1 -- "0" --> Exit
        BB3 -- "0" --> Exit
    end
    A -- "P" --> CFG
    A -- "qubit" --> Rz_out["Rz"]
    CFG -- "angle" --> Rz_out
    Rz_out -- "qubit" --> B
    A == "angle" ==> F
    F == "angle" ==> G
    linkStyle 12,13,14,15,16,17 stroke:#ff3,stroke-width:4px;
```
into this
```mermaid
flowchart
    subgraph CFG
        direction TB
        subgraph Entry
            direction TB
            EntryIn["Input"] -- "P" --> Entry_["P?1"]
            Entry_ -- "[()|(P)]" --> EntryOut["Output"]
            F
        end
        subgraph BB1
            direction TB
            BB1In["Input"]
            BB1_["Const"] -- "[()]" --> BB1Out["Output"]
            G -- "angle" --> BB1Out
            BB1In ~~~ G
        end
        subgraph BB2
            direction TB
            BB2In["Input"] -- "P" --> H -- "P" --> BB2_["P?2"]
            BB2_ -- "[()|()]" --> BB2Out["Output"]
        end
        subgraph BB3
            direction TB
            BB3In["Input"]
            BB3_["Const"] -- "[()]" --> BB3Out["Output"]
            C -- "angle" --> BB3Out
            BB3In ~~~ C
        end
        subgraph Exit
        end
        Entry -- "0" --> BB1
        Entry -- "1" --> BB2
        BB2 -- "0" --> BB1
        BB2 -- "1" --> BB3
        BB1 -- "0" --> Exit
        BB3 -- "0" --> Exit
    end
    A -- "P" --> CFG
    A -- "qubit" --> Rz_out["Rz"]
    CFG -- "angle" --> Rz_out
    Rz_out -- "qubit" --> B
    A == "angle" ==> F
    F == "angle" ==> G
    linkStyle 12,13,14,15,16,17 stroke:#ff3,stroke-width:4px;
```
Since we are breaking serialisation I edited most test cases to use v3.
The single test case which I deleted was testing that we were able to l
deserialise from an older version, so is now redundant. This should have
been done when removing `CustomTypeArg`.

BREAKING CHANGE: All Hugrs serialised with earlier versions will fail to
deserialise

---------

Co-authored-by: Agustín Borgna <121866228+aborgna-q@users.noreply.github.com>
Co-authored-by: Seyon Sivarajah <seyon.sivarajah@quantinuum.com>
@ss2165 ss2165 requested a review from cqc-alec as a code owner July 26, 2024 14:10
@ss2165 ss2165 removed the request for review from cqc-alec July 26, 2024 14:20
@ss2165 ss2165 added this pull request to the merge queue Jul 26, 2024
Merged via the queue into main with commit 1218d21 Jul 26, 2024
22 checks passed
@ss2165 ss2165 deleted the ss/no-eq branch July 26, 2024 14:25
This was referenced Jul 26, 2024
github-merge-queue bot pushed a commit that referenced this pull request Jul 29, 2024
## 🤖 New release
* `hugr`: 0.9.1 -> 0.10.0
* `hugr-core`: 0.6.1 -> 0.7.0
* `hugr-passes`: 0.6.1 -> 0.6.2
* `hugr-cli`: 0.2.1 -> 0.3.0

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

## `hugr`
<blockquote>

## 0.10.0 (2024-07-26)

### Bug Fixes

(#1350))
- [**breaking**] Bump serialisation version with no upgrade path
([#1352](#1352))

### Features

- Add `nonlocal_edges` and `ensure_no_nonlocal_edges`
([#1345](#1345))
- Serialization upgrade path
([#1327](#1327))
- [**breaking**] Replace opaque type arguments with String
([#1328](#1328))
- Add `impl Hash for Type`
([#1347](#1347))
- `HasDef` and `HasConcrete` traits for def/concrete op design pattern
([#1336](#1336))
- Add pointer standard extension
([#1337](#1337))
- [**breaking**] Remove the `Eq` type bound.
([#1364](#1364))

### Refactor

- [**breaking**] Use JSON rather than YAML in opaque fields.
([#1338](#1338))
- [**breaking**] Declarative module behind optional feature flag
([#1341](#1341))

### Testing

- Miri gate serialization upgrades
([#1349](#1349))
</blockquote>

## `hugr-core`
<blockquote>

## 0.7.0 (2024-07-26)

### Bug Fixes

(#1350))
- [**breaking**] Bump serialisation version with no upgrade path
([#1352](#1352))

### Features

- Serialization upgrade path
([#1327](#1327))
- [**breaking**] Replace opaque type arguments with String
([#1328](#1328))
- Add `impl Hash for Type`
([#1347](#1347))
- `HasDef` and `HasConcrete` traits for def/concrete op design pattern
([#1336](#1336))
- Add pointer standard extension
([#1337](#1337))
- [**breaking**] Remove the `Eq` type bound.
([#1364](#1364))

### Refactor

- [**breaking**] Use JSON rather than YAML in opaque fields.
([#1338](#1338))
- [**breaking**] Declarative module behind optional feature flag
([#1341](#1341))

### Testing

- Miri gate serialization upgrades
([#1349](#1349))
</blockquote>

## `hugr-passes`
<blockquote>

## 0.6.2 (2024-07-26)

### Features

- Add `nonlocal_edges` and `ensure_no_nonlocal_edges`
([#1345](#1345))
</blockquote>

## `hugr-cli`
<blockquote>

## 0.3.0 (2024-07-26)

### Features

- [**breaking**] Created `validate` CLI subcommand.
([#1312](#1312))
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/MarcoIeni/release-plz/).

---------

Co-authored-by: Douglas Wilson <douglas.wilson@quantinuum.com>
github-merge-queue bot pushed a commit that referenced this pull request Jul 29, 2024
🤖 I have created a release *beep* *boop*
---


##
[0.5.0](hugr-py-v0.4.0...hugr-py-v0.5.0)
(2024-07-29)


### ⚠ BREAKING CHANGES

* Eq type bound removed. References to `Eq` in serialized HUGRs will be
treated as `Copyable`.
* **hugr-core:** All Hugrs serialised with earlier versions will fail to
deserialise
* opaque type parameters replaced with string parameters.

### Features

* **hugr-py:** `AsCustomOp` protocol for user-defined custom op types.
([#1290](#1290))
([1db43eb](1db43eb))
* remove the `Eq` type bound.
([#1364](#1364))
([1218d21](1218d21))
* replace opaque type arguments with String
([#1328](#1328))
([24b2217](24b2217)),
closes [#1308](#1308)
* Serialization upgrade path
([#1327](#1327))
([d493139](d493139))


### Bug Fixes

* add op's extension to signature check in `resolve_opaque_op`
([#1317](#1317))
([01da7ba](01da7ba))
* **hugr-core:** bump serialisation version with no upgrade path
([#1352](#1352))
([657cbb0](657cbb0))
* **hugr-py:** ops require their own extensions
([#1303](#1303))
([026bfcb](026bfcb)),
closes [#1301](#1301)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change Changes that break semver
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove TypeBound::Eq
3 participants