-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-46103][PYTHON][INFRA][BUILD][DOCS] Enhancing PySpark documentation #44012
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
Changes from all commits
8dd74da
fcc368d
bc1bfc6
d85133e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,12 +31,12 @@ pandas-stubs<1.2.0.54 | |
| mkdocs | ||
|
|
||
| # Documentation (Python) | ||
| pydata_sphinx_theme | ||
| pydata_sphinx_theme==0.13 | ||
| ipython | ||
| nbsphinx | ||
| numpydoc | ||
| jinja2<3.0.0 | ||
| sphinx<3.1.0 | ||
| jinja2 | ||
| sphinx==4.2.0 | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see that other Sphinx versions do not generate documentation properly for some reason. I have tested as many combinations as possible with Jinja2 and pydata_sphinx_theme, but I have confirmed that Sphinx version 4.2.0 currently renders documents in the most optimal form. Will investigate further in the future to support the latest Sphinx if necessary. |
||
| sphinx-plotly-directive | ||
| sphinx-copybutton | ||
| docutils<0.18.0 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| {{ fullname }} | ||
| {{ underline }} | ||
|
|
||
| .. currentmodule:: {{ module + "." + objname.split(".")[0] }} | ||
|
|
||
| .. autoattribute:: {{ ".".join(objname.split(".")[1:]) }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| {{ fullname }} | ||
| {{ underline }} | ||
|
|
||
| .. currentmodule:: {{ module + "." + objname.split(".")[0] }} | ||
|
|
||
| .. automethod:: {{ ".".join(objname.split(".")[1:]) }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -47,7 +47,9 @@ | |
|
|
||
| .. autosummary:: | ||
| {% for item in attributes %} | ||
| ~{{ name }}.{{ item }} | ||
| {% if not (item == 'uid') %} | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should manually exclude |
||
| ~{{ name }}.{{ item }} | ||
| {% endif %} | ||
| {%- endfor %} | ||
|
|
||
| {% endif %} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| .. Licensed to the Apache Software Foundation (ASF) under one | ||
| or more contributor license agreements. See the NOTICE file | ||
| distributed with this work for additional information | ||
| regarding copyright ownership. The ASF licenses this file | ||
| to you under the Apache License, Version 2.0 (the | ||
| "License"); you may not use this file except in compliance | ||
| with the License. You may obtain a copy of the License at | ||
|
|
||
| .. http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| .. Unless required by applicable law or agreed to in writing, | ||
| software distributed under the License is distributed on an | ||
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| KIND, either express or implied. See the License for the | ||
| specific language governing permissions and limitations | ||
| under the License. | ||
|
|
||
| {{ fullname }} | ||
| {{ underline }} | ||
|
|
||
| .. currentmodule:: {{ module + "." + objname.split(".")[0] }} | ||
|
|
||
| .. automethod:: {{ ".".join(objname.split(".")[1:]) }} | ||
|
|
||
| {% if '__init__' in methods %} | ||
| {% set caught_result = methods.remove('__init__') %} | ||
| {% endif %} | ||
|
|
||
| {% block methods %} | ||
| {% if methods %} | ||
|
|
||
| .. rubric:: Methods | ||
|
|
||
| .. autosummary:: | ||
| {% for item in methods %} | ||
| ~{{ name.split(".")[1] }}.{{ item }} | ||
| {%- endfor %} | ||
|
|
||
| {% endif %} | ||
| {% endblock %} | ||
|
|
||
| {% block attributes_summary %} | ||
| {% if attributes %} | ||
|
|
||
| .. rubric:: Attributes | ||
|
|
||
| .. autosummary:: | ||
| {% for item in attributes %} | ||
| ~{{ name.split(".")[1] }}.{{ item }} | ||
| {%- endfor %} | ||
|
|
||
| {% endif %} | ||
| {% endblock %} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -194,7 +194,11 @@ | |
| # further. For a list of options available for each theme, see the | ||
| # documentation. | ||
| html_theme_options = { | ||
| "navbar_end": ["version-switcher"] | ||
| "navbar_end": ["version-switcher", "theme-switcher"], | ||
| "logo": { | ||
| "image_light": "_static/spark-logo-light.png", | ||
| "image_dark": "_static/spark-logo-dark.png", | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FYI: The default mode for light/dark is |
||
| } | ||
| } | ||
|
|
||
| # Add any paths that contain custom themes here, relative to this directory. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -299,6 +299,7 @@ in Spark. These can be accessed by ``DataFrame.spark.<function/property>``. | |
|
|
||
| .. autosummary:: | ||
| :toctree: api/ | ||
| :template: autosummary/accessor_method.rst | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With the new version of Sphinx, the package name creation rules for This behavior is used in the same way in Pandas, so I referred to it.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For example, previously the rst file was created as follows: pyspark.sql.SparkSession.builder.appName
========================================
.. currentmodule:: pyspark.sql.SparkSession
.. automethod:: builder.appNameHowever, in newer Sphinx versions it is generated like this: pyspark.sql.SparkSession.builder.appName
========================================
.. currentmodule:: pyspark.sql
.. automethod:: SparkSession.builder.appNameIn the case of functions used through internal classes or accessors like this, the package paths created in a new way will cause Sphinx build to fail. That's why we should use the customized template to correct the module path. See also sphinx-doc/sphinx#7551. |
||
|
|
||
| DataFrame.spark.frame | ||
| DataFrame.spark.cache | ||
|
|
@@ -319,8 +320,8 @@ specific plotting methods of the form ``DataFrame.plot.<kind>``. | |
|
|
||
| .. autosummary:: | ||
| :toctree: api/ | ||
| :template: autosummary/accessor_method.rst | ||
|
|
||
| DataFrame.plot | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In newer versions of Sphinx, the build will fail because In fact, this behavior seems reasonable since |
||
| DataFrame.plot.area | ||
| DataFrame.plot.barh | ||
| DataFrame.plot.bar | ||
|
|
@@ -330,6 +331,10 @@ specific plotting methods of the form ``DataFrame.plot.<kind>``. | |
| DataFrame.plot.pie | ||
| DataFrame.plot.scatter | ||
| DataFrame.plot.density | ||
|
|
||
| .. autosummary:: | ||
| :toctree: api/ | ||
|
|
||
| DataFrame.hist | ||
| DataFrame.boxplot | ||
| DataFrame.kde | ||
|
|
@@ -341,6 +346,7 @@ These can be accessed by ``DataFrame.pandas_on_spark.<function/property>``. | |
|
|
||
| .. autosummary:: | ||
| :toctree: api/ | ||
| :template: autosummary/accessor_method.rst | ||
|
|
||
| DataFrame.pandas_on_spark.apply_batch | ||
| DataFrame.pandas_on_spark.transform_batch | ||
Uh oh!
There was an error while loading. Please reload this page.
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.
I followed the version used in Pandas, and actually I believe this version render the document in the most optimal form after doing several version testing.