|
| 1 | +# ArrayRecord Documentation |
| 2 | + |
| 3 | +This directory contains the Sphinx documentation for ArrayRecord. |
| 4 | + |
| 5 | +## Building the Documentation |
| 6 | + |
| 7 | +### Prerequisites |
| 8 | + |
| 9 | +Install the documentation dependencies: |
| 10 | + |
| 11 | +```bash |
| 12 | +pip install -r requirements.txt |
| 13 | +``` |
| 14 | + |
| 15 | +### Build HTML Documentation |
| 16 | + |
| 17 | +```bash |
| 18 | +# Using Sphinx directly |
| 19 | +sphinx-build -b html . _build/html |
| 20 | + |
| 21 | +# Or using the Makefile |
| 22 | +make html |
| 23 | +``` |
| 24 | + |
| 25 | +The generated HTML documentation will be in `_build/html/`. Open `_build/html/index.html` in your browser to view it. |
| 26 | + |
| 27 | +### Development Workflow |
| 28 | + |
| 29 | +For development with live reload: |
| 30 | + |
| 31 | +```bash |
| 32 | +# Install additional development dependencies |
| 33 | +pip install sphinx-autobuild |
| 34 | + |
| 35 | +# Start live reload server |
| 36 | +sphinx-autobuild . _build/html |
| 37 | +``` |
| 38 | + |
| 39 | +This will start a local server (usually at http://127.0.0.1:8000) that automatically rebuilds and reloads when you make changes. |
| 40 | + |
| 41 | +### Other Formats |
| 42 | + |
| 43 | +Build PDF documentation (requires LaTeX): |
| 44 | + |
| 45 | +```bash |
| 46 | +make latexpdf |
| 47 | +``` |
| 48 | + |
| 49 | +Check for broken links: |
| 50 | + |
| 51 | +```bash |
| 52 | +make linkcheck |
| 53 | +``` |
| 54 | + |
| 55 | +## Documentation Structure |
| 56 | + |
| 57 | +``` |
| 58 | +docs/ |
| 59 | +├── conf.py # Sphinx configuration |
| 60 | +├── index.rst # Main documentation index |
| 61 | +├── installation.md # Installation guide |
| 62 | +├── quickstart.md # Quick start guide |
| 63 | +├── core_concepts.md # Core concepts explanation |
| 64 | +├── performance.md # Performance optimization guide |
| 65 | +├── examples.md # Comprehensive examples |
| 66 | +├── beam_integration.md # Apache Beam integration guide |
| 67 | +├── contributing.md # Contribution guidelines |
| 68 | +├── changelog.md # Version changelog |
| 69 | +├── python_reference.rst # Python API reference |
| 70 | +├── beam_reference.rst # Beam API reference |
| 71 | +├── cpp_reference.rst # C++ API reference |
| 72 | +├── requirements.txt # Documentation dependencies |
| 73 | +├── Makefile # Build automation |
| 74 | +└── README.md # This file |
| 75 | +``` |
| 76 | + |
| 77 | +## Writing Documentation |
| 78 | + |
| 79 | +### Markdown vs reStructuredText |
| 80 | + |
| 81 | +- Use **Markdown (.md)** for user guides, tutorials, and narrative documentation |
| 82 | +- Use **reStructuredText (.rst)** for API references and when you need advanced Sphinx features |
| 83 | + |
| 84 | +### Style Guidelines |
| 85 | + |
| 86 | +1. **Use clear, concise language** |
| 87 | +2. **Include code examples** for all features |
| 88 | +3. **Provide context** for when to use different options |
| 89 | +4. **Link between related sections** |
| 90 | +5. **Keep examples up-to-date** with the current API |
| 91 | + |
| 92 | +### Code Examples |
| 93 | + |
| 94 | +Always include working code examples: |
| 95 | + |
| 96 | +```python |
| 97 | +from array_record.python import array_record_module |
| 98 | + |
| 99 | +# Create a writer |
| 100 | +writer = array_record_module.ArrayRecordWriter('example.array_record') |
| 101 | +writer.write(b'Hello, ArrayRecord!') |
| 102 | +writer.close() |
| 103 | +``` |
| 104 | + |
| 105 | +### Cross-References |
| 106 | + |
| 107 | +Use Sphinx cross-references to link between sections: |
| 108 | + |
| 109 | +- `:doc:`installation`` - Link to installation.md |
| 110 | +- `:ref:`section-label`` - Link to a labeled section |
| 111 | +- `:class:`array_record.python.array_record_module.ArrayRecordWriter`` - Link to class |
| 112 | + |
| 113 | +### API Documentation |
| 114 | + |
| 115 | +API documentation is auto-generated from docstrings. Ensure all public APIs have comprehensive docstrings: |
| 116 | + |
| 117 | +```python |
| 118 | +def my_function(param1: str, param2: int = 0) -> bool: |
| 119 | + """Brief description of the function. |
| 120 | + |
| 121 | + Longer description with more details about the function's behavior, |
| 122 | + use cases, and any important considerations. |
| 123 | + |
| 124 | + Args: |
| 125 | + param1: Description of the first parameter. |
| 126 | + param2: Description of the second parameter. Defaults to 0. |
| 127 | + |
| 128 | + Returns: |
| 129 | + Description of what the function returns. |
| 130 | + |
| 131 | + Raises: |
| 132 | + ValueError: Description of when this exception is raised. |
| 133 | + |
| 134 | + Example: |
| 135 | + >>> result = my_function("test", 42) |
| 136 | + >>> print(result) |
| 137 | + True |
| 138 | + """ |
| 139 | + pass |
| 140 | +``` |
| 141 | + |
| 142 | +## Contributing to Documentation |
| 143 | + |
| 144 | +1. **Check existing documentation** before adding new content |
| 145 | +2. **Follow the style guidelines** above |
| 146 | +3. **Test your changes** by building the documentation locally |
| 147 | +4. **Update the table of contents** if adding new pages |
| 148 | +5. **Check for broken links** using `make linkcheck` |
| 149 | + |
| 150 | +### Adding New Pages |
| 151 | + |
| 152 | +1. Create the new file (`.md` or `.rst`) |
| 153 | +2. Add it to the appropriate `toctree` in `index.rst` |
| 154 | +3. Update cross-references as needed |
| 155 | +4. Test the build |
| 156 | + |
| 157 | +### Updating API Documentation |
| 158 | + |
| 159 | +API documentation is automatically generated from docstrings. To update: |
| 160 | + |
| 161 | +1. Modify the docstrings in the source code |
| 162 | +2. Rebuild the documentation |
| 163 | +3. Check that the changes appear correctly |
| 164 | + |
| 165 | +## Troubleshooting |
| 166 | + |
| 167 | +### Common Issues |
| 168 | + |
| 169 | +1. **Import errors during build**: Ensure ArrayRecord is installed in your environment |
| 170 | +2. **Missing dependencies**: Install requirements with `pip install -r requirements.txt` |
| 171 | +3. **Build warnings**: Address warnings as they often indicate real issues |
| 172 | +4. **Broken links**: Use `make linkcheck` to identify and fix broken links |
| 173 | + |
| 174 | +### Clean Builds |
| 175 | + |
| 176 | +If you encounter issues, try a clean build: |
| 177 | + |
| 178 | +```bash |
| 179 | +make clean |
| 180 | +make html |
| 181 | +``` |
| 182 | + |
| 183 | +### Debugging Sphinx |
| 184 | + |
| 185 | +Enable verbose output to debug issues: |
| 186 | + |
| 187 | +```bash |
| 188 | +sphinx-build -v -b html . _build/html |
| 189 | +``` |
| 190 | + |
| 191 | +## Deployment |
| 192 | + |
| 193 | +The documentation is typically built and deployed automatically via CI/CD. For manual deployment: |
| 194 | + |
| 195 | +1. Build the documentation: `make html` |
| 196 | +2. Upload the `_build/html` directory to your web server |
| 197 | +3. Ensure proper permissions and web server configuration |
| 198 | + |
| 199 | +## Resources |
| 200 | + |
| 201 | +- [Sphinx Documentation](https://www.sphinx-doc.org/) |
| 202 | +- [reStructuredText Primer](https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html) |
| 203 | +- [MyST Parser (Markdown)](https://myst-parser.readthedocs.io/) |
| 204 | +- [Read the Docs Sphinx Theme](https://sphinx-rtd-theme.readthedocs.io/) |
0 commit comments