Skip to content

Commit 65da2d9

Browse files
committed
Squashed commit of the following:
readthedocs documentation build
1 parent baf761d commit 65da2d9

File tree

7 files changed

+168
-51
lines changed

7 files changed

+168
-51
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ dist/justpyplot-0.0.9-py3-none-any.whl
77
dist/justpyplot-0.0.9.tar.gz
88
dist/justpyplot-0.1-py3-none-any.whl
99
dist/justpyplot-0.1.tar.gz
10+
docs/_*

.readthedocs.yaml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,9 @@ build:
55
tools:
66
python: "3.8"
77

8+
sphinx:
9+
configuration: docs/conf.py
10+
811
python:
912
install:
10-
- requirements: docs/requirements.txt
11-
- method: pip
12-
path: .
13-
14-
build:
15-
commands:
16-
- pdoc --html justpyplot -o _readthedocs/html --only-modules
13+
- requirements: docs/requirements.txt

docs/README.md

Lines changed: 47 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5,89 +5,98 @@
55
Install documentation dependencies:
66

77
```bash
8-
pip install pdoc3
8+
pip install -r docs/requirements.txt
99
```
1010

11+
The requirements include:
12+
- sphinx
13+
- sphinx_rtd_theme
14+
- numpy
15+
- opencv-python
16+
- Pillow
17+
1118
## Building the Documentation
1219

1320
From the root directory of the project, run:
1421

1522
```bash
16-
pdoc --html justpyplot -o docs/build --only-modules
23+
sphinx-build -b html docs docs/_build/html
1724
```
1825

1926
This will:
2027
1. Generate HTML documentation from docstrings
21-
2. Output files to docs/build directory
22-
3. Create searchable API documentation
28+
2. Create API reference automatically
29+
3. Output files to docs/_build/html directory
2330

2431
## Development
2532

26-
When developing, you can use the live reload server:
33+
For live preview while writing documentation:
2734

2835
```bash
29-
pdoc --http localhost:8080 justpyplot
36+
sphinx-autobuild docs docs/_build/html
3037
```
3138

