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

Custom Sphinx Extension: PandasCompat #8643

Merged
merged 5 commits into from
Jul 21, 2021

Conversation

isVoid
Copy link
Contributor

@isVoid isVoid commented Jul 2, 2021

This PR adds a custom sphinx extension PandasCompat. This extension adds two new rST directives to cudf docs code base.

.. pandas-compat::
.. pandas-compat-list::

The former creates a new section in cudf docstring specifically to demonstrate the deviation that cudf has to pandas. The second directive collects all these sections and compile as a separate list. For example, in MultiIndex.get_loc:

The new section is rendered as an Admonition tag.
image

And there's a new separate page called Pandas Compatibility Notes that collects all notes in a single page.
image

Note that we can introduce a link in this page to the original source.

@isVoid isVoid requested a review from a team as a code owner July 2, 2021 05:11
@github-actions github-actions bot added the Python Affects Python cuDF API. label Jul 2, 2021
@isVoid isVoid added the doc Documentation label Jul 2, 2021
@isVoid isVoid self-assigned this Jul 2, 2021
@isVoid isVoid added the non-breaking Non-breaking change label Jul 2, 2021
@isVoid
Copy link
Contributor Author

isVoid commented Jul 2, 2021

This PR is at primitive stage, but should be ready to receive reviews (both code-wise and page aesthetics).

@codecov
Copy link

codecov bot commented Jul 2, 2021

Codecov Report

❗ No coverage uploaded for pull request base (branch-21.08@397bf0a). Click here to learn what that means.
The diff coverage is n/a.

❗ Current head c1878ab differs from pull request most recent head ee3bda9. Consider uploading reports for the commit ee3bda9 to get more accurate results
Impacted file tree graph

@@               Coverage Diff               @@
##             branch-21.08    #8643   +/-   ##
===============================================
  Coverage                ?   10.67%           
===============================================
  Files                   ?      109           
  Lines                   ?    18670           
  Branches                ?        0           
===============================================
  Hits                    ?     1993           
  Misses                  ?    16677           
  Partials                ?        0           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 397bf0a...ee3bda9. Read the comment docs.

@quasiben
Copy link
Member

quasiben commented Jul 2, 2021

Thanks for looking at this @isVoid -- this is really great! I especially like having both compat notices inlined with api docs and a separate page.

cc @jfpuget

@isVoid
Copy link
Contributor Author

isVoid commented Jul 2, 2021

@galipremsagar I think it would also be great to review this extension in the context of pydata sphinx theme.

@vyasr vyasr self-requested a review July 8, 2021 16:13
Copy link
Contributor

@vyasr vyasr left a comment

Choose a reason for hiding this comment

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

This is great! Also you weren't kidding, the Sphinx TODO example covers our needs here almost exactly. Since you largely just mimicked it I don't have a ton to comment on, but I learned a lot reading it.

docs/cudf/source/_ext/PandasCompat.py Outdated Show resolved Hide resolved
docs/cudf/source/_ext/PandasCompat.py Outdated Show resolved Hide resolved
@isVoid isVoid added the 3 - Ready for Review Ready for review by team label Jul 16, 2021
@galipremsagar galipremsagar added 5 - Ready to Merge Testing and reviews complete, ready to merge and removed 3 - Ready for Review Ready for review by team labels Jul 21, 2021
@galipremsagar
Copy link
Contributor

@vyasr could you have another look at it before we merge this?

Copy link
Contributor

@vyasr vyasr left a comment

Choose a reason for hiding this comment

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

This looks great to me! One minor comment @isVoid if you can easily verify that it would be nice but it's not a blocker.

Once this is merged we need to make a plan for making use of this new directive in the rest of our docstrings, how should we do that? Perhaps we should make a follow-up issue to track that work.

Pandas Compatibility Notes
==========================

.. pandas-compat-list::
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe the trailing :: is redundant in this case since you're not passing any arguments, but it's probably fine to leave it as is unless you're in a position to test and remove fairly quickly.

@harrism
Copy link
Member

harrism commented Jul 21, 2021

This looks great to me! One minor comment @isVoid if you can easily verify that it would be nice but it's not a blocker.

Once this is merged we need to make a plan for making use of this new directive in the rest of our docstrings, how should we do that? Perhaps we should make a follow-up issue to track that work.

@vyasr or @isVoid please open an issue for this.

@harrism
Copy link
Member

harrism commented Jul 21, 2021

@gpucibot merge

@rapids-bot rapids-bot bot merged commit 7ea7f15 into rapidsai:branch-21.08 Jul 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5 - Ready to Merge Testing and reviews complete, ready to merge doc Documentation non-breaking Non-breaking change Python Affects Python cuDF API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants