feat: Generate expr method signatures, docs#3600
Merged
dangotbanned merged 86 commits intomainfrom Oct 12, 2024
Merged
Conversation
Similar idea to `inspect.Parameter`
Similar to `inspect.Signature`
- Only the most common case - no docs - No method body
Currently just collects the pieces, but doesn't render the final str
Also renamed constant `EXPR_ANNOTATION` -> `INPUT_ANNOTATION`
- Contains all the functionality - Needs a lot of tidying up
- Uses the same config as `indent_docstring` - Can't truly be `numpydoc` though without a parameters section
This was referenced Sep 21, 2024
dangotbanned
commented
Sep 23, 2024
dangotbanned
commented
Sep 28, 2024
Contributor
dangotbanned
commented
Sep 28, 2024
Member
Author
Well spotted @mattijn thank you! I'll follow this up in #3600 (comment) |
Not fully convinced this is a reliable alterntive to manually maintaining #3600 (comment)
…sion` - Found this to be a much more reliable source - Won't require manual syncing - Can easily be replaced in the future with a public function/attribute accessible in `vl_convert` itself #3600 (comment)
Member
Author
Note@mattijn I'm moving into draft to utilize #3633 and simplify #3600 (comment) |
Also moves away from using the legacy `python2` interace https://docs.python.org/3/library/urllib.request.html#legacy-interface
mattijn
approved these changes
Oct 11, 2024
Contributor
mattijn
left a comment
There was a problem hiding this comment.
Thanks for this PR. Looks good now!
Member
Author
Thanks for your help with this PR @mattijn One last thing I'd like to check before merging, from the Deferred section of the description
I can either:
|
Contributor
|
Option 3 is OK 👍 |
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Closes #3563
Description
This PR builds on the work of #3466, and provides accurate signatures for
alt.exprmethods.Benefits
Originally listed in #3563 (comment)
TypeErrorat the time ofexprdefinitionChartTypepythonand notjavascriptexprand the missing argument""for theelseValueScreenshots
Implementation
In #3563 I proposed authoring these changes manually.
However, after revisiting a conversation I had with @jonmmease I thought it would be worth at least trying to generate the definitions.
I found that https://vega.github.io/vega/docs/expressions/ seemed to be the only place they are documented in a single place.
From my understanding, this document is manually maintained but updates occur infrequently.
There was enough consistency in the markup used to work out how various parameters aligned with
pythonsyntax https://docs.python.org/3/tutorial/controlflow.html#special-parameters.I also used this opportunity to clean up the docs themselves, and get them closer to the rest of
altair.There is definitely more that could be explored on that front, and some of the changes here could be utilised to improve the existing generated docs.
Related
expras a class that is understood by IDEs #3466Tasks
py-equivalent signaturesaltairfunctionsbackticksfor own parametersmistuneescapingtest_expr.pyto account for number of arguments relatedalt.expr.__init__.py.rststuff commitvega_expr.pyexprmethod signatures, docs #3600 (review)Deferred
Trying my best to keep the scope of the PR focused.
Working on this sparked a lot of ideas, so I've collected those here to possibly explore in the future:
expressions.mdtools.schemapi.vega_expr.py->tools.vega_expr.pyvega-liteschemaexprmethods, replace w/ snake_case_ExprMeta.__getattr__would make this possible(Early) Preview
Prior to
5e75051(#3600) there wasn't any generated source on this branch.Keeping these screenshots for a quick reference
until I've resolved some test issues.Screenshots