Skip to content

Commit c51ca56

Browse files
committed
Updating demo
1 parent d3f9757 commit c51ca56

18 files changed

+98
-6
lines changed

.DS_Store

0 Bytes
Binary file not shown.

.github/workflows/documentation.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- uses: actions/setup-python@v3
1414
- name: Install dependencies
1515
run: |
16-
pip install sphinx sphinx_rtd_theme pydata-sphinx-theme sphinx-design sphinx-copybutton
16+
pip install sphinx pydata-sphinx-theme sphinx-design sphinx-copybutton sphinx-autoapi
1717
- name: Sphinx build
1818
run: |
1919
sphinx-build docs _build

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
_build
2+
.venv
3+
sphinx_venv
4+
*.pyc

docs/api/api_base.rst

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Basic Example
2+
=============
3+
4+
5+
Example of displaying API:
6+
7+
.. automodule:: example
8+
:members:

docs/api/index.rst

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
API
2+
===
3+
4+
This contains API
5+
6+
7+
.. toctree::
8+
9+
api_base

docs/conf.py

+13
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# import sys
2+
# import os
3+
# sys.path.insert(0, os.path.abspath('../'))
4+
15
# Configuration file for the Sphinx documentation builder.
26
#
37
# This file only contains a selection of the most common options. For a full
@@ -24,10 +28,19 @@
2428
extensions = [
2529
"sphinx.ext.githubpages", # used for hosting on GitHub Pages
2630
"sphinx.ext.todo",
31+
"autoapi.extension",
32+
"sphinx.ext.autodoc",
33+
"sphinx.ext.napoleon",
2734
"sphinx_copybutton", # adds a copy button to source code blocks
2835
"sphinx_design"
2936
]
3037

38+
# For API documentation
39+
autoapi_dirs = ["../testpackage"]
40+
autoapi_add_toctree_entry = False
41+
autodoc_typehints = 'description'
42+
43+
3144
# Settings for myst_nb:
3245
# https://myst-nb.readthedocs.io/en/latest/use/execute.html#triggering-notebook-execution
3346
nb_execution_mode = "cache"

docs/guides/.DS_Store

0 Bytes
Binary file not shown.

docs/guides/guide_installation.rst

+2-4
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ It's a good idea to install them in a **virtual environment**.
3939
3. Building Documentation
4040
-------------------------
4141
The documentation for the :code:`sphinx-documentation-demo` is located in :code:`docs/`.
42-
To build this documentation, while in the project directory, do:
42+
While in the root project directory, do:
4343

4444
.. code-block:: bash
4545
@@ -55,15 +55,13 @@ You can open the file :code:`docs/index.html` on your computer to view the HTML
5555
The :code:`sphinx-autobuild` extension allows us to build local documentation whenever we make changes.
5656
It also refreshes the web browser so you can see the changes "live". This makes it **very convenient for rapid development**.
5757

58-
This extension has already been included in the :code:`requirements.txt` file
59-
6058
While in the virtual environment, run the following command:
6159

6260
.. code-block:: bash
6361
6462
sphinx-autobuild docs _build
6563
66-
This will create a local host instance which you can then access through your web browser (you can just copy/paste the http address you get from :code:`sphinx-autobuild`)
64+
You can then point your web browser to: http://127.0.0.1:8000/
6765

6866
Remote Build on GitHub
6967
======================

docs/guides/layout/images/.DS_Store

0 Bytes
Binary file not shown.

docs/guides/layout/layout_basic.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ Right Navigation Bar
109109

110110

111111
The right navigation bar allows users to navigation between **different sections within the current page**.
112-
This is automatically generated based on section headers specified within the page's :term:'rST' file.
112+
This is automatically generated based on section headers specified within the page's :term:`rST` file.
113113

114114
..
115115
.. image:: images/tab2_top.png

docs/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ This is the root directory.
66
:maxdepth: 1
77

88
guides/index
9+
autoapi/testpackage/index
910
tab_2/index
1011
tab_3/index
1112

pyproject.toml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[project]
2+
name = "sphinx-documentation-demo"
3+
dynamic = ["version"]
4+
dependencies = [
5+
"pydata-sphinx-theme==0.15.2",
6+
"Sphinx==7.2.6",
7+
"sphinx-autobuild==2024.2.4",
8+
"sphinx_copybutton",
9+
"sphinx_design==0.5.0"
10+
]

requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ pydata-sphinx-theme==0.15.2
22
Sphinx==7.2.6
33
sphinx-autobuild==2024.2.4
44
sphinx_design==0.5.0
5+
sphinx_copybutton

simulated/docs/guides/layout/index.rst

Whitespace-only changes.

simulated/docs/index.rst

Whitespace-only changes.

testpackage/__init__.py

Whitespace-only changes.

testpackage/test_message.py

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from __future__ import annotations
2+
3+
class TestMessage(object):
4+
"""This is the docstring for the TestMessage class.
5+
6+
Args:
7+
message_string (string): String to be printed later
8+
"""
9+
def __init__(self, message_string: str):
10+
self.message_string = message_string
11+
12+
@staticmethod
13+
def from_number(number: int) -> TestMessage:
14+
"""Creates a TestMessage from the provided number.
15+
16+
Args:
17+
number: the number to convert into a string
18+
"""
19+
20+
return TestMessage(message_string=str(number))
21+

testpackage/test_printer.py

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
from __future__ import annotations
2+
from testpackage.test_message import TestMessage
3+
4+
class TestPrinter(object):
5+
"""This is the docstring for TestPrinter
6+
Stuff
7+
8+
Args:
9+
msg: Message to be stored for later printing
10+
"""
11+
12+
def __init__(self, msg: TestMessage):
13+
self.msg = msg
14+
15+
16+
def print(self) -> None:
17+
"""This function is used to print the stored message.
18+
"""
19+
print(self.msg.message_string)
20+
21+
22+
def function_within_package() -> None:
23+
"""This is just an example of a function within a package
24+
that is not also contained within a class.
25+
"""
26+
print("This is a test function")
27+

0 commit comments

Comments
 (0)