[GitHub] [spark] HyukjinKwon commented on a change in pull request #29188: [SPARK-32179][SPARK-32188][PYTHON][DOCS] Replace and redesign the documentation base

2020-07-23 Thread GitBox


HyukjinKwon commented on a change in pull request #29188:
URL: https://github.com/apache/spark/pull/29188#discussion_r459243054



##
File path: python/pyspark/sql/functions.py
##
@@ -1196,6 +1196,8 @@ def to_date(col, format=None):
 By default, it follows casting rules to 
:class:`pyspark.sql.types.DateType` if the format
 is omitted. Equivalent to ``col.cast("date")``.
 
+.. _datetime pattern: 
https://spark.apache.org/docs/latest/sql-ref-datetime-pattern.html

Review comment:
   This is needed because we're now creating each page for each API. For 
example, see 
https://hyukjin-spark.readthedocs.io/en/stable/reference/api/pyspark.sql.functions.to_date.html





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] HyukjinKwon commented on a change in pull request #29188: [SPARK-32179][SPARK-32188][PYTHON][DOCS] Replace and redesign the documentation base

2020-07-22 Thread GitBox


HyukjinKwon commented on a change in pull request #29188:
URL: https://github.com/apache/spark/pull/29188#discussion_r459184480



##
File path: dev/requirements.txt
##
@@ -3,3 +3,4 @@ jira==1.0.3
 PyGithub==1.26.0
 Unidecode==0.04.19
 sphinx
+pydata_sphinx_theme

Review comment:
   I thought about this for a while actually especially given the 
discussion we had before.
   `pydata_sphinx_theme` is actually relatively very new and it has [frequent 
releases](https://github.com/pandas-dev/pydata-sphinx-theme/tags). I would like 
to not pin the versions for now to promote dev people to keep it up to date.. 
maybe we could see how it goes if that sounds fine to you as well.





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] HyukjinKwon commented on a change in pull request #29188: [SPARK-32179][SPARK-32188][PYTHON][DOCS] Replace and redesign the documentation base

2020-07-22 Thread GitBox


HyukjinKwon commented on a change in pull request #29188:
URL: https://github.com/apache/spark/pull/29188#discussion_r459184480



##
File path: dev/requirements.txt
##
@@ -3,3 +3,4 @@ jira==1.0.3
 PyGithub==1.26.0
 Unidecode==0.04.19
 sphinx
+pydata_sphinx_theme

Review comment:
   I thought about this for a while actually especially given the 
discussion we had before.
   `pydata_sphinx_theme` is actually relatively very new and it has [frequent 
releases](https://github.com/pandas-dev/pydata-sphinx-theme/tags). I would like 
to not pin the versions for now and see how it goes if that sounds fine to you 
as well.





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] HyukjinKwon commented on a change in pull request #29188: [SPARK-32179][SPARK-32188][PYTHON][DOCS] Replace and redesign the documentation base

2020-07-22 Thread GitBox


HyukjinKwon commented on a change in pull request #29188:
URL: https://github.com/apache/spark/pull/29188#discussion_r458688852



##
File path: python/docs/source/conf.py
##
@@ -14,12 +14,23 @@
 
 import sys
 import os
+import shutil
 
 # If extensions (or modules to document with autodoc) are in another directory,
 # add these directories to sys.path here. If the directory is relative to the
 # documentation root, use os.path.abspath to make it absolute, like shown here.
 sys.path.insert(0, os.path.abspath('.'))
 
+# Remove previously generated rst files. Ignore errors just in case it stops
+# generating whole docs.
+shutil.rmtree(
+"%s/reference/api" % os.path.dirname(os.path.abspath(__file__)), 
ignore_errors=True)

Review comment:
   `autosummary` generates RST files but don't remove it back. Here we 
always remove the generated RST files so the leftover doesn't cause any side 
effect.





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] HyukjinKwon commented on a change in pull request #29188: [SPARK-32179][SPARK-32188][PYTHON][DOCS] Replace and redesign the documentation base

2020-07-22 Thread GitBox


HyukjinKwon commented on a change in pull request #29188:
URL: https://github.com/apache/spark/pull/29188#discussion_r458688468



