Skip to content

feat: SDK - pipeline run parameters - dynamic choices (HEXA-1620)#385

Open
mrivar wants to merge 19 commits into
HEXA-1620-parameters-refactorfrom
HEXA-1620-parameter-dynamic-choices
Open

feat: SDK - pipeline run parameters - dynamic choices (HEXA-1620)#385
mrivar wants to merge 19 commits into
HEXA-1620-parameters-refactorfrom
HEXA-1620-parameter-dynamic-choices

Conversation

@mrivar
Copy link
Copy Markdown

@mrivar mrivar commented May 1, 2026

Related PRs:

Lets pipeline parameters load their valid choices from a file at runtime, rather than requiring a hardcoded list.

Changes

  • New ChoicesFromFile("path/to/file.csv") descriptor — supports CSV, JSON, YAML
  • String shorthand: choices="districts.csv" is equivalent to the explicit form
  • Both forms work in the @parameter decorator and are parsed correctly from pipeline source files (AST round-trip)
  • Refactored parameter.py into a parameter/ package (types, decorator, widgets, choices — each in their own file)

How/what to test

  • Write a pipeline with @parameter("district", type=str, choices="districts.csv") and check that the platform renders a dynamic dropdown populated from that file
  • Verify static list choices (choices=["UG", "KE"]) still work as before
  • Run pytest tests/test_choices.py

@mrivar mrivar marked this pull request as ready for review May 6, 2026 16:25
@mrivar mrivar changed the base branch from main to HEXA-1620-parameters-refactor May 11, 2026 09:44
mrivar added 2 commits May 11, 2026 11:47
…-dynamic-choices

 Conflicts:
	openhexa/sdk/pipelines/parameter/__init__.py
	openhexa/sdk/pipelines/parameter/decorator.py
Copy link
Copy Markdown
Contributor

@yolanfery yolanfery left a comment

Choose a reason for hiding this comment

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

Very very tricky one, but it looks good to me, well done

Cool tests as well 👌

No comment, just a comment related to the backend : I feel like the SDK shouldn't parse the file format but should delegate that to the backend based on extension and/or content. This would simplify interfaces

Comment thread tests/test_choices.py
Comment on lines +126 to +132
def test_decorator_with_string_shorthand(self):
@parameter(code="district", type=str, choices="districts.csv")
def my_pipeline(district):
pass

params = my_pipeline.get_all_parameters()
assert isinstance(params[0].choices, ChoicesFromFile)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cool test :)

@mrivar mrivar changed the title feature: pipeline run parameters - dynamic choices (HEXA-1620) feat: pipeline run parameters - dynamic choices (HEXA-1620) May 14, 2026
@mrivar mrivar changed the title feat: pipeline run parameters - dynamic choices (HEXA-1620) feat: SDK - pipeline run parameters - dynamic choices (HEXA-1620) May 14, 2026
Comment thread pyproject.toml
dependencies = [
"urllib3<3",
"multiprocess~=0.70.15",
"requests>=2.31,<2.34",
Copy link
Copy Markdown
Author

@mrivar mrivar May 14, 2026

Choose a reason for hiding this comment

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

Changed because we were getting an error on conda build:
https://github.com/BLSQ/openhexa-sdk-python/actions/runs/25662804662/job/75327513034

conda-forge recently published requests 2.34.1, which didn't exist when the previous pin was written

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