Skip to content

feat: Add python definitions for the TKET metadata keys#1535

Merged
aborgna-q merged 6 commits into
mainfrom
ab/py-metadata
May 12, 2026
Merged

feat: Add python definitions for the TKET metadata keys#1535
aborgna-q merged 6 commits into
mainfrom
ab/py-metadata

Conversation

@aborgna-q
Copy link
Copy Markdown
Collaborator

We should also add a metadata for inline hints either here or in #1532, whichever gets merged second.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2026

Codecov Report

❌ Patch coverage is 69.73684% with 23 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.05%. Comparing base (54998e1) to head (ddb56dd).

Files with missing lines Patch % Lines
tket-py/tket/metadata.py 60.34% 23 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1535      +/-   ##
==========================================
- Coverage   84.09%   84.05%   -0.05%     
==========================================
  Files         188      189       +1     
  Lines       29298    29358      +60     
  Branches    28172    28174       +2     
==========================================
+ Hits        24639    24676      +37     
- Misses       3479     3502      +23     
  Partials     1180     1180              
Flag Coverage Δ
python 90.75% <61.01%> (-1.64%) ⬇️
qis-compiler 91.66% <ø> (ø)
rust 83.76% <100.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.

Copy link
Copy Markdown
Contributor

@acl-cqc acl-cqc left a comment

Choose a reason for hiding this comment

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

In #1449 I found myself wondering, does this not exist...so yes thank you :-) 👍.

Mostly just naming suggestions, nothing major, looks good!

Comment thread tket-py/tket/metadata.py Outdated
KEY = _metadata.CIRCUIT_REWRITE_TRACES


class Unitary(Metadata[int]):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe UnitaryFlags? It's definitely not a unitary (i.e. matrix) itself

Comment thread tket-py/tket/metadata.py Outdated
KEY = _metadata.INPUT_PARAMETERS


class OpGroup(Metadata[str]):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Perhaps PytketOpGroup? And elsewhere in this file for other metadata relating to pytket, but there are some that are not

Comment thread tket-py/tket/metadata.py
Comment thread tket-py/tket/metadata.py Outdated
Comment thread tket-py/tket/metadata.py Outdated
Comment thread tket-py/tket/metadata.py Outdated
return _read_pytket_register(cls.KEY, value)


class Phase(Metadata[str]):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

PytketPhaseExpr?

Comment thread tket-py/tket/metadata.py Outdated
individual_matches: int


class MaxQubits(Metadata[int]):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should this be MaxQubitsHint?

Comment thread tket-py/tket/metadata.py Outdated
>>> node.metadata.get(QubitRegisters)
[('q', [0]), ('ancilla', [1])]
"""
# Changes to this file **MUST** be reflected in `tket/src/metadata.rs`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In the sense that they ought to match, but this doesn't mean that things will break if they don't match, right? Isn't that SHOULD ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I guess this means that all of my suggested renames should be applied on the rust side too, heh

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Changed to a SHOULD. I'll do the renaming on both rust and python (with some aliases for backwards compatibility)

Comment thread tket-py/tket/metadata.py Outdated
Comment thread tket-py/tket/metadata.py Outdated
@aborgna-q aborgna-q added this pull request to the merge queue May 12, 2026
Merged via the queue into main with commit 1bfef9a May 12, 2026
23 of 24 checks passed
@aborgna-q aborgna-q deleted the ab/py-metadata branch May 12, 2026 15:40
This was referenced May 12, 2026
jpacold pushed a commit to jpacold/tket2 that referenced this pull request May 23, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.13.1](Quantinuum/tket2@tket-py-v0.13.0...tket-py-v0.13.1)
(2026-05-19)


### Features

* Add python definitions for the TKET metadata keys
([Quantinuum#1535](Quantinuum#1535))
([1bfef9a](Quantinuum@1bfef9a))
* Clean Up by Deleting Unconnected Nodes after Modifier Solve
([Quantinuum#1557](Quantinuum#1557))
([d706867](Quantinuum@d706867))
* expose the QSystemPass to Python
([Quantinuum#1556](Quantinuum#1556))
([394a610](Quantinuum@394a610))
* InlineFunctionsPass
([Quantinuum#1524](Quantinuum#1524))
([f40dcef](Quantinuum@f40dcef))
* InlineHint metadata
([Quantinuum#1532](Quantinuum#1532))
([e7949c2](Quantinuum@e7949c2))


### Bug Fixes

* Apply modifiers through function calls
([Quantinuum#1531](Quantinuum#1531))
([6a13f0c](Quantinuum@6a13f0c))
* Incorrect matching of pytket parameters to unsupported graph ports
([Quantinuum#1561](Quantinuum#1561))
([4fc5a25](Quantinuum@4fc5a25))
* Passes with Nested Modifier
([Quantinuum#1546](Quantinuum#1546))
([bf6df51](Quantinuum@bf6df51))
* Update examples link in README.md
([Quantinuum#1506](Quantinuum#1506))
([9a25ec8](Quantinuum@9a25ec8))


### Documentation

* Simplify package description.
([Quantinuum#1547](Quantinuum#1547))
([54e855f](Quantinuum@54e855f))

---
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 <agustin.borgna@quantinuum.com>
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