##
File path: python/docs/source/_templates/class_with_docs.rst
##
@@ -0,0 +1,79 @@
+..  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.
+
+
+{{ objname }}
+{{ underline }}
+
+.. currentmodule:: {{ module }}
+
+.. autoclass:: {{ objname }}
+
+{% if '__init__' in methods %}
+  {% set caught_result = methods.remove('__init__') %}
+{% endif %}
+
+{% block methods_summary %}
+{% if methods %}
+
+.. rubric:: Methods
+
+.. autosummary::
+{% for item in methods %}
+   ~{{ name }}.{{ item }}
+{%- endfor %}
+
+{% endif %}
+{% endblock %}
+
+{% block attributes_summary %}
+{% if attributes %}
+
+.. rubric:: Attributes
+
+.. autosummary::
+{% for item in attributes %}
+   ~{{ name }}.{{ item }}
+{%- endfor %}
+
+{% endif %}
+{% endblock %}
+
+{% block methods_documentation %}
+{% if methods %}
+
+.. rubric:: Methods Documentation
+
+{% for item in methods %}
+.. automethod:: {{ item }}
+{%- endfor %}
+
+{% endif %}
+{% endblock %}
+
+{% block attributes_documentation %}
+{% if attributes %}
+
+.. rubric:: Attributes Documentation
+
+{% for item in attributes %}
+.. autoattribute:: {{ item }}
+{%- endfor %}
+
+{% endif %}
+{% endblock %}
+

Review comment:
   This is needed to let `autusummary` plugin document the methods in a 
class. For example, when we use this template, it describes methods 
documentation on the bottom. See 
[pyspark.ml.Transformer](https://hyukjin-spark.readthedocs.io/en/stable/reference/api/pyspark.ml.Transformer.html#pyspark.ml.Transformer)
 as an example.
   
   Without this template, it only lists the methods and attributes without 
showing the documentation in details. See 
[pyspark.sql.DataFrameNaFunctions](https://hyukjin-spark.readthedocs.io/en/stable/reference/api/pyspark.sql.DataFrameNaFunctions.html#pyspark.sql.DataFrameNaFunctions)
 as an example.





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] HyukjinKwon commented on a change in pull request #29188: [SPARK-32179][SPARK-32188][PYTHON][DOCS] Replace and redesign the documentation base

2020-07-22 Thread GitBox


HyukjinKwon commented on a change in pull request #29188:
URL: https://github.com/apache/spark/pull/29188#discussion_r458688468



##
File path: python/docs/source/_templates/class_with_docs.rst
##
@@ -0,0 +1,79 @@
+..  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.
+
+
+{{ objname }}
+{{ underline }}
+
+.. currentmodule:: {{ module }}
+
+.. autoclass:: {{ objname }}
+
+{% if '__init__' in methods %}
+  {% set caught_result = methods.remove('__init__') %}
+{% endif %}
+
+{% block methods_summary %}
+{% if methods %}
+
+.. rubric:: Methods
+
+.. autosummary::
+{% for item in methods %}
+   ~{{ name }}.{{ item }}
+{%- endfor %}
+
+{% endif %}
+{% endblock %}
+
+{% block attributes_summary %}
+{% if attributes %}
+
+.. rubric:: Attributes
+
+.. autosummary::
+{% for item in attributes %}
+   ~{{ name }}.{{ item }}
+{%- endfor %}
+
+{% endif %}
+{% endblock %}
+
+{% block methods_documentation %}
+{% if methods %}
+
+.. rubric:: Methods Documentation
+
+{% for item in methods %}
+.. automethod:: {{ item }}
+{%- endfor %}
+
+{% endif %}
+{% endblock %}
+
+{% block attributes_documentation %}
+{% if attributes %}
+
+.. rubric:: Attributes Documentation
+
+{% for item in attributes %}
+.. autoattribute:: {{ item }}
+{%- endfor %}
+
+{% endif %}
+{% endblock %}
+

Review comment:
   This is needed to let `autosummary` plugin document the methods in a 
class. For example, when we use this template, it describes methods 
documentation on the bottom. See 
[pyspark.ml.Transformer](https://hyukjin-spark.readthedocs.io/en/stable/reference/api/pyspark.ml.Transformer.html#pyspark.ml.Transformer)
 as an example.
   
   Without this template, it only lists the methods and attributes without 
showing the documentation in details. See 
[pyspark.sql.DataFrameNaFunctions](https://hyukjin-spark.readthedocs.io/en/stable/reference/api/pyspark.sql.DataFrameNaFunctions.html#pyspark.sql.DataFrameNaFunctions)
 as an example.





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] HyukjinKwon commented on a change in pull request #29188: [SPARK-32179][SPARK-32188][PYTHON][DOCS] Replace and redesign the documentation base

2020-07-22 Thread GitBox


HyukjinKwon commented on a change in pull request #29188:
URL: https://github.com/apache/spark/pull/29188#discussion_r458686040



##
File path: .gitignore
##
@@ -64,6 +64,7 @@ python/lib/pyspark.zip
 python/.eggs/
 python/deps
 python/docs/_site/
+python/docs/source/reference/api/

Review comment:
   This is generated by `autosummary` plugin in Sphinx when 
`autosummary_generate` in `conf.py` is enabled. Each page of API or class under 
`autosummary` directive, for example, 
[`DataFrame.alias`](https://hyukjin-spark.readthedocs.io/en/stable/reference/api/pyspark.sql.DataFrame.alias.html#pyspark.sql.DataFrame.alias)
 will be generated via that plugin as RST files.





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org