|
5 | 5 | Install documentation dependencies: |
6 | 6 |
|
7 | 7 | ```bash |
8 | | -pip install pdoc3 |
| 8 | +pip install -r docs/requirements.txt |
9 | 9 | ``` |
10 | 10 |
|
| 11 | +The requirements include: |
| 12 | +- sphinx |
| 13 | +- sphinx_rtd_theme |
| 14 | +- numpy |
| 15 | +- opencv-python |
| 16 | +- Pillow |
| 17 | + |
11 | 18 | ## Building the Documentation |
12 | 19 |
|
13 | 20 | From the root directory of the project, run: |
14 | 21 |
|
15 | 22 | ```bash |
16 | | -pdoc --html justpyplot -o docs/build --only-modules |
| 23 | +sphinx-build -b html docs docs/_build/html |
17 | 24 | ``` |
18 | 25 |
|
19 | 26 | This will: |
20 | 27 | 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 |
23 | 30 |
|
24 | 31 | ## Development |
25 | 32 |
|
26 | | -When developing, you can use the live reload server: |
| 33 | +For live preview while writing documentation: |
27 | 34 |
|
28 | 35 | ```bash |
29 | | -pdoc --http localhost:8080 justpyplot |
| 36 | +sphinx-autobuild docs docs/_build/html |
30 | 37 | ``` |
31 | 38 |
|
32 | 39 | 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 |
36 | 43 |
|
37 | 44 | ## Documentation Style Guide |
38 | 45 |
|
39 | | -When writing docstrings, follow this format: |
| 46 | +Use NumPy style docstrings for all Python functions: |
40 | 47 |
|
41 | 48 | ```python |
42 | 49 | def function_name(param1: type, param2: type) -> return_type: |
43 | 50 | """Short description of function. |
44 | 51 | |
45 | 52 | Detailed description of function behavior. |
46 | 53 | |
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 |
50 | 60 | |
51 | | - Returns: |
| 61 | + Returns |
| 62 | + ------- |
| 63 | + return_type |
52 | 64 | Description of return value |
53 | 65 | |
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 |
58 | 71 | """ |
59 | 72 | ``` |
60 | 73 |
|
61 | | -## Building for Distribution |
62 | | - |
63 | | -For release builds: |
| 74 | +## Project Structure |
64 | 75 |
|
65 | | -```bash |
66 | | -pdoc --html justpyplot -o docs/build --only-modules --template-dir docs/templates |
67 | 76 | ``` |
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 | +``` |
70 | 84 |
|
71 | 85 | ## Read the Docs Integration |
72 | 86 |
|
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: [](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. |
84 | 88 |
|
85 | 89 | ## Troubleshooting |
86 | 90 |
|
87 | 91 | If builds fail: |
88 | 92 | 1. Check the build logs on Read the Docs |
89 | 93 | 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: |
91 | 99 | ```bash |
92 | | - pdoc --html justpyplot -o _readthedocs/html --only-modules |
| 100 | + rm -rf docs/_build |
| 101 | + sphinx-build -b html docs docs/_build/html |
93 | 102 | ``` |
0 commit comments