Skip to content

feat!: Deprecate JSON serialization format#2991

Merged
cqc-alec merged 17 commits intomainfrom
ae/deprecate-json
Mar 30, 2026
Merged

feat!: Deprecate JSON serialization format#2991
cqc-alec merged 17 commits intomainfrom
ae/deprecate-json

Conversation

@cqc-alec
Copy link
Copy Markdown
Collaborator

@cqc-alec cqc-alec commented Mar 27, 2026

Closes #2728 .

(hugr-py) Promote the experimental EnvelopeFormat._S_EXPRESSION and EnvelopeFormat._S_EXPRESSION_WITH_EXTS to fully supported EnvelopeFormat.S_EXPRESSION and EnvelopeFormat.S_EXPRESSION_WITH_EXTS.

BREAKING CHANGE: Default EnvelopeConfig changed from EnvelopeFormat.JSON to EnvelopeFormat.MODEL_WITH_EXTS.
BREAKING CHANGE: (hugr-core) EnvelopeConfig::text() changed from EnvelopeFormat::PackageJson to EnvelopeFormat::SExpressionWithExtensions.

@cqc-alec cqc-alec force-pushed the ae/deprecate-json branch from b330fbd to 717d668 Compare March 27, 2026 13:15
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 27, 2026

Codecov Report

❌ Patch coverage is 90.90909% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 81.29%. Comparing base (d619148) to head (217e0f1).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
hugr-core/src/extension/resolution/test.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2991   +/-   ##
=======================================
  Coverage   81.29%   81.29%           
=======================================
  Files         239      239           
  Lines       45354    45354           
  Branches    39160    39160           
