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: Python bindings for hugr-model. #1959

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft

feat: Python bindings for hugr-model. #1959

wants to merge 7 commits into from

Conversation

zrho
Copy link
Contributor

@zrho zrho commented Mar 10, 2025

This PR introduces Python bindings to hugr-model. On the Python side, we have dataclasses that mirror the model AST. On the Rust side, these classes are converted into the Rust AST structure. Using that, we can generate the text and binary representation.

@zrho zrho force-pushed the zrho/model-python branch from f8f574a to a9b846a Compare March 10, 2025 15:52
@hugrbot
Copy link
Collaborator

hugrbot commented Mar 10, 2025

This PR contains breaking changes to the public Rust API.
Please deprecate the old API instead (if possible), or mark the PR with a ! to indicate a breaking change.

cargo-semver-checks summary

Copy link

codecov bot commented Mar 10, 2025

Codecov Report

Attention: Patch coverage is 24.65582% with 602 lines in your changes missing coverage. Please review.

Project coverage is 82.55%. Comparing base (6bd7665) to head (fb1ac5f).

Files with missing lines Patch % Lines
hugr-model/src/v0/ast/python.rs 0.00% 246 Missing ⚠️
hugr-py/src/hugr/model/export.py 9.66% 215 Missing ⚠️
hugr-model/src/v0/mod.rs 0.00% 78 Missing ⚠️
hugr-py/src/hugr/tys.py 44.26% 34 Missing ⚠️
hugr-py/src/hugr/model/__init__.py 90.44% 13 Missing ⚠️
hugr-py/src/hugr/val.py 43.75% 9 Missing ⚠️
hugr-py/src/hugr/hugr/base.py 42.85% 4 Missing ⚠️
hugr-py/src/hugr/std/collections/array.py 75.00% 1 Missing ⚠️
hugr-py/src/hugr/std/float.py 66.66% 1 Missing ⚠️
hugr-py/src/hugr/std/int.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1959      +/-   ##
==========================================
- Coverage   83.73%   82.55%   -1.19%     
==========================================
  Files         209      212       +3     
  Lines       39266    40061     +795     
  Branches    35937    36265     +328     
==========================================
+ Hits        32879    33071     +192     
- Misses       4541     5144     +603     
  Partials     1846     1846              
Flag Coverage Δ
python 85.69% <40.85%> (-6.35%) ⬇️
rust 82.22% <1.51%> (-0.75%) ⬇️

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.

@zrho zrho force-pushed the zrho/model-python branch 3 times, most recently from 49fd266 to f7c4ba4 Compare March 19, 2025 18:27
@zrho zrho force-pushed the zrho/model-python branch from 357e227 to c50986d Compare March 20, 2025 13:25
@zrho zrho force-pushed the zrho/model-python branch from c50986d to 7485182 Compare March 20, 2025 13:26
@zrho zrho force-pushed the zrho/model-python branch from fb1ac5f to 93ee945 Compare March 20, 2025 15:02
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