diff --git a/ci/travis_script_python.sh b/ci/travis_script_python.sh index 604cd1391629..680eb01158d8 100755 --- a/ci/travis_script_python.sh +++ b/ci/travis_script_python.sh @@ -123,7 +123,7 @@ python_version_tests() { if [[ "$PYTHON_VERSION" == "3.6" ]] then pip install -r doc/requirements.txt - python setup.py build_sphinx + python setup.py build_sphinx -s doc/source fi } diff --git a/python/cmake_modules/UseCython.cmake b/python/cmake_modules/UseCython.cmake index cee6066d31de..7c06b023db2c 100644 --- a/python/cmake_modules/UseCython.cmake +++ b/python/cmake_modules/UseCython.cmake @@ -64,7 +64,7 @@ set( CYTHON_NO_DOCSTRINGS OFF CACHE BOOL "Strip docstrings from the compiled module." ) set( CYTHON_FLAGS "" CACHE STRING "Extra flags to the cython compiler." ) -mark_as_advanced( CYTHON_ANNOTATE CYTHON_NO_DOCSTRINGS CYTHON_FLAGS ) +mark_as_advanced( CYTHON_ANNOTATE CYTHON_NO_DOCSTRINGS CYTHON_FLAGS) find_package( Cython REQUIRED ) find_package( PythonLibsNew REQUIRED ) @@ -131,7 +131,8 @@ function( compile_pyx _name pyx_target_name generated_files pyx_file) # Add the command to run the compiler. add_custom_target(${pyx_target_name} COMMAND ${CYTHON_EXECUTABLE} ${cxx_arg} ${include_directory_arg} - ${annotate_arg} ${no_docstrings_arg} ${cython_debug_arg} ${CYTHON_FLAGS} + ${annotate_arg} ${no_docstrings_arg} ${cython_debug_arg} + ${CYTHON_FLAGS} --output-file "${_name}.${extension}" ${pyx_location} DEPENDS ${pyx_location} # do not specify byproducts for now since they don't work with the older diff --git a/python/doc/.gitignore b/python/doc/.gitignore index 87d04134d6fc..3bee39fa36fe 100644 --- a/python/doc/.gitignore +++ b/python/doc/.gitignore @@ -1,3 +1,19 @@ -# auto-generated module documentation -pyarrow*.rst -modules.rst +# 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. + +_build +source/generated \ No newline at end of file diff --git a/python/doc/Makefile b/python/doc/Makefile index 725758395248..65d6a4df3b20 100644 --- a/python/doc/Makefile +++ b/python/doc/Makefile @@ -22,9 +22,9 @@ BUILDDIR = _build # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter -ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . +ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source # the i18n builder cannot share the environment and doctrees with the others -I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . +I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source .PHONY: help help: diff --git a/python/doc/source/_static/stub b/python/doc/source/_static/stub new file mode 100644 index 000000000000..765c78f7bc0d --- /dev/null +++ b/python/doc/source/_static/stub @@ -0,0 +1,18 @@ +/** + * 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. + */ \ No newline at end of file diff --git a/python/doc/source/api.rst b/python/doc/source/api.rst new file mode 100644 index 000000000000..514dcf966f8c --- /dev/null +++ b/python/doc/source/api.rst @@ -0,0 +1,153 @@ +.. 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. + +.. currentmodule:: pyarrow +.. _api: + +************* +API Reference +************* + +.. _api.functions: + +Type Metadata and Schemas +------------------------- + +.. autosummary:: + :toctree: generated/ + + null + bool_ + int8 + int16 + int32 + int64 + uint8 + uint16 + uint32 + uint64 + float16 + float32 + float64 + timestamp + date32 + date64 + binary + string + decimal + list_ + struct + dictionary + field + DataType + Field + Schema + schema + +Scalar Value Types +------------------ + +.. autosummary:: + :toctree: generated/ + + NA + NAType + Scalar + ArrayValue + Int8Value + Int16Value + Int32Value + Int64Value + UInt8Value + UInt16Value + UInt32Value + UInt64Value + FloatValue + DoubleValue + ListValue + BinaryValue + StringValue + FixedSizeBinaryValue + +Array Types +----------- + +.. autosummary:: + :toctree: generated/ + + Array + NumericArray + IntegerArray + FloatingPointArray + BooleanArray + Int8Array + Int16Array + Int32Array + Int64Array + UInt8Array + UInt16Array + UInt32Array + UInt64Array + DictionaryArray + StringArray + +Tables and Record Batches +------------------------- + +.. autosummary:: + :toctree: generated/ + + Column + RecordBatch + Table + +Tensor type and Functions +------------------------- + +.. autosummary:: + :toctree: generated/ + + Tensor + write_tensor + get_tensor_size + read_tensor + +Input / Output and Shared Memory +-------------------------------- + +.. autosummary:: + :toctree: generated/ + + Buffer + BufferReader + InMemoryOutputStream + NativeFile + MemoryMappedFile + memory_map + create_memory_map + PythonFileInterface + +Interprocess Communication and Messaging +---------------------------------------- + +.. autosummary:: + :toctree: generated/ + + FileReader + FileWriter + StreamReader + StreamWriter diff --git a/python/doc/conf.py b/python/doc/source/conf.py similarity index 96% rename from python/doc/conf.py rename to python/doc/source/conf.py index e817bbdd42bd..a9262bf7db3d 100644 --- a/python/doc/conf.py +++ b/python/doc/source/conf.py @@ -29,19 +29,8 @@ import os import sys -from sphinx import apidoc - import sphinx_rtd_theme - -__location__ = os.path.join(os.getcwd(), os.path.dirname( - inspect.getfile(inspect.currentframe()))) -output_dir = os.path.join(__location__) -module_dir = os.path.join(__location__, "..", "pyarrow") -cmd_line_template = "sphinx-apidoc -f -e -o {outputdir} {moduledir}" -cmd_line = cmd_line_template.format(outputdir=output_dir, moduledir=module_dir) -apidoc.main(cmd_line.split(" ")) - on_rtd = os.environ.get('READTHEDOCS') == 'True' if not on_rtd: @@ -49,6 +38,12 @@ # build pyarrow there. sys.path.insert(0, os.path.abspath('..')) +sys.path.extend([ + os.path.join(os.path.dirname(__file__), + '..', '../..') + +]) + # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. @@ -64,7 +59,7 @@ 'sphinx.ext.doctest', 'sphinx.ext.mathjax', 'sphinx.ext.viewcode', - 'sphinx.ext.napoleon' + 'sphinx.ext.napoleon', ] # numpydoc configuration @@ -79,6 +74,9 @@ # source_suffix = ['.rst', '.md'] source_suffix = '.rst' +import glob +autosummary_generate = glob.glob("*.rst") + # The encoding of source files. # # source_encoding = 'utf-8-sig' diff --git a/python/doc/filesystems.rst b/python/doc/source/filesystems.rst similarity index 100% rename from python/doc/filesystems.rst rename to python/doc/source/filesystems.rst diff --git a/python/doc/getting_involved.rst b/python/doc/source/getting_involved.rst similarity index 100% rename from python/doc/getting_involved.rst rename to python/doc/source/getting_involved.rst diff --git a/python/doc/index.rst b/python/doc/source/index.rst similarity index 99% rename from python/doc/index.rst rename to python/doc/source/index.rst index 608fff5d57ba..ecb8e8f4830f 100644 --- a/python/doc/index.rst +++ b/python/doc/source/index.rst @@ -38,7 +38,7 @@ structures. pandas filesystems parquet - modules + api getting_involved .. toctree:: diff --git a/python/doc/install.rst b/python/doc/source/install.rst similarity index 100% rename from python/doc/install.rst rename to python/doc/source/install.rst diff --git a/python/doc/jemalloc.rst b/python/doc/source/jemalloc.rst similarity index 100% rename from python/doc/jemalloc.rst rename to python/doc/source/jemalloc.rst diff --git a/python/doc/pandas.rst b/python/doc/source/pandas.rst similarity index 100% rename from python/doc/pandas.rst rename to python/doc/source/pandas.rst diff --git a/python/doc/parquet.rst b/python/doc/source/parquet.rst similarity index 100% rename from python/doc/parquet.rst rename to python/doc/source/parquet.rst