Repository navigation
Proposal: Python UDF parameters that are picked, not typed — a dropdown and the dataset browser #9338
yangzhang75
started this conversation in
Ideas
Replies: 3 comments
|
In general, I think this is a good feature. Users should be able to access Texera resources, especially datasets and files, more easily from Python UDFs without having to manually type paths. Regarding the implementation details, I'd like to hear @carloea2's thoughts. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
A Python UDF declares its own parameters in its code, and whoever runs the workflow fills them in from the property panel, or on the Form View from the form. A parameter that names a model or a dataset opens a picker; every other one is a text box, whatever the value means.
This proposal lets a parameter say what it accepts, and makes the picker that already exists reach a file and work everywhere. One that lists its values gets a dropdown. One that names a dataset, or a file in one, gets the browser Texera already has. One that says nothing is unchanged.
Demo
Screen.Recording.2026-11-05.at.1.05.27.PM.mov
Why
A file has to be spelled out by hand. A dataset is a versioned container, and each version holds a file tree. The picker stops at the version, so whoever runs the workflow types the rest of the path exactly right, although Texera lists every file a click away elsewhere.
Nothing says what a box accepts. A parameter that takes one of three methods looks like a parameter that takes any text. A wrong value surfaces when the UDF runs, if at all. The author can only say what is expected in words: the input's help text, or the instructions on the form.
Proposal
A parameter says what it accepts in the same call that already gives it a name and a type.
1. A parameter can list its values
It renders as a dropdown of those values, on the panel and on the form. A value already filled in survives a change to the list, unless the new list no longer offers it.
2. A parameter can name a dataset version, or one file in it
Naming a dataset this way already exists; these are two members of the enum it already uses, so there is one way to point a parameter at a resource, not two. Each browser only answers what was asked for: the version picker cannot return a file, and the file picker cannot be confirmed until a file is chosen. Two things change.
A file can be picked at all. Today the picker stops at the version, so a UDF that opens one file has whoever fills the form pick the version and type the file name after it.
What the UDF receives can be read on any deployment. Today it is a folder path, and that folder only exists on a Kubernetes computing unit, so a workflow written this way fails on a local one. Handing over the dataset's own path instead lets the same workflow run in both places: pytexera reads that path through the dataset API, which every deployment has.
3. The declaration comes from the code
The frontend already reads each parameter's name and type out of the UDF source, and what it accepts comes from the same place. It is read again whenever the workflow is opened, so it stays in step with the code, and a workflow built by a script or imported from a file shows its controls too. The copy stored with the workflow is a cache.
The declaration drives the UI only. The backend does not reject a value outside the declared set: the stored set can be older than the code, and rejecting a value would tell an author their own code is wrong.
Thoughts on any of this are welcome.
All reactions