Skip to content

feat: Define modifiers as Python functions#1571

Open
nicolaassolini-qntm wants to merge 7 commits intomainfrom
na/1290-define-modifiers-as-python-functions
Open

feat: Define modifiers as Python functions#1571
nicolaassolini-qntm wants to merge 7 commits intomainfrom
na/1290-define-modifiers-as-python-functions

Conversation

@nicolaassolini-qntm
Copy link
Contributor

@nicolaassolini-qntm nicolaassolini-qntm commented Mar 18, 2026

close #1290

Added new dummy context managers—control, dagger, and power—to the Guppy language standard library. These additions allow importing the names when running a guppy code that uses with control(...), with dagger, and with power(...), avoiding linter errors.

The new imports have been added to all test files.

New tests about using modifiers with comptime are added

Some open issues are left regarding the error generated from an invalid use of modifier keywords. They are collected in #1569

@nicolaassolini-qntm nicolaassolini-qntm requested a review from a team as a code owner March 18, 2026 15:42
@nicolaassolini-qntm nicolaassolini-qntm linked an issue Mar 18, 2026 that may be closed by this pull request
@github-actions
Copy link
Contributor

github-actions bot commented Mar 18, 2026

🐰 Bencher Report

Branchna/1290-define-modifiers-as-python-functions
TestbedLinux
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
microseconds (µs)
(Result Δ%)
Upper Boundary
microseconds (µs)
(Limit %)
tests/benchmarks/test_big_array.py::test_big_array_check📈 view plot
🚷 view threshold
694,715.37 µs
(-0.65%)Baseline: 699,249.96 µs
734,212.46 µs
(94.62%)
tests/benchmarks/test_big_array.py::test_big_array_compile📈 view plot
🚷 view threshold
1,890,808.27 µs
(+1.47%)Baseline: 1,863,453.37 µs
1,956,626.04 µs
(96.64%)
tests/benchmarks/test_big_array.py::test_big_array_executable📈 view plot
🚷 view threshold
8,188,086.29 µs
(+0.59%)Baseline: 8,139,676.94 µs
8,546,660.79 µs
(95.80%)
tests/benchmarks/test_ctrl_flow.py::test_many_ctrl_flow_check📈 view plot
🚷 view threshold
49,010.76 µs
(-1.31%)Baseline: 49,662.35 µs
52,145.47 µs
(93.99%)
tests/benchmarks/test_ctrl_flow.py::test_many_ctrl_flow_compile📈 view plot
🚷 view threshold
105,727.53 µs
(-2.11%)Baseline: 108,005.16 µs
113,405.42 µs
(93.23%)
tests/benchmarks/test_ctrl_flow.py::test_many_ctrl_flow_executable📈 view plot
🚷 view threshold
603,310.65 µs
(-0.33%)Baseline: 605,338.32 µs
635,605.24 µs
(94.92%)
tests/benchmarks/test_prelude.py::test_import_guppy📈 view plot
🚷 view threshold
51.37 µs
(-12.92%)Baseline: 58.99 µs
61.94 µs
(82.93%)
🐰 View full continuous benchmarking report in Bencher

@github-actions
Copy link
Contributor

github-actions bot commented Mar 18, 2026

🐰 Bencher Report

Branchna/1290-define-modifiers-as-python-functions
TestbedLinux
Click to view all benchmark results
Benchmarkhugr_bytesBenchmark Result
bytes x 1e3
(Result Δ%)
Upper Boundary
bytes x 1e3
(Limit %)
hugr_nodesBenchmark Result
nodes
(Result Δ%)
Upper Boundary
nodes
(Limit %)
tests/benchmarks/test_big_array.py::test_big_array_compile📈 view plot
🚷 view threshold
141.81 x 1e3
(0.00%)Baseline: 141.81 x 1e3
143.23 x 1e3
(99.01%)
📈 view plot
🚷 view threshold
6,620.00
(0.00%)Baseline: 6,620.00
6,686.20
(99.01%)
tests/benchmarks/test_ctrl_flow.py::test_many_ctrl_flow_compile📈 view plot
🚷 view threshold
17.59 x 1e3
(0.00%)Baseline: 17.59 x 1e3
17.76 x 1e3
(99.01%)
📈 view plot
🚷 view threshold
581.00
(0.00%)Baseline: 581.00
586.81
(99.01%)
🐰 View full continuous benchmarking report in Bencher

@codecov-commenter
Copy link

codecov-commenter commented Mar 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.53%. Comparing base (824e924) to head (f30493d).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1571   +/-   ##
=======================================
  Coverage   93.53%   93.53%           
=======================================
  Files         130      130           
  Lines       12331    12335    +4     
=======================================
+ Hits        11534    11538    +4     
  Misses        797      797           

☔ 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.

@maximilianruesch maximilianruesch changed the title feat: define modifiers as python functions feat: Define modifiers as Python functions Mar 19, 2026
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.

Modifiers are undefined as python functions

3 participants