Skip to content

Commit 2a96895

Browse files
committed
Add initial python doc generation
1 parent 7fe4cfb commit 2a96895

14 files changed

+300
-6
lines changed

python/docs/source/api.rst

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
API
2+
===
3+
4+
.. automodapi:: hdfs_native
5+
:no-inheritance-diagram:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
AclEntry
2+
========
3+
4+
.. currentmodule:: hdfs_native
5+
6+
.. autoclass:: AclEntry
7+
:show-inheritance:
8+
9+
.. rubric:: Attributes Summary
10+
11+
.. autosummary::
12+
13+
~AclEntry.name
14+
~AclEntry.permissions
15+
~AclEntry.scope
16+
~AclEntry.type
17+
18+
.. rubric:: Attributes Documentation
19+
20+
.. autoattribute:: name
21+
.. autoattribute:: permissions
22+
.. autoattribute:: scope
23+
.. autoattribute:: type
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
AclStatus
2+
=========
3+
4+
.. currentmodule:: hdfs_native
5+
6+
.. autoclass:: AclStatus
7+
:show-inheritance:
8+
9+
.. rubric:: Attributes Summary
10+
11+
.. autosummary::
12+
13+
~AclStatus.entries
14+
~AclStatus.group
15+
~AclStatus.owner
16+
~AclStatus.permission
17+
~AclStatus.sticky
18+
19+
.. rubric:: Attributes Documentation
20+
21+
.. autoattribute:: entries
22+
.. autoattribute:: group
23+
.. autoattribute:: owner
24+
.. autoattribute:: permission
25+
.. autoattribute:: sticky
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
Client
2+
======
3+
4+
.. currentmodule:: hdfs_native
5+
6+
.. autoclass:: Client
7+
:show-inheritance:
8+
9+
.. rubric:: Methods Summary
10+
11+
.. autosummary::
12+
13+
~Client.append
14+
~Client.create
15+
~Client.delete
16+
~Client.get_acl_status
17+
~Client.get_content_summary
18+
~Client.get_file_info
19+
~Client.list_status
20+
~Client.mkdirs
21+
~Client.modify_acl_entries
22+
~Client.read
23+
~Client.remove_acl
24+
~Client.remove_acl_entries
25+
~Client.remove_default_acl
26+
~Client.rename
27+
~Client.set_acl
28+
~Client.set_owner
29+
~Client.set_permission
30+
~Client.set_replication
31+
~Client.set_times
32+
33+
.. rubric:: Methods Documentation
34+
35+
.. automethod:: append
36+
.. automethod:: create
37+
.. automethod:: delete
38+
.. automethod:: get_acl_status
39+
.. automethod:: get_content_summary
40+
.. automethod:: get_file_info
41+
.. automethod:: list_status
42+
.. automethod:: mkdirs
43+
.. automethod:: modify_acl_entries
44+
.. automethod:: read
45+
.. automethod:: remove_acl
46+
.. automethod:: remove_acl_entries
47+
.. automethod:: remove_default_acl
48+
.. automethod:: rename
49+
.. automethod:: set_acl
50+
.. automethod:: set_owner
51+
.. automethod:: set_permission
52+
.. automethod:: set_replication
53+
.. automethod:: set_times
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
ContentSummary
2+
==============
3+
4+
.. currentmodule:: hdfs_native
5+
6+
.. autoclass:: ContentSummary
7+
:show-inheritance:
8+
9+
.. rubric:: Attributes Summary
10+
11+
.. autosummary::
12+
13+
~ContentSummary.directory_count
14+
~ContentSummary.file_count
15+
~ContentSummary.length
16+
~ContentSummary.quota
17+
~ContentSummary.space_consumed
18+
~ContentSummary.space_quota
19+
20+
.. rubric:: Attributes Documentation
21+
22+
.. autoattribute:: directory_count
23+
.. autoattribute:: file_count
24+
.. autoattribute:: length
25+
.. autoattribute:: quota
26+
.. autoattribute:: space_consumed
27+
.. autoattribute:: space_quota
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
FileReader
2+
==========
3+
4+
.. currentmodule:: hdfs_native
5+
6+
.. autoclass:: FileReader
7+
:show-inheritance:
8+
9+
.. rubric:: Attributes Summary
10+
11+
.. autosummary::
12+
13+
~FileReader.size
14+
15+
.. rubric:: Methods Summary
16+
17+
.. autosummary::
18+
19+
~FileReader.close
20+
~FileReader.read
21+
~FileReader.read_range
22+
~FileReader.readable
23+
~FileReader.readall
24+
~FileReader.seek
25+
~FileReader.seekable
26+
~FileReader.tell
27+
28+
.. rubric:: Attributes Documentation
29+
30+
.. autoattribute:: size
31+
32+
.. rubric:: Methods Documentation
33+
34+
.. automethod:: close
35+
.. automethod:: read
36+
.. automethod:: read_range
37+
.. automethod:: readable
38+
.. automethod:: readall
39+
.. automethod:: seek
40+
.. automethod:: seekable
41+
.. automethod:: tell
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
FileStatus
2+
==========
3+
4+
.. currentmodule:: hdfs_native
5+
6+
.. autoclass:: FileStatus
7+
:show-inheritance:
8+
9+
.. rubric:: Attributes Summary
10+
11+
.. autosummary::
12+
13+
~FileStatus.access_time
14+
~FileStatus.blocksize
15+
~FileStatus.group
16+
~FileStatus.isdir
17+
~FileStatus.length
18+
~FileStatus.modification_time
19+
~FileStatus.owner
20+
~FileStatus.path
21+
~FileStatus.permission
22+
~FileStatus.replication
23+
24+
.. rubric:: Attributes Documentation
25+
26+
.. autoattribute:: access_time
27+
.. autoattribute:: blocksize
28+
.. autoattribute:: group
29+
.. autoattribute:: isdir
30+
.. autoattribute:: length
31+
.. autoattribute:: modification_time
32+
.. autoattribute:: owner
33+
.. autoattribute:: path
34+
.. autoattribute:: permission
35+
.. autoattribute:: replication
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FileWriter
2+
==========
3+
4+
.. currentmodule:: hdfs_native
5+
6+
.. autoclass:: FileWriter
7+
:show-inheritance:
8+
9+
.. rubric:: Methods Summary
10+
11+
.. autosummary::
12+
13+
~FileWriter.close
14+
~FileWriter.writable
15+
~FileWriter.write
16+
17+
.. rubric:: Methods Documentation
18+
19+
.. automethod:: close
20+
.. automethod:: writable
21+
.. automethod:: write
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
WriteOptions
2+
============
3+
4+
.. currentmodule:: hdfs_native
5+
6+
.. autoclass:: WriteOptions
7+
:show-inheritance:
8+
9+
.. rubric:: Attributes Summary
10+
11+
.. autosummary::
12+
13+
~WriteOptions.block_size
14+
~WriteOptions.create_parent
15+
~WriteOptions.overwrite
16+
~WriteOptions.permission
17+
~WriteOptions.replication
18+
19+
.. rubric:: Attributes Documentation
20+
21+
.. autoattribute:: block_size
22+
.. autoattribute:: create_parent
23+
.. autoattribute:: overwrite
24+
.. autoattribute:: permission
25+
.. autoattribute:: replication

