Skip to content

feat: Automatically generate stubs for function definitions and declarations#1535

Draft
maximilianruesch wants to merge 15 commits intomr/feat/compile-libraryfrom
mr/feat/automatic-header-generation
Draft

feat: Automatically generate stubs for function definitions and declarations#1535
maximilianruesch wants to merge 15 commits intomr/feat/compile-libraryfrom
mr/feat/automatic-header-generation

Conversation

@maximilianruesch
Copy link
Collaborator

So far only available for function definitions and declarations.

Closes #1530.

@maximilianruesch maximilianruesch changed the base branch from main to mr/feat/compile-library February 26, 2026 14:13
@maximilianruesch maximilianruesch changed the title feat: Automatically generate headers for function definitions and declarations feat: Automatically generate stubs for function definitions and declarations Feb 26, 2026
@hugrbot
Copy link
Collaborator

hugrbot commented Feb 26, 2026

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

Breaking changes summary
guppylang-internals/src/guppylang_internals/engine.py:257: CompilationEngine.check(id):
Parameter was removed

guppylang-internals/src/guppylang_internals/engine.py:257: CompilationEngine.check(def_ids):
Parameter was added as required

guppylang-internals/src/guppylang_internals/engine.py:304: CompilationEngine.compile(id):
Parameter was removed

guppylang-internals/src/guppylang_internals/engine.py:304: CompilationEngine.compile(def_ids):
Parameter was added as required

guppylang-internals/src/guppylang_internals/definition/common.py:160: MonomorphizableDef.monomorphize(parent_ty):
Parameter was removed

guppylang-internals/src/guppylang_internals/definition/struct.py:0: ParsedStructDef.__init__(link_name_prefix):
Parameter was added as required

guppylang-internals/src/guppylang_internals/definition/function.py:0: ParsedFunctionDef.__init__(link_name):
Parameter was added as required

guppylang-internals/src/guppylang_internals/definition/function.py:219: CheckedFunctionDef.monomorphize(parent_ty):
Parameter was removed

guppylang-internals/src/guppylang_internals/definition/function.py:0: CheckedFunctionDef.__init__(cfg):
Positional parameter was moved
Details: position: from 6 to 7 (+1)

guppylang-internals/src/guppylang_internals/definition/function.py:0: CheckedFunctionDef.__init__(link_name):
Parameter was added as required

guppylang-internals/src/guppylang_internals/definition/function.py:0: CompiledFunctionDef.__init__(cfg):
Positional parameter was moved
Details: position: from 7 to 8 (+1)

guppylang-internals/src/guppylang_internals/definition/function.py:0: CompiledFunctionDef.__init__(func_def):
Positional parameter was moved
Details: position: from 8 to 9 (+1)

guppylang-internals/src/guppylang_internals/definition/function.py:0: CompiledFunctionDef.__init__(link_name):
Parameter was added as required

guppylang-internals/src/guppylang_internals/definition/declaration.py:118: CheckedFunctionDecl:
Base class was removed:
Old: [guppylang_internals.definition.declaration.RawFunctionDecl, guppylang_internals.definition.common.CompilableDef, guppylang_internals.definition.value.CallableDef]
New: [guppylang_internals.definition.common.CompilableDef, guppylang_internals.definition.value.CallableDef]

guppylang-internals/src/guppylang_internals/definition/declaration.py:0: CheckedFunctionDecl.parse:
Public object was removed

guppylang-internals/src/guppylang_internals/definition/declaration.py:0: CheckedFunctionDecl.python_func:
Public object was removed

guppylang-internals/src/guppylang_internals/definition/declaration.py:0: CheckedFunctionDecl.unitary_flags:
Public object was removed

guppylang-internals/src/guppylang_internals/definition/declaration.py:0: CheckedFunctionDecl.__init__(python_func):
Parameter was removed

guppylang-internals/src/guppylang_internals/definition/declaration.py:0: CheckedFunctionDecl.__init__(docstring):
Positional parameter was moved
Details: position: from 6 to 5 (-1)

guppylang-internals/src/guppylang_internals/definition/declaration.py:0: CheckedFunctionDecl.__init__(unitary_flags):
Parameter was removed

guppylang-internals/src/guppylang_internals/definition/declaration.py:0: CheckedFunctionDecl.__init__(link_name):
Parameter was added as required

guppylang-internals/src/guppylang_internals/definition/declaration.py:0: CompiledFunctionDecl.parse:
Public object was removed

guppylang-internals/src/guppylang_internals/definition/declaration.py:0: CompiledFunctionDecl.python_func:
Public object was removed

guppylang-internals/src/guppylang_internals/definition/declaration.py:0: CompiledFunctionDecl.unitary_flags:
Public object was removed

