Skip to content

feat(pyamber): support Python UDF UI parameters#5603

Open
carloea2 wants to merge 1 commit into
apache:mainfrom
carloea2:ui-parameter-backend-python
Open

feat(pyamber): support Python UDF UI parameters#5603
carloea2 wants to merge 1 commit into
apache:mainfrom
carloea2:ui-parameter-backend-python

Conversation

@carloea2

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

This PR adds Python runtime support for Python UDF UI parameters.

It introduces:

Area Change
PyTexera runtime API Adds self.UiParameter(...) support on Python UDF operator base classes.
Runtime injection bridge Adds the _texera_injected_ui_parameters base hook that the Scala injector overrides.
Typed parameter parsing Converts injected UI parameter values into Python values using AttributeType.
PyTexera exports Exports Dict, Any, and AttributeType through from pytexera import *, so generated code from the Scala injector loads correctly.
Attribute type compatibility Adds Python enum aliases for AttributeType.INTEGER and AttributeType.BOOLEAN, matching the frontend parser’s accepted tokens.
Follow-up cleanup from PR #5141 Removes the temporary generated-code comment that described this runtime PR as a future dependency.
Test coverage Adds PyAmber tests for injected values, parsing, duplicate declarations, unsupported types, enum aliases, and instance-local state.

This PR is stacked after the merged frontend foundation PR #5043 and Scala backend injection PR #5141. It does not wire UI parameters into operator execution end to end; that integration is handled by the next PR in the stack.

Any related issues, documentation, discussions?

Part of the Python UDF UI parameter feature split from feat/ui-parameter.

Related tracking issue / stack: #5044

Stack order:

  1. Frontend UI parameter building blocks: feat(frontend): add Python UDF UI parameter form support #5043
  2. Scala backend injection model: feat(workflow-operator): add Python UDF UI parameter injection model #5141
  3. Python runtime support: this PR
  4. End-to-end integration

How was this PR tested?

Commands run:

cd amber
ruff check src/main/python/core/models/schema/attribute_type.py src/main/python/pytexera/udf/udf_operator.py src/test/python/pytexera/udf/test_udf_operator.py
pytest src/test/python/pytexera/udf/test_udf_operator.py -q
pytest src/test/python/pytexera/udf -q

@carloea2

Copy link
Copy Markdown
Contributor Author

@Xiao-zhen-Liu could you review it?

@codecov-commenter

codecov-commenter commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.00000% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 53.80%. Comparing base (cd60535) to head (d7fb00c).

Files with missing lines Patch % Lines
amber/src/main/python/pytexera/udf/udf_operator.py 89.18% 8 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #5603      +/-   ##
============================================
+ Coverage     52.42%   53.80%   +1.37%     
+ Complexity     2481     1424    -1057     
============================================
  Files          1070      802     -268     
  Lines         41359    33333    -8026     
  Branches       4441     3345    -1096     
============================================
- Hits          21682    17934    -3748     
+ Misses        18406    14533    -3873     
+ Partials       1271      866     -405     
Flag Coverage Δ *Carryforward flag
access-control-service 64.61% <ø> (ø)
agent-service 33.76% <ø> (ø) Carriedforward from cd60535
amber 59.76% <100.00%> (+6.47%) ⬆️
computing-unit-managing-service 1.65% <ø> (ø)
config-service 56.06% <ø> (ø)
file-service 38.21% <ø> (ø)
frontend 47.03% <ø> (ø) Carriedforward from cd60535
pyamber 90.69% <89.87%> (-0.03%) ⬇️
python 90.74% <ø> (-0.02%) ⬇️ Carriedforward from cd60535
workflow-compiling-service 58.69% <ø> (ø)

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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