|
| 1 | +# Sphinx Documentation for aiofranka |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +Complete Sphinx documentation has been set up for the aiofranka library with the following structure: |
| 6 | + |
| 7 | +``` |
| 8 | +docs/ |
| 9 | +├── conf.py # Sphinx configuration |
| 10 | +├── Makefile # Build automation (Linux/Mac) |
| 11 | +├── make.bat # Build automation (Windows) |
| 12 | +├── README.md # Documentation build guide |
| 13 | +├── index.rst # Main landing page |
| 14 | +├── installation.rst # Installation instructions |
| 15 | +├── quickstart.rst # Quick start tutorial |
| 16 | +├── api.rst # API reference |
| 17 | +├── examples.rst # Usage examples |
| 18 | +├── _static/ # Static assets |
| 19 | +└── _templates/ # Custom templates |
| 20 | +``` |
| 21 | + |
| 22 | +## Building the Documentation |
| 23 | + |
| 24 | +### 1. Install Dependencies |
| 25 | + |
| 26 | +```bash |
| 27 | +# Using pyproject.toml optional dependencies |
| 28 | +pip install -e ".[docs]" |
| 29 | + |
| 30 | +# Or install directly |
| 31 | +pip install sphinx sphinx-rtd-theme |
| 32 | +``` |
| 33 | + |
| 34 | +### 2. Build HTML Documentation |
| 35 | + |
| 36 | +```bash |
| 37 | +cd docs |
| 38 | +make html |
| 39 | +``` |
| 40 | + |
| 41 | +The generated HTML will be in `docs/_build/html/`. Open `docs/_build/html/index.html` to view. |
| 42 | + |
| 43 | +### 3. Other Build Options |
| 44 | + |
| 45 | +```bash |
| 46 | +make clean # Remove build artifacts |
| 47 | +make latexpdf # Generate PDF (requires LaTeX) |
| 48 | +make epub # Generate EPUB |
| 49 | +make help # Show all available commands |
| 50 | +``` |
| 51 | + |
| 52 | +## Features |
| 53 | + |
| 54 | +### Theme |
| 55 | +- **sphinx-rtd-theme**: Modern, responsive Read the Docs theme |
| 56 | + |
| 57 | +### Extensions Enabled |
| 58 | +- **sphinx.ext.autodoc**: Auto-generate docs from docstrings |
| 59 | +- **sphinx.ext.napoleon**: Support for Google/NumPy style docstrings |
| 60 | +- **sphinx.ext.viewcode**: Add source code links |
| 61 | +- **sphinx.ext.intersphinx**: Link to other projects (Python, NumPy, SciPy) |
| 62 | +- **sphinx.ext.autosummary**: Generate summary tables |
| 63 | + |
| 64 | +### Documentation Pages |
| 65 | + |
| 66 | +1. **index.rst**: Main landing page with project overview |
| 67 | +2. **installation.rst**: Detailed installation instructions |
| 68 | +3. **quickstart.rst**: Step-by-step quick start guide |
| 69 | +4. **api.rst**: Complete API reference (auto-generated from code) |
| 70 | +5. **examples.rst**: Comprehensive usage examples including: |
| 71 | + - Basic control loop |
| 72 | + - Position control |
| 73 | + - Impedance control |
| 74 | + - Operational space control |
| 75 | + - Gain scheduling |
| 76 | + - Mode switching |
| 77 | + - Simulation mode |
| 78 | + |
| 79 | +## Development Workflow |
| 80 | + |
| 81 | +### Live Preview |
| 82 | + |
| 83 | +For real-time documentation preview during development: |
| 84 | + |
| 85 | +```bash |
| 86 | +pip install sphinx-autobuild |
| 87 | +cd docs |
| 88 | +sphinx-autobuild . _build/html |
| 89 | +``` |
| 90 | + |
| 91 | +Then open http://127.0.0.1:8000 in your browser. |
| 92 | + |
| 93 | +### Adding New Content |
| 94 | + |
| 95 | +1. **Add new modules**: Update `api.rst` with new automodule directives |
| 96 | +2. **Add examples**: Update `examples.rst` or create new .rst files |
| 97 | +3. **Update docstrings**: Use Google or NumPy style in your Python code |
| 98 | +4. **Build and verify**: Run `make html` to check for errors |
| 99 | + |
| 100 | +### Docstring Style |
| 101 | + |
| 102 | +The configuration supports both Google and NumPy docstring styles: |
| 103 | + |
| 104 | +```python |
| 105 | +def example_function(param1, param2): |
| 106 | + """ |
| 107 | + Short description. |
| 108 | + |
| 109 | + Args: |
| 110 | + param1: Description of param1 |
| 111 | + param2: Description of param2 |
| 112 | + |
| 113 | + Returns: |
| 114 | + Description of return value |
| 115 | + """ |
| 116 | + pass |
| 117 | +``` |
| 118 | + |
| 119 | +## Publishing Options |
| 120 | + |
| 121 | +### GitHub Pages |
| 122 | + |
| 123 | +1. Build the documentation: |
| 124 | + ```bash |
| 125 | + cd docs |
| 126 | + make html |
| 127 | + ``` |
| 128 | + |
| 129 | +2. Copy `_build/html/` contents to a `gh-pages` branch |
| 130 | + |
| 131 | +3. Enable GitHub Pages in repository settings |
| 132 | + |
| 133 | +### Read the Docs |
| 134 | + |
| 135 | +1. Import your repository on https://readthedocs.org |
| 136 | +2. RTD will automatically build using the configuration in `docs/conf.py` |
| 137 | + |
| 138 | +### Custom Hosting |
| 139 | + |
| 140 | +Simply upload the contents of `docs/_build/html/` to any web server. |
| 141 | + |
| 142 | +## Configuration |
| 143 | + |
| 144 | +The main configuration is in `docs/conf.py`: |
| 145 | + |
| 146 | +- **Project info**: Update version, author, copyright |
| 147 | +- **Theme settings**: Customize appearance |
| 148 | +- **Extensions**: Add/remove Sphinx extensions |
| 149 | +- **Napoleon settings**: Configure docstring parsing |
| 150 | +- **Intersphinx**: Add links to other documentation |
| 151 | + |
| 152 | +## .gitignore |
| 153 | + |
| 154 | +The following patterns have been added to `.gitignore`: |
| 155 | + |
| 156 | +``` |
| 157 | +docs/_build/ |
| 158 | +docs/_static/ |
| 159 | +docs/_templates/ |
| 160 | +``` |
| 161 | + |
| 162 | +## Dependencies Added |
| 163 | + |
| 164 | +Added to `pyproject.toml`: |
| 165 | + |
| 166 | +```toml |
| 167 | +[project.optional-dependencies] |
| 168 | +docs = [ |
| 169 | + "sphinx>=5.0", |
| 170 | + "sphinx-rtd-theme>=1.0", |
| 171 | +] |
| 172 | +``` |
| 173 | + |
| 174 | +## Tips |
| 175 | + |
| 176 | +1. **Incremental builds**: Use `make html` for faster rebuilds |
| 177 | +2. **Clean builds**: Use `make clean html` to rebuild everything |
| 178 | +3. **Check warnings**: Fix any warnings in the build output |
| 179 | +4. **Test locally**: Always build and view locally before publishing |
| 180 | +5. **Keep docstrings updated**: Good code documentation = good generated docs |
| 181 | + |
| 182 | +## Next Steps |
| 183 | + |
| 184 | +1. Review the generated documentation in your browser |
| 185 | +2. Add more detailed docstrings to your code |
| 186 | +3. Customize the theme if needed |
| 187 | +4. Set up automated documentation builds (CI/CD) |
| 188 | +5. Deploy to Read the Docs or GitHub Pages |
0 commit comments