Skip to content

Commit

Permalink
Python docs (#179)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kimahriman authored Dec 16, 2024
1 parent 06bac9b commit 0593d5f
Show file tree
Hide file tree
Showing 18 changed files with 460 additions and 3 deletions.
29 changes: 28 additions & 1 deletion .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
container: 'off'
working-directory: ./python
args: --extras devel

- name: Run lints
run: |
source .venv/bin/activate
Expand All @@ -64,6 +64,33 @@ jobs:
source .venv/bin/activate
pytest
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.13

- name: Create virtualenv
run: |
python3 -m venv .venv
- uses: PyO3/maturin-action@v1
with:
command: develop
sccache: 'true'
container: 'off'
working-directory: ./python
args: --extras docs

- name: Build docs
run: |
source .venv/bin/activate
sphinx-build -M html docs/source/ docs/build/
build:
runs-on: ubuntu-latest
steps:
Expand Down
31 changes: 31 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the OS, Python version and other tools you might need
build:
os: ubuntu-24.04
tools:
python: "3.13"

# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: python/docs/conf.py

# Optionally build your docs in additional formats such as PDF and ePub
# formats:
# - pdf
# - epub

# Optional but recommended, declare the Python requirements required
# to build your documentation
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
- method: pip
path: python
extra_requirements:
- docs
20 changes: 20 additions & 0 deletions python/docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
35 changes: 35 additions & 0 deletions python/docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
5 changes: 5 additions & 0 deletions python/docs/source/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
API
===

.. automodapi:: hdfs_native
:no-inheritance-diagram:
23 changes: 23 additions & 0 deletions python/docs/source/api/hdfs_native.AclEntry.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
AclEntry
========

.. currentmodule:: hdfs_native

.. autoclass:: AclEntry
:show-inheritance:

.. rubric:: Attributes Summary

.. autosummary::

~AclEntry.name
~AclEntry.permissions
~AclEntry.scope
~AclEntry.type

.. rubric:: Attributes Documentation

.. autoattribute:: name
.. autoattribute:: permissions
.. autoattribute:: scope
.. autoattribute:: type
25 changes: 25 additions & 0 deletions python/docs/source/api/hdfs_native.AclStatus.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
AclStatus
=========

.. currentmodule:: hdfs_native

.. autoclass:: AclStatus
:show-inheritance:

.. rubric:: Attributes Summary

.. autosummary::

~AclStatus.entries
~AclStatus.group
~AclStatus.owner
~AclStatus.permission
~AclStatus.sticky

.. rubric:: Attributes Documentation

.. autoattribute:: entries
.. autoattribute:: group
.. autoattribute:: owner
.. autoattribute:: permission
.. autoattribute:: sticky
53 changes: 53 additions & 0 deletions python/docs/source/api/hdfs_native.Client.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
Client
======

.. currentmodule:: hdfs_native

.. autoclass:: Client
:show-inheritance:

.. rubric:: Methods Summary

.. autosummary::

~Client.append
~Client.create
~Client.delete
~Client.get_acl_status
~Client.get_content_summary
~Client.get_file_info
~Client.list_status
~Client.mkdirs
~Client.modify_acl_entries
~Client.read
~Client.remove_acl
~Client.remove_acl_entries
~Client.remove_default_acl
~Client.rename
~Client.set_acl
~Client.set_owner
~Client.set_permission
~Client.set_replication
~Client.set_times

.. rubric:: Methods Documentation

.. automethod:: append
.. automethod:: create
.. automethod:: delete
.. automethod:: get_acl_status
.. automethod:: get_content_summary
.. automethod:: get_file_info
.. automethod:: list_status
.. automethod:: mkdirs
.. automethod:: modify_acl_entries
.. automethod:: read
.. automethod:: remove_acl
.. automethod:: remove_acl_entries
.. automethod:: remove_default_acl
.. automethod:: rename
.. automethod:: set_acl
.. automethod:: set_owner
.. automethod:: set_permission
.. automethod:: set_replication
.. automethod:: set_times
27 changes: 27 additions & 0 deletions python/docs/source/api/hdfs_native.ContentSummary.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
ContentSummary
==============

.. currentmodule:: hdfs_native

.. autoclass:: ContentSummary
:show-inheritance:

.. rubric:: Attributes Summary

.. autosummary::

~ContentSummary.directory_count
~ContentSummary.file_count
~ContentSummary.length
~ContentSummary.quota
~ContentSummary.space_consumed
~ContentSummary.space_quota

.. rubric:: Attributes Documentation

.. autoattribute:: directory_count
.. autoattribute:: file_count
.. autoattribute:: length
.. autoattribute:: quota
.. autoattribute:: space_consumed
.. autoattribute:: space_quota
41 changes: 41 additions & 0 deletions python/docs/source/api/hdfs_native.FileReader.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
FileReader
==========

.. currentmodule:: hdfs_native

.. autoclass:: FileReader
:show-inheritance:

.. rubric:: Attributes Summary

.. autosummary::

~FileReader.size

.. rubric:: Methods Summary

.. autosummary::

~FileReader.close
~FileReader.read
~FileReader.read_range
~FileReader.readable
~FileReader.readall
~FileReader.seek
~FileReader.seekable
~FileReader.tell

.. rubric:: Attributes Documentation

.. autoattribute:: size

.. rubric:: Methods Documentation

.. automethod:: close
.. automethod:: read
.. automethod:: read_range
.. automethod:: readable
.. automethod:: readall
.. automethod:: seek
.. automethod:: seekable
.. automethod:: tell
35 changes: 35 additions & 0 deletions python/docs/source/api/hdfs_native.FileStatus.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
FileStatus
==========

.. currentmodule:: hdfs_native

.. autoclass:: FileStatus
:show-inheritance:

.. rubric:: Attributes Summary

.. autosummary::

~FileStatus.access_time
~FileStatus.blocksize
~FileStatus.group
~FileStatus.isdir
~FileStatus.length
~FileStatus.modification_time
~FileStatus.owner
~FileStatus.path
~FileStatus.permission
~FileStatus.replication

.. rubric:: Attributes Documentation

.. autoattribute:: access_time
.. autoattribute:: blocksize
.. autoattribute:: group
.. autoattribute:: isdir
.. autoattribute:: length
.. autoattribute:: modification_time
.. autoattribute:: owner
.. autoattribute:: path
.. autoattribute:: permission
.. autoattribute:: replication
21 changes: 21 additions & 0 deletions python/docs/source/api/hdfs_native.FileWriter.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FileWriter
==========

.. currentmodule:: hdfs_native

.. autoclass:: FileWriter
:show-inheritance:

.. rubric:: Methods Summary

.. autosummary::

~FileWriter.close
~FileWriter.writable
~FileWriter.write

.. rubric:: Methods Documentation

.. automethod:: close
.. automethod:: writable
.. automethod:: write
25 changes: 25 additions & 0 deletions python/docs/source/api/hdfs_native.WriteOptions.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
WriteOptions
============

.. currentmodule:: hdfs_native

.. autoclass:: WriteOptions
:show-inheritance:

.. rubric:: Attributes Summary

.. autosummary::

~WriteOptions.block_size
~WriteOptions.create_parent
~WriteOptions.overwrite
~WriteOptions.permission
~WriteOptions.replication

.. rubric:: Attributes Documentation

.. autoattribute:: block_size
.. autoattribute:: create_parent
.. autoattribute:: overwrite
.. autoattribute:: permission
.. autoattribute:: replication
Loading

0 comments on commit 0593d5f

Please sign in to comment.