python/docs/source/conf.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,22 @@
1414
# -- General configuration ---------------------------------------------------
1515
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
1616

17-
extensions = []
17+
extensions = [
18+
"sphinx.ext.autodoc",
19+
"sphinx.ext.autosummary",
20+
"sphinx_rtd_theme",
21+
"sphinx_automodapi.automodapi",
22+
]
23+
1824

1925
templates_path = ["_templates"]
2026
exclude_patterns = []
2127

28+
autosummary_imported_members = False
29+
2230

2331
# -- Options for HTML output -------------------------------------------------
2432
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
2533

26-
html_theme = "alabaster"
34+
html_theme = "sphinx_rtd_theme"
2735
html_static_path = ["_static"]

python/docs/source/index.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
hdfs-native documentation
77
=========================
88

9-
Add your content using ``reStructuredText`` syntax. See the
10-
`reStructuredText <https://www.sphinx-doc.org/en/master/usage/restructuredtext/index.html>`_
11-
documentation for details.
9+
Python bindings for Rust-based `hdfs-native <https://github.com/Kimahriman/hdfs-native>`_ library.
1210

1311

1412
.. toctree::
1513
:maxdepth: 2
1614
:caption: Contents:
1715

16+
usage
17+
api

python/docs/source/usage.rst

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Usage
2+
=====
3+
4+
Simply create a :py:class:`Client <hdfs_native.Client>`.
5+
6+
.. code-block::
7+
8+
from hdfs_native import Client
9+
10+
# Load the fs.defaultFS from your core-site.xml config file
11+
client = Client()
12+
13+
# Connect to a specific NameNode
14+
client = Client("hdfs://nn-1:9000")
15+
16+
# Connect to a Name Service
17+
client = Client("hdfs://ns")
18+
19+
See :py:class:`Client <hdfs_native.Client>` for supported methods on a client.

python/hdfs_native/__init__.py

+11
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,17 @@
2020
RawFileWriter,
2121
)
2222

23+
__all__ = [
24+
"Client",
25+
"FileReader",
26+
"FileWriter",
27+
"FileStatus",
28+
"ContentSummary",
29+
"WriteOptions",
30+
"AclEntry",
31+
"AclStatus",
32+
]
33+
2334

2435
class FileReader(io.RawIOBase):
2536
def __init__(self, inner: "RawFileReader"):

python/pyproject.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ devel = [
2424
"pytest~=8.3",
2525
"pytest-benchmark~=5.1",
2626
"ruff~=0.7.2",
27-
"sphinx~=8.1"
27+
"sphinx~=8.1",
28+
"sphinx-rtd-theme=~3.0"
2829
]
2930

3031
[project.urls]

0 commit comments

Comments
 (0)