3239
This will:
33-
1. Start a local server
34-
2. Auto-reload when files change
35-
3. Show documentation updates in real-time
40+
1. Start a local server (usually at http://127.0.0.1:8000)
41+
2. Auto-rebuild when files change
42+
3. Auto-reload the browser
3643

3744
## Documentation Style Guide
3845

39-
When writing docstrings, follow this format:
46+
Use NumPy style docstrings for all Python functions:
4047

4148
```python
4249
def function_name(param1: type, param2: type) -> return_type:
4350
"""Short description of function.
4451
4552
Detailed description of function behavior.
4653
47-
Args:
48-
param1: Description of first parameter
49-
param2: Description of second parameter
54+
Parameters
55+
----------
56+
param1 : type
57+
Description of first parameter
58+
param2 : type
59+
Description of second parameter
5060
51-
Returns:
61+
Returns
62+
-------
63+
return_type
5264
Description of return value
5365
54-
Example:
55-
>>> result = function_name(1, 2)
56-
>>> print(result)
57-
3
66+
Examples
67+
--------
68+
>>> result = function_name(1, 2)
69+
>>> print(result)
70+
3
5871
"""
5972
```
6073

61-
## Building for Distribution
62-
63-
For release builds:
74+
## Project Structure
6475

65-
```bash
66-
pdoc --html justpyplot -o docs/build --only-modules --template-dir docs/templates
6776
```
68-
69-
Documentation will be available at `docs/build/justpyplot/index.html`
77+
docs/
78+
├── conf.py # Sphinx configuration
79+
├── index.rst # Main documentation page
80+
├── requirements.txt # Documentation dependencies
81+
├── _build/ # Generated documentation
82+
└── _static/ # Static files (images, etc)
83+
```
7084

7185
## Read the Docs Integration
7286

73-
1. Go to [Read the Docs](https://readthedocs.org/) and sign up/login
74-
2. Connect your GitHub repository
75-
3. Import your project from the dashboard
76-
4. The configuration in `.readthedocs.yaml` will:
77-
- Install required dependencies
78-
- Build documentation using pdoc3
79-
- Deploy to readthedocs.io
80-
81-
The documentation will automatically build when you push to the main branch.
82-
83-
Build Status: [![Documentation Status](https://readthedocs.org/projects/justpyplot/badge/?version=latest)](https://justpyplot.readthedocs.io/en/latest/?badge=latest)
87+
The documentation automatically builds on [Read the Docs](https://readthedocs.org/) when you push to the main branch. Configuration is in `.readthedocs.yaml` at the root of the project.
8488

8589
## Troubleshooting
8690

8791
If builds fail:
8892
1. Check the build logs on Read the Docs
8993
2. Verify all dependencies are in docs/requirements.txt
90-
3. Test the build command locally:
94+
3. Test locally with:
95+
```bash
96+
sphinx-build -b html docs docs/_build/html -a -E
97+
```
98+
4. Clear build directory and rebuild:
9199
```bash
92-
pdoc --html justpyplot -o _readthedocs/html --only-modules
100+
rm -rf docs/_build
101+
sphinx-build -b html docs docs/_build/html
93102
```

docs/conf.py

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import os
2+
import sys
3+
4+
# Add the project root directory to Python path
5+
sys.path.insert(0, os.path.abspath('..'))
6+
7+
# Configuration file for the Sphinx documentation builder
8+
project = 'justpyplot'
9+
copyright = '2024'
10+
author = 'bedbad'
11+
12+
# Basic Sphinx settings
13+
extensions = [
14+
'sphinx.ext.autodoc',
15+
'sphinx.ext.napoleon', # For NumPy style docstrings
16+
'sphinx.ext.viewcode', # To show source code
17+
]
18+
19+
# Autodoc settings
20+
autodoc_default_options = {
21+
'members': None,
22+
'undoc-members': False,
23+
'private-members': False,
24+
'special-members': False,
25+
'imported-members': False
26+
}
27+
28+
def skip_non_all(app, what, name, obj, skip, options):
29+
# Get the module name and member name
30+
module_name = name.rsplit('.', 1)[0]
31+
member_name = name.split('.')[-1]
32+
33+
try:
34+
# Get the module's __all__
35+
module = sys.modules[module_name]
36+
all_list = getattr(module, '__all__', [])
37+
38+
# Skip if not in __all__
39+
if member_name not in all_list:
40+
return True
41+
except (KeyError, AttributeError):
42+
pass
43+
44+
return skip
45+
46+
def setup(app):
47+
app.connect('autodoc-skip-member', skip_non_all)
48+
49+
templates_path = ['_templates']
50+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
51+
html_theme = 'sphinx_rtd_theme'
52+
53+
# Napoleon settings
54+
napoleon_google_docstring = False
55+
napoleon_numpy_docstring = True

docs/index.rst

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
justpyplot documentation
2+
=======================
3+
4+
A fast, lightweight plotting library for real-time visualization.
5+
6+
Basic Usage
7+
----------
8+
9+
.. code-block:: python
10+
11+
import numpy as np
12+
from justpyplot import justpyplot as jplt
13+
14+
x = np.linspace(0, 10, 50)
15+
y = np.sin(x)
16+
17+
# Create plot components
18+
figure, grid, labels, title = jplt.plot(
19+
np.array([x, y]),
20+
title='Sine Wave'
21+
)
22+
23+
# Blend components
24+
final_image = jplt.blend(grid, figure, labels, title)
25+
26+
Installation
27+
-----------
28+
29+
.. code-block:: bash
30+
31+
pip install justpyplot
32+
33+
API Reference
34+
------------
35+
36+
Main Functions
37+
~~~~~~~~~~~~~
38+
39+
.. automodule:: justpyplot.justpyplot
40+
:members:
41+
:imported-members: False
42+
:special-members: False
43+
:private-members: False
44+
:undoc-members: False
45+
46+
Text Rendering
47+
~~~~~~~~~~~~~
48+
49+
.. automodule:: justpyplot.textrender
50+
:members:
51+
:imported-members: False
52+
:special-members: False
53+
:private-members: False
54+
:undoc-members: False
55+
56+
Indices
57+
=======
58+
59+
* :ref:`genindex`

docs/requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
pdoc3
1+
sphinx
2+
sphinx_rtd_theme
23
numpy
34
opencv-python
45
Pillow

justpyplot/justpyplot.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,11 +1201,6 @@ def plot1_at(
12011201
Returns:
12021202
img_array: Image array with overlaid adaptive plot
12031203
1204-
Examples
1205-
--------
1206-
>>> frame = cv2.imread('frame.jpg')
1207-
>>> values = sensor_data[-100:]
1208-
>>> frame = draw_adaptive_plot(frame, values)
12091204
"""
12101205
min_val = np.min(values)
12111206
max_val = np.max(values)

0 commit comments

Comments
 (0)