guppylang-internals/src/guppylang_internals/definition/declaration.py:0: CompiledFunctionDecl.__init__(python_func):
Parameter was removed

guppylang-internals/src/guppylang_internals/definition/declaration.py:0: CompiledFunctionDecl.__init__(docstring):
Positional parameter was moved
Details: position: from 6 to 5 (-1)

guppylang-internals/src/guppylang_internals/definition/declaration.py:0: CompiledFunctionDecl.__init__(unitary_flags):
Parameter was removed

guppylang-internals/src/guppylang_internals/definition/declaration.py:0: CompiledFunctionDecl.__init__(link_name):
Parameter was added as required

guppylang-internals/src/guppylang_internals/compiler/core.py:158: CompilerContext.__init__(exported_defs):
Parameter was added as required


@github-actions
Copy link
Contributor

github-actions bot commented Feb 26, 2026

🐰 Bencher Report

Branchmr/feat/automatic-header-generation
TestbedLinux

🚨 6 Alerts

BenchmarkMeasure
Units
ViewBenchmark Result
(Result Δ%)
Upper Boundary
(Limit %)
tests/benchmarks/test_big_array.py::test_big_array_checkLatency
milliseconds (ms)
📈 plot
🚷 threshold
🚨 alert (🔔)
1,232.67 ms
(+72.95%)Baseline: 712.73 ms
748.37 ms
(164.71%)

tests/benchmarks/test_big_array.py::test_big_array_compileLatency
seconds (s)
📈 plot
🚷 threshold
🚨 alert (🔔)
2.54 s
(+28.19%)Baseline: 1.98 s
2.08 s
(122.08%)

tests/benchmarks/test_big_array.py::test_big_array_executableLatency
seconds (s)
📈 plot
🚷 threshold
🚨 alert (🔔)
8.75 s
(+10.18%)Baseline: 7.94 s
8.34 s
(104.93%)

tests/benchmarks/test_ctrl_flow.py::test_many_ctrl_flow_checkLatency
milliseconds (ms)
📈 plot
🚷 threshold
🚨 alert (🔔)
546.62 ms
(+875.50%)Baseline: 56.03 ms
58.84 ms
(929.05%)

tests/benchmarks/test_ctrl_flow.py::test_many_ctrl_flow_compileLatency
milliseconds (ms)
📈 plot
🚷 threshold
🚨 alert (🔔)
605.35 ms
(+135.35%)Baseline: 257.22 ms
270.08 ms
(224.14%)

tests/benchmarks/test_ctrl_flow.py::test_many_ctrl_flow_executableLatency
milliseconds (ms)
📈 plot
🚷 threshold
🚨 alert (🔔)
1,111.87 ms
(+76.83%)Baseline: 628.79 ms
660.22 ms
(168.41%)

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
🚨 view alert (🔔)
1,232,667.58 µs
(+72.95%)Baseline: 712,730.16 µs
748,366.66 µs
(164.71%)

tests/benchmarks/test_big_array.py::test_big_array_compile📈 view plot
🚷 view threshold
🚨 view alert (🔔)
2,537,334.46 µs
(+28.19%)Baseline: 1,979,368.46 µs
2,078,336.88 µs
(122.08%)

tests/benchmarks/test_big_array.py::test_big_array_executable📈 view plot
🚷 view threshold
🚨 view alert (🔔)
8,749,287.16 µs
(+10.18%)Baseline: 7,941,112.65 µs
8,338,168.29 µs
(104.93%)

tests/benchmarks/test_ctrl_flow.py::test_many_ctrl_flow_check📈 view plot
🚷 view threshold
🚨 view alert (🔔)
546,615.44 µs
(+875.50%)Baseline: 56,034.17 µs
58,835.88 µs
(929.05%)

tests/benchmarks/test_ctrl_flow.py::test_many_ctrl_flow_compile📈 view plot
🚷 view threshold
🚨 view alert (🔔)
605,352.07 µs
(+135.35%)Baseline: 257,216.80 µs
270,077.64 µs
(224.14%)

tests/benchmarks/test_ctrl_flow.py::test_many_ctrl_flow_executable📈 view plot
🚷 view threshold
🚨 view alert (🔔)
1,111,869.52 µs
(+76.83%)Baseline: 628,785.04 µs
660,224.29 µs
(168.41%)

tests/benchmarks/test_prelude.py::test_import_guppy📈 view plot
🚷 view threshold
51.99 µs
(-3.54%)Baseline: 53.89 µs
56.59 µs
(91.87%)
🐰 View full continuous benchmarking report in Bencher

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.

[Feature]: Automatically generate function declaration ASTs from Guppy signatures

2 participants