=======================================
+ Hits        36869    36872    +3     
+ Misses       6494     6492    -2     
+ Partials     1991     1990    -1     
Flag Coverage Δ
python 88.90% <100.00%> (ø)
rust 80.09% <50.00%> (+<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.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cqc-alec cqc-alec marked this pull request as ready for review March 27, 2026 13:27
@cqc-alec cqc-alec requested a review from a team as a code owner March 27, 2026 13:27
@cqc-alec cqc-alec requested a review from ss2165 March 27, 2026 13:27
Copy link
Copy Markdown
Member

@ss2165 ss2165 left a comment

Choose a reason for hiding this comment

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

In general not clear to me the rationale for allow vs. expect

@cqc-alec
Copy link
Copy Markdown
Collaborator Author

In general not clear to me the rationale for allow vs. expect

My vague idea was to use allow in test code and for functions where it's "obvious", such as to_json_writer(). But on reflection I agree it's better to just use expect, and have changed it. I kept allow in a couple of places where using expect got the linter confused because the usages were coming from macro-generated code.

@cqc-alec cqc-alec requested a review from ss2165 March 30, 2026 13:53
Copy link
Copy Markdown
Member

@ss2165 ss2165 left a comment

Choose a reason for hiding this comment

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

double check safe to merge (i.e. if we want to make a non-breaking release first)

@cqc-alec cqc-alec added this pull request to the merge queue Mar 30, 2026
Merged via the queue into main with commit 0f7a880 Mar 30, 2026
30 checks passed
@cqc-alec cqc-alec deleted the ae/deprecate-json branch March 30, 2026 14:20
github-merge-queue bot pushed a commit that referenced this pull request Mar 31, 2026
## 🤖 New release

* `hugr-model`: 0.26.1 -> 0.27.0 (✓ API compatible changes)
* `hugr-core`: 0.26.1 -> 0.27.0 (✓ API compatible changes)
* `hugr-llvm`: 0.26.1 -> 0.27.0 (✓ API compatible changes)
* `hugr-persistent`: 0.5.1 -> 0.6.0 (✓ API compatible changes)
* `hugr`: 0.26.1 -> 0.27.0 (✓ API compatible changes)
* `hugr-cli`: 0.26.1 -> 0.27.0 (✓ API compatible changes)

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

## `hugr-model`

<blockquote>

##
[0.26.0](hugr-model-v0.25.7...hugr-model-v0.26.0)
- 2026-03-16

### Testing

- Replace model text snapshots with roundtrip tests
([#2933](#2933))
- Add missing width arg in model-call example
([#2945](#2945))
</blockquote>

## `hugr-core`

<blockquote>

##
[0.27.0](hugr-core-v0.26.1...hugr-core-v0.27.0)
- 2026-03-31

### Bug Fixes

- Use valid identifiers when constructing AST model
([#2973](#2973))
- Panic on constant folding with opaque consts
([#2986](#2986))

### New Features

- *(py)* Allow missing ext versions ExtensionDesc metadata
([#2979](#2979))
- [**breaking**] Deprecate JSON serialization format
([#2991](#2991))
- [**breaking**] Bump public `portgraph` dependency to `0.16.0`
([#2998](#2998))

### Refactor

- Simplify validate_subtree
([#2969](#2969))
- further cleanups to SiblingSubgraph + generalize over trait
HugrConvexChecker
([#2957](#2957))
</blockquote>

## `hugr-llvm`

<blockquote>

##
[0.27.0](hugr-llvm-v0.26.1...hugr-llvm-v0.27.0)
- 2026-03-31

### New Features

- *(hugr-llvm)* Emit rounding operation for `FloatOps::fround` extension
ops ([#2949](#2949))
</blockquote>

## `hugr-persistent`

<blockquote>

##
[0.6.0](hugr-persistent-v0.5.1...hugr-persistent-v0.6.0)
- 2026-03-31

### New Features

- [**breaking**] Deprecate JSON serialization format
([#2991](#2991))
</blockquote>

## `hugr`

<blockquote>

##
[0.27.0](hugr-v0.26.1...hugr-v0.27.0)
- 2026-03-31

### Bug Fixes

- Use valid identifiers when constructing AST model
([#2973](#2973))
- Panic on constant folding with opaque consts
([#2986](#2986))

### New Features

- *(py)* Allow missing ext versions ExtensionDesc metadata
([#2979](#2979))
- [**breaking**] Bump public `portgraph` dependency to `0.16.0`
([#2998](#2998))
- [**breaking**] Deprecate JSON serialization format
([#2991](#2991))

### Refactor

- Simplify validate_subtree
([#2969](#2969))
- further cleanups to SiblingSubgraph + generalize over trait
HugrConvexChecker
([#2957](#2957))
</blockquote>

## `hugr-cli`

<blockquote>

##
[0.27.0](hugr-cli-v0.26.1...hugr-cli-v0.27.0)
- 2026-03-31

### Bug Fixes

- Do extension resolution on exts loaded by hugr-cli
([#2987](#2987))

### New Features

- *(py)* Allow missing ext versions ExtensionDesc metadata
([#2979](#2979))
- [**breaking**] Deprecate JSON serialization format
([#2991](#2991))
</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]>
github-merge-queue bot pushed a commit that referenced this pull request Apr 1, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.16.0](hugr-py-v0.15.4...hugr-py-v0.16.0)
(2026-04-01)

This release changes the default text serialization format from JSON to
`MODEL_WITH_EXTS` (the JSON format is now deprecated).
It also adds the ability to link packages and modules from Python,
renders operation type arguments in HUGR visualizations, introduces a
new `debug_info` module for attaching source-level debug metadata to
nodes,
and introduces multi-version support in `ExtensionRegistry`, allowing
different versions of the same extension to coexist in the same
registry.


### ⚠ BREAKING CHANGES

* `ExtensionRegistry` may now contain multiple versions of the same
extension. `.extensions` is now an iterator of the latest versions
instead of a dictionary. `.register_updated` and `.add_extension` have
been replaced with a singular `.register`.
* Default `EnvelopeConfig` changed from `EnvelopeFormat.JSON` to
`EnvelopeFormat.MODEL_WITH_EXTS`.
* Substituted `hugr-py/src/hugr/tys.py::_type_str` with
`hugr-py/src/hugr/utils.py::name_w_args`.

### Features

* Add debug info metadata specification in `hugr-py`
([#2971](#2971))
([a4da8ef](a4da8ef))
* Allow multiple versions of an extension in an ExtensionRegistry
([#3005](#3005))
([ee90cd1](ee90cd1))
* Deprecate JSON serialization format
([#2991](#2991))
([0f7a880](0f7a880))
* Operation parameter rendering in HUGR visualizations
([#2995](#2995))
([d619148](d619148))
* Allow linking packages and modules from Python
([#2947](#2947))
([329c243](329c243))
* Make `_composable_pass` and `_scope` public modules
([#2962](#2962))
([1d6af9a](1d6af9a)),
closes [#2961](#2961)
* Allow missing ext versions ExtensionDesc metadata
([#2979](#2979))
([bc1c445](bc1c445))
* Allow dfg conversion in to TrackedDfg
([#2993](#2993))
([3bd7a88](3bd7a88))


### Bug Fixes

* Allow both _composable_pass and composable_pass imports
([#2965](#2965))
([0a5664d](0a5664d))
* Allow both _scope and scope imports
([#3003](#3003))
([de0458c](de0458c))
* Always do extension resolution when loading packages and hugrs
([#2953](#2953))
([0086d2a](0086d2a))
* Correct pyo3 module definitions and add missing exception class export
([#2964](#2964))
([3df73f4](3df73f4))
* Include extensions during link serialization
([#2992](#2992))
([9236e89](9236e89))
* Prefix names with underscores during serialization
([#2989](#2989))
([8aab636](8aab636))
* Use valid identifiers when constructing AST model
([#2973](#2973))
([8750a6b](8750a6b))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

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.

Formally deprecate JSON encoding format

2 participants