Skip to content

Conversation

@aborgna-q
Copy link
Collaborator

@aborgna-q aborgna-q commented Aug 14, 2025

No functionality changes, only renames that we didn't do in #987

I'm not touching the decoder code, since it's already being modified by #1030

BREAKING CHANGE: Renamed various pytket encoder-related structs and methods from tk1* to pytket

BEGIN_COMMIT_OVERRIDE

chore: Rename tk2 encoder names to tket (#1037)

END_COMMIT_OVERRIDE

@aborgna-q aborgna-q requested a review from cqc-alec August 14, 2025 14:58
@aborgna-q aborgna-q requested a review from a team as a code owner August 14, 2025 14:58
@cqc-alec
Copy link
Collaborator

Looks like there are some merge conflicts.

@aborgna-q aborgna-q changed the base branch from ab/decoder-extension to main August 14, 2025 15:07
@aborgna-q
Copy link
Collaborator Author

Forgot to change the base back to main

Copy link
Collaborator

@cqc-alec cqc-alec left a comment

Choose a reason for hiding this comment

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

Happy with renaming "tk2" things to "tket". Not so sure about renaming "tk1" things to "pytket" and "legacy".

  • It's not clear why it's sometimes one and sometimes the other.
  • It leads to some funny names, like PyPytketEncodeError.
  • It emphasizes a difference of language, which is not really the point.
  • Maybe it is a bit early to be calling old-tket "legacy".

Would it be so bad to keep using "tk1" as code for old-tket?

@aborgna-q aborgna-q changed the title refactor!: Rename tk1 / tk2 encoder names to legacy / tket refactor!: Rename tk2 encoder names to tket Aug 14, 2025
@aborgna-q
Copy link
Collaborator Author

aborgna-q commented Aug 14, 2025

Fair enough. I removed most changes, but left the main ones I wanted;

  • Tk1EncoderConfig -> PytketEncoderConfig. The serialization submodule is called this pytket, and we do this already with the decoder refactor.
  • Tk1ConvertError -> PytketEncodeError. We are adding a separate decoding error, so it's a good time to change this
  • Tk1EncoderConfig -> PytketEncoderConfig. Same thing, the decoder is not only for tk1 operations
  • Rolled back the "legacy" names, but kept Tk2Emitter -> TketOpEmitter, since the operations are now called that.

@aborgna-q aborgna-q requested a review from cqc-alec August 14, 2025 16:16
@aborgna-q aborgna-q force-pushed the ab/rename-tk1-encode-decode branch from 9608829 to b83f74c Compare August 14, 2025 16:20
@codecov
Copy link

codecov bot commented Aug 14, 2025

Codecov Report

❌ Patch coverage is 61.45833% with 37 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.74%. Comparing base (e087dc4) to head (fc8bc29).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
tket/src/serialize/pytket/encoder.rs 58.13% 18 Missing ⚠️
tket/src/serialize/pytket.rs 37.50% 4 Missing and 1 partial ⚠️
tket/src/serialize/pytket/extension.rs 0.00% 4 Missing ⚠️
tket/src/serialize/pytket/extension/bool.rs 0.00% 4 Missing ⚠️
tket/src/serialize/pytket/decoder.rs 50.00% 1 Missing and 1 partial ⚠️
tket/src/serialize/pytket/extension/prelude.rs 50.00% 2 Missing ⚠️
tket/src/serialize/pytket/encoder/value_tracker.rs 66.66% 1 Missing ⚠️
tket/src/serialize/pytket/extension/tk1.rs 66.66% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1037   +/-   ##
=======================================
  Coverage   79.74%   79.74%           
=======================================
  Files          97       97           
  Lines       11674    11674           
  Branches    11395    11395           
=======================================
  Hits         9309     9309           
  Misses       1734     1734           
  Partials      631      631           
Flag Coverage Δ
python 81.00% <ø> (ø)
rust 79.71% <61.45%> (ø)

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.

@hugrbot
Copy link
Collaborator

hugrbot commented Aug 14, 2025

This PR contains breaking changes to the public Rust API.

cargo-semver-checks summary

--- failure enum_missing: pub enum removed or renamed ---

Description:
A publicly-visible enum cannot be imported by its prior path. A `pub use` may have been removed, or the enum itself may have been renamed or removed entirely.
      ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
     impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.43.0/src/lints/enum_missing.ron

Failed in:
enum tket::serialize::pytket::Tk1ConvertError, previously in file /home/runner/work/tket2/tket2/BASELINE_BRANCH/tket/src/serialize/pytket.rs:233

--- failure struct_missing: pub struct removed or renamed ---

Description:
A publicly-visible struct cannot be imported by its prior path. A `pub use` may have been removed, or the struct itself may have been renamed or removed entirely.
      ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
     impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.43.0/src/lints/struct_missing.ron

Failed in:
struct tket::serialize::pytket::extension::Tk2Emitter, previously in file /home/runner/work/tket2/tket2/BASELINE_BRANCH/tket/src/serialize/pytket/extension/tk2.rs:17
struct tket::serialize::pytket::Tk1EncoderConfig, previously in file /home/runner/work/tket2/tket2/BASELINE_BRANCH/tket/src/serialize/pytket/config/encoder_config.rs:30
struct tket::serialize::pytket::encoder::Tk1EncoderContext, previously in file /home/runner/work/tket2/tket2/BASELINE_BRANCH/tket/src/serialize/pytket/encoder.rs:40
struct tket::serialize::pytket::Tk1EncoderContext, previously in file /home/runner/work/tket2/tket2/BASELINE_BRANCH/tket/src/serialize/pytket/encoder.rs:40

@aborgna-q aborgna-q force-pushed the ab/rename-tk1-encode-decode branch from b83f74c to fc8bc29 Compare August 14, 2025 16:31
@aborgna-q aborgna-q enabled auto-merge August 14, 2025 16:32
@aborgna-q aborgna-q added this pull request to the merge queue Aug 14, 2025
Merged via the queue into main with commit 99f568b Aug 14, 2025
19 of 20 checks passed
@aborgna-q aborgna-q deleted the ab/rename-tk1-encode-decode branch August 14, 2025 16:39
This was referenced Aug 14, 2025
github-merge-queue bot pushed a commit that referenced this pull request Aug 18, 2025
## 🤖 New release

* `tket`: 0.13.2 -> 0.14.0 (✓ API compatible changes)
* `tket-qsystem`: 0.18.1 -> 0.19.0 (✓ API compatible changes)

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

## `tket`

<blockquote>

##
[0.14.0](tket-v0.13.2...tket-v0.14.0)
- 2025-08-18

### New Features

- [**breaking**] Allow PytketTypeTranslators to translate nested types
([#1038](#1038))
- Define a wire tracker for the new pytket decoder
([#1036](#1036))
- [**breaking**] Reworked pytket decoder framework
([#1030](#1030))
- [**breaking**] Use qsystem encoder/decoders in tket-py
([#1041](#1041))
- [**breaking**] Avoid eagerly cloning SerialCircuits when decoding from
pytket ([#1048](#1048))

### Refactor

- [**breaking**] Rename tk2 encoder names to tket
([#1037](#1037))
</blockquote>

## `tket-qsystem`

<blockquote>

##
[0.19.0](tket-qsystem-v0.18.1...tket-qsystem-v0.19.0)
- 2025-08-18

### New Features

- Add emitters for tket-qsystem
([#1039](#1039))
- [**breaking**] Avoid eagerly cloning SerialCircuits when decoding from
pytket ([#1048](#1048))
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/release-plz/release-plz/).
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.

3 participants