-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parse flow parameter docstrings and add it to parameter description #8004
Conversation
✅ Deploy Preview for prefect-orion ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site settings. |
HI! This looks pretty cool and I believe it would be a welcome addition. I think that you can use griffe to parse docstrings instead of implementing it yourself, I think we do this elsewhere for blocks? @ahuang11 / @desertaxle are the experts on this. |
We do indeed use |
…into docstring_parameter_parser
happy to use griffe instead. I also removed some now superfluous tests which were only testing the parser itself. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Thank you!
One minor tweak: Can you change the tests in test_callables.py
to be for functions that aren't flows? Our utilities aren't supposed to have knowledge of Prefect concepts (as a separation of concerns). It'd be great to have a test in test_flows.py
that covers a basic case of this for a flow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this! I have a few suggestions, but looks good to me!
@madkinsz thanks for pointing out the issue with non-flow functions. I retrieved the docstring from the flow description which is not only problematic for non-flow functions but also if the default description is overwritten. Now retrieving it directly via inspect. |
I'm afraid that I don't fully understand how the changes from this PR cause some unrelated tests to fail. Please let me know how I can contribute so that this can be merged. |
Yeah the changes from this PR are unrelated; I think it's because there was a new version of httpx that was released that broke the tests. Testing locally, Can't find a mention about it though: Oh I found it here: encode/httpx#2523 |
…8004) Co-authored-by: Justin Trautmann <justin@live-eo.com> Co-authored-by: Michael Adkins <michael@prefect.io>
…8004) Co-authored-by: Justin Trautmann <justin@live-eo.com> Co-authored-by: Michael Adkins <michael@prefect.io>
…8004) Co-authored-by: Justin Trautmann <justin@live-eo.com> Co-authored-by: Michael Adkins <michael@prefect.io>
prepares fix for #3740
Adds parsing for flow docstrings in Google docstring style and saves docstring in the description field in properties of ParameterSchema.
This would make it possible to fetch the parameter docstring from the deployment endpoint and enable the display of a help text next to the parameter input field in the flow submission form in the UI as requested in #3740. Requires adaptation of the UI to display its full potential.
Example
When deploying a flow that contains a docstring in Google docstring style, the docstring for each parameter is parsed and added to the ParameterSchema, which is stored in the DB and made available via the API.
flow_with_docstring.py:
Checklist
<link to issue>
"fix
,feature
,enhancement