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

chore(py): release tket2-exts 0.5.0 #790

Merged

Conversation

hugrbot
Copy link
Collaborator

@hugrbot hugrbot commented Mar 4, 2025

🤖 I have created a release beep boop

0.5.0 (2025-03-04)

⚠ BREAKING CHANGES

  • To be compatible with Guppy's convention of implicitly returning self as the second value of the tuple, the following signatures are updated:
-   /// `fn random_int(RNGContext) -> (RNGContext, u32)`
+   /// `fn random_int(RNGContext) -> (u32, RNGContext)`

-   /// `fn random_float(RNGContext) -> (RNGContext, f32)`
+   /// `fn random_float(RNGContext) -> (f32, RNGContext)`

-   /// `fn random_int_bounded(RNGContext, bound: u32) -> (RNGContext, u32)`
+   /// `fn random_int_bounded(RNGContext, bound: u32) -> (u32, RNGContext)`

Bug Fixes

  • remove type argument from RNGContext type, swap returns (#786) (633ebd7)

This PR was generated with Release Please. See documentation.

Copy link

codecov bot commented Mar 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.46%. Comparing base (633ebd7) to head (6099192).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #790   +/-   ##
=======================================
  Coverage   82.46%   82.46%           
=======================================
  Files          65       65           
  Lines        7979     7979           
  Branches     7717     7717           
=======================================
  Hits         6580     6580           
  Misses       1002     1002           
  Partials      397      397           
Flag Coverage Δ
python 82.06% <100.00%> (ø)

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.

@aborgna-q aborgna-q marked this pull request as ready for review March 6, 2025 16:51
@aborgna-q aborgna-q requested review from aborgna-q, cqc-alec, ss2165 and a team as code owners March 6, 2025 16:51
@aborgna-q aborgna-q added this pull request to the merge queue Mar 6, 2025
Merged via the queue into main with commit 007d3ae Mar 6, 2025
18 checks passed
@aborgna-q aborgna-q deleted the release-please--branches--main--components--tket2-exts branch March 6, 2025 16:58
@hugrbot
Copy link
Collaborator Author

hugrbot commented Mar 6, 2025

🤖 Created releases:

🌻

github-merge-queue bot pushed a commit to CQCL/guppylang that referenced this pull request Mar 7, 2025
Closes: #769

Depends on:
- CQCL/tket2#786
  - CQCL/tket2#790
- #810

Some changes from the issue:
- Introduces `RNG` guppy type, instead of the `RNGContext` guppy struct.
- We have `def __new__(seed: int) -> "RNG":` instead of `__init__(seed:
int) -> "RNGContext"`
- We have `maybe_rng` instead of `init_safe(seed: int) ->
Option["RNGContext"]`

Other thoughts:

Unsure if this interface is the best we can do:
```py
def test() -> tuple[int, nat, float, int]:
    rng = RNG(42)
    rint = rng.random_int()
    rnat = rng.random_nat()
    rfloat = rng.random_float()
    rint_bnd = rng.random_int_bounded(100)
    rng.discard()
    return rint, rnat, rfloat, rint_bnd
```
It might be nice to provide a context manager interface such as:
```py
def test() -> tuple[int, nat, float, int]:
    with RNG(42) as rng:
        rint = rng.random_int()
        rnat = rng.random_nat()
        rfloat = rng.random_float()
        rint_bnd = rng.random_int_bounded(100)
    return rint, rnat, rfloat, rint_bnd
```
which would enforce the linear discipline on `RNG`. Mark confirms it's
currently not possible within guppy.

---

Release-As: 0.16.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants