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: Move the compiled eccs to a separate package #517

Merged
merged 5 commits into from
Aug 1, 2024

Conversation

aborgna-q
Copy link
Collaborator

@aborgna-q aborgna-q commented Jul 30, 2024

Closes #486. We should merge this before publishing the next alpha.

I checked that the generated wheels for tket2-py contain the correct (non-local) dependency on tket2_eccs.

The pure-python wheels ci job is copied from hugr-py.

Release-As: 0.1.0

@aborgna-q aborgna-q added the run-ci-checks Special label to force running all checks in CI label Jul 30, 2024
Copy link

codecov bot commented Jul 30, 2024

Codecov Report

Attention: Patch coverage is 55.55556% with 8 lines in your changes missing coverage. Please review.

Project coverage is 83.96%. Comparing base (3e67379) to head (81b3e7e).
Report is 1 commits behind head on main.

Files Patch % Lines
tket2-py/tket2/rewrite.py 0.00% 6 Missing ⚠️
tket2-py/tket2/passes.py 60.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #517      +/-   ##
==========================================
+ Coverage   83.64%   83.96%   +0.32%     
==========================================
  Files          60       61       +1     
  Lines        6572     6685     +113     
  Branches     6090     6191     +101     
==========================================
+ Hits         5497     5613     +116     
+ Misses        797      790       -7     
- Partials      278      282       +4     
Flag Coverage Δ
python 95.34% <55.55%> (-1.13%) ⬇️
rust 83.05% <ø> (+0.42%) ⬆️

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.

@aborgna-q aborgna-q requested a review from ss2165 July 30, 2024 17:00
@aborgna-q aborgna-q marked this pull request as ready for review July 30, 2024 17:01
@aborgna-q aborgna-q requested review from cqc-alec and a team as code owners July 30, 2024 17:01
@aborgna-q aborgna-q requested a review from doug-q July 31, 2024 11:24
Copy link
Contributor

@doug-q doug-q left a comment

Choose a reason for hiding this comment

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

A couple comments checking my understanding, I admit I have not looked at python-pure-wheels.yml in detail, assuming it is copied from somewhere

@@ -1,3 +1,4 @@
{
"tket2-py": "0.1.0a4"
"tket2-py": "0.1.0a4",
"tket2-eccs": "0.0.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

This is correct because it matches the initial version in release-please-config.json. The robot will do the right thing here.

# Note: Be sure to update the dependency versions in [project.dependencies] as well
#
# Poetry does not currently follow PEP 621, it will be supported on poetry 2
# https://github.com/python-poetry/poetry/issues/3332
tket2_eccs = { path = "tket2-eccs", develop = true }
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks strange. I think the [project] section below is what gets published to pypi, and this is what is used when you are pointing to the git repo

Copy link
Collaborator Author

@aborgna-q aborgna-q Jul 31, 2024

Choose a reason for hiding this comment

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

Yes, this is abusing the inconsistent dependency definitions (see PR linked in the comment) to work around not being able to define local path + pypi dependencies.

poetry uses tool.poetry.dependencies to define the dependency, so we tell it to use the local project (develop = true makes it so changes in tket2_eccs get reflected in the poetry env)

When the wheels get built however their metadata is computed using project.dependencies, so we reference the (currently unpublished) package there.

@@ -85,7 +85,8 @@ repos:
- id: py-test
name: pytest
description: Run python tests
entry: poetry run -- sh -c "maturin develop && pytest --cov=./ --cov-report=html"
# Ensure that we are using the local version of `tket2-eccs` and not the one from PyPI
entry: poetry run -- sh -c "poetry install -C tket2-eccs & maturin develop && pytest --cov=./ --cov-report=html"
Copy link
Contributor

Choose a reason for hiding this comment

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

this does not look right. I would expect
poetry install -C tket2-eccs && poetry run -- sh -c "maturin develop && pytest --cov=./ --cov-report=html"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Annoyingly, pre-commit fails if you try to use && on a command

No arguments expected for "install" command, got "&&"

I realize that I wrote & instead of && though

@@ -56,4 +56,4 @@ See [DEVELOPMENT.md] for more information.

This project is licensed under Apache License, Version 2.0 ([LICENCE][] or http://www.apache.org/licenses/LICENSE-2.0).

[LICENCE]: ./LICENCE
[LICENCE]: https://github.com/CQCL/tket2/blob/main/LICENCE
Copy link
Contributor

Choose a reason for hiding this comment

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

I prefer the other way, if LICENSE ever changed this would be wrong.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I forgot to mention this. We need an absolute path. The LICENCE link on pypi's README is currently broken due to this.
https://pypi.org/project/tket2/

@aborgna-q
Copy link
Collaborator Author

I added a small drive-by to strip symbols from the compiled tket2-py lib.

The final wheel size improvement, after running maturin build --release for cp312-macosx_11_0_arm64:

Before. After After (stripped)
Size 8.5MB 4.1MB 3.5MB

@aborgna-q aborgna-q added this pull request to the merge queue Aug 1, 2024
Merged via the queue into main with commit 7247cc6 Aug 1, 2024
17 of 18 checks passed
@aborgna-q aborgna-q deleted the ab/tket2-eccs-package branch August 1, 2024 09:07
@hugrbot hugrbot mentioned this pull request Aug 1, 2024
github-merge-queue bot pushed a commit that referenced this pull request Aug 1, 2024
🤖 I have created a release *beep* *boop*
---


<details><summary>tket2-py: 0.2.0</summary>

##
[0.2.0](tket2-py-v0.1.0...tket2-py-v0.2.0)
(2024-08-01)


### ⚠ BREAKING CHANGES

* increased minimum required version of hugr to 0.9.0
* `.rwr` ECC files generated with older versions are no longer
supported. Please recompile them, or compress the file with `zstd`.

### Features

* Add timeout options and stats to Badger
([#496](#496))
([32a9885](32a9885))
* Compress binary ECCs using zlib
([#498](#498))
([d9a713c](d9a713c))
* Expose advanced Badger timeout options to tket2-py
([#506](#506))
([fe7d40e](fe7d40e))
* Move the compiled eccs to a separate package
([#517](#517))
([7247cc6](7247cc6))


### Bug Fixes

* Recompile ecc sets after
[#441](#441)
([#484](#484))
([1122fa4](1122fa4))


### Miscellaneous Chores

* bump hugr version to 0.10.0
([#508](#508))
([eca258b](eca258b))
</details>

<details><summary>tket2-eccs: 0.1.0</summary>

## 0.1.0 (2024-08-01)


### Features

* Move the compiled eccs to a separate package
([#517](#517))
([7247cc6](7247cc6))
</details>

---
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 <121866228+aborgna-q@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
run-ci-checks Special label to force running all checks in CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Take the default nam_6_3.rwr ecc set out of the python package
3 participants