Skip to content
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

docs(python): improve rendering of API docs type signatures, mark PivotOps as deprecated, misc tidy-ups #5388

Merged
merged 2 commits into from
Nov 1, 2022

Conversation

alexander-beedie
Copy link
Collaborator

@alexander-beedie alexander-beedie commented Oct 31, 2022

Signatures

Found a proper Sphinx build-event hook (autodoc-process-signature) to take advantage of to try and minimise private classpaths. Annoyingly the event doesn't appear to trigger on every signature, but it does take care of a lot of them. Not obvious why some functions are missed - possibly connected to parsing of @overload, but not confirmed yet.

The newly-registered event handler just applies a simple regex to strip any private paths that appear in the signature; it doesn't look at the rest of the docstring (the mutating function itself, along with registration for the event, can be found in conf.py).

Before: (polars.internals.expr.expr.Expr)

api_docs_typing_before

After: (Expr)

api_docs_typing_after

Misc

  • Added deprecation annotations to PivotOps.
  • Reduced polars.datatypes.XYZ to polars.XYZ in sidebar nav.
  • Other minor tidy-ups (such as sorting data/lazyframe subsections).
  • When creating a new venv (make), don't forget about requirements-docs.txt :)

Contributes to #4156.
More to come...

…te classpath, order frame subsections, add "deprecated" annotation to PivotOps
@github-actions github-actions bot added docs python Related to Python Polars labels Oct 31, 2022
Copy link
Member

@stinodego stinodego left a comment

Choose a reason for hiding this comment

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

Really happy with this change and your other recent API reference contributions. These have been a thorn in my eye for so long... 👏

@ritchie46
Copy link
Member

That's a huge improvement!

@alexander-beedie
Copy link
Collaborator Author

Hopefully I can extend the approach and get every last one of them; the handful that don't get processed by this event (eg: polars.align_frames) really stand out now ;p

@ritchie46 ritchie46 merged commit 9dabbe5 into pola-rs:master Nov 1, 2022
zundertj pushed a commit to zundertj/polars that referenced this pull request Jan 7, 2023
@stinodego stinodego added the documentation Improvements or additions to documentation label Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation python Related to Python Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants