Sphinx Ultra Rust Builder
A high-performance Rust-based Sphinx documentation builder designed for large codebases with thousands of files.
โ ๏ธ Development Status
๐ง This project is currently under active development and is NOT recommended for production usage.
Current Focus: The primary goal is validation and experimentation rather than producing perfectly matched Sphinx builds. We are:
- โ Validating the core architecture and performance concepts
- โ Testing parallel processing capabilities on large documentation sets
- โ Experimenting with Rust-based parsing and rendering
- โ ๏ธ NOT aiming for 100% Sphinx compatibility yet
- โ ๏ธ NOT ready for production documentation workflows
Use Cases: Perfect for developers who want to experiment with high-performance documentation building or contribute to the development of next-generation documentation tools.
โจ Features
โ Currently Implemented
- ๐ Blazing Fast: Parallel processing with Rust's performance
- ๐ Scalable: Handle large documentation projects efficiently (tested with 50+ files in ~44ms)
- ๐ Incremental Builds: Smart caching system for faster rebuilds
- ๐ File Processing: Support for RST and Markdown files
- ๐ง Configuration: Multiple configuration formats (conf.py, YAML, JSON)
- ๐ File Pattern Matching: 100% Sphinx-compatible
include_patternsandexclude_patternssupport - ๐ Statistics: Project analysis and build metrics
- โ ๏ธ Validation: Document validation with warning/error reporting
- ๐๏ธ CLI Interface: Complete command-line interface (build, clean, stats)
- ๐ฆ Static Assets: Automatic copying of static files and assets
- ๐ฏ Domain System: Complete cross-reference validation with Python and RST domains
- ๐ Reference Validation: Comprehensive validation of :func:, :class:, :doc:, :ref: references
- ๐ก Smart Suggestions: Intelligent suggestions for broken references
๐ง Partially Implemented
- ๐ Search Index: Framework exists but search functionality not active
- ๐ ๏ธ Extensions: Basic extension system with limited Sphinx extension support
- ๐จ Themes: Basic theme structure but no advanced theming
๐ Planned Features
For detailed development roadmap, see Validation Features Plan which outlines our validation-focused approach.
Phase 1 (Next 2 months):
- ๐๏ธ Domain System: Sphinx-compatible domain registration and cross-reference validation
- ๐ Directive Validation: Complete directive/role validation system
- ๐ Document Structure: TOC tree and hierarchy validation
Phase 2-4 (Months 3-8):
- ๐ Content Constraints: Field validation and workflow checking
- ๏ฟฝ Extension Framework: Plugin validation and compatibility
- ๐ Code Documentation: Autodoc-style validation
- ๐ Internationalization: Translation completeness validation
Advanced UI Features (search indexing, complex templating, etc.) are intentionally deferred until validation foundation is solid.
- ๐ Live Server: Development server with live reload
- ๏ฟฝ๏ธ File Watching: Automatic rebuilds on file changes
- ๐ Plugin System: Full plugin architecture for custom functionality
- ๐ฑ Mobile Friendly: Responsive design optimization
- ๐ผ๏ธ Image Optimization: Automatic image processing and optimization
- ๐ฆ Asset Bundling: Advanced asset optimization and bundling
Note: This project is in active development. The core build functionality works reliably, but advanced features are still being developed.
๐ Quick Start
Prerequisites
- Rust 1.70+
- Cargo
Installation
# Clone and build from source
# The binary will be available at target/release/sphinx-ultra
Basic Usage
# Build documentation
# Clean build artifacts
# Show project statistics
# Get help
Available Commands
build: Build documentation from source filesclean: Remove build artifacts and output filesstats: Display project statistics and analysis
Build Options
# Parallel processing
# Incremental builds (faster rebuilds)
# Clean before build
# Save warnings to file
# Fail on warnings (useful for CI)
๐ง Configuration
Sphinx Ultra supports multiple configuration formats and can auto-detect your setup:
Configuration Priority
- conf.py (Sphinx standard) - Automatically detected and parsed
- sphinx-ultra.yaml - Native YAML configuration
- sphinx-ultra.yml - Alternative YAML format
- sphinx-ultra.json - JSON configuration
- Default settings - Used if no config file found
Sphinx conf.py Support
Sphinx Ultra can read and parse existing Sphinx conf.py files:
# conf.py (existing Sphinx configuration works)
=
=
=
=
YAML Configuration
Create a sphinx-ultra.yaml file for native configuration:
# Project information
project: "My Documentation"
version: "1.0.0"
copyright: "2024, My Company"
# Build settings
parallel_jobs: 8
max_cache_size_mb: 500
cache_expiration_hours: 24
# Output configuration
output:
html_theme: "sphinx_rtd_theme"
syntax_highlighting: true
highlight_theme: "github"
search_index: true
minify_html: false
# File pattern matching (Sphinx-compatible)
include_patterns:
- "**/*.rst"
- "**/*.md"
exclude_patterns:
- "_build/**"
- "drafts/**"
# Extensions (limited support currently)
extensions:
- "sphinx.ext.autodoc"
- "sphinx.ext.viewcode"
- "sphinx.ext.intersphinx"
# Theme configuration
theme:
name: "sphinx_rtd_theme"
options:
custom_css:
custom_js:
# Optimization settings
optimization:
parallel_processing: true
incremental_builds: true
document_caching: true
Configuration Fields
Most standard Sphinx configuration options are supported including:
- Project metadata (project, version, copyright, author)
- HTML output options (theme, static paths, CSS/JS files)
- Extension configuration
- Template and static file paths
- File pattern matching (
include_patterns,exclude_patterns) - Full compatibility guide - Build optimization settings
๐ Performance Benchmarks
Real performance test results on documentation projects:
| Files | Build Time | Processing Rate | Memory Usage |
|---|---|---|---|
| 2 files | 8ms | 250 files/sec | ~10MB |
| 51 files | 44ms | 1,159 files/sec | ~15MB |
| 100+ files | ~85ms* | 1,176 files/sec* | ~20MB* |
*Projected based on linear scaling
Performance Features
- Parallel Processing: Utilizes all CPU cores for maximum throughput
- Smart Caching: Incremental builds only process changed files
- Memory Efficient: Low memory footprint even for large projects
- Fast Parsing: Optimized RST and Markdown parsing
- Minimal I/O: Efficient file operations and batch processing
Comparison Notes
While we don't have direct Sphinx comparison benchmarks yet, the processing speeds above represent significant performance improvements for documentation builds. The actual performance gain depends on:
- Number of files and their complexity
- Available CPU cores
- Disk I/O speed
- Whether incremental builds are enabled
๐๏ธ Architecture
The Rust builder consists of several key components:
- Parser: Fast RST/Markdown parsing with syntax highlighting
- Cache: Intelligent caching system with LRU eviction
- Renderer: Template-based HTML generation with Handlebars
- Builder: Parallel processing engine with dependency tracking
๐ Advanced Usage
Incremental Builds
Enable faster rebuilds by only processing changed files:
Parallel Processing
Control the number of parallel jobs:
# Use 16 parallel jobs for maximum performance on large projects
# Use 1 job for debugging or memory-constrained environments
Warning and Error Handling
# Save all warnings and errors to a log file
# Treat warnings as errors (useful for CI/CD)
# Combine both for strict CI builds
Configuration File Usage
# Use a specific configuration file
# Configuration auto-detection order:
# 1. conf.py (if present)
# 2. sphinx-ultra.yaml
# 3. sphinx-ultra.yml
# 4. sphinx-ultra.json
# 5. Default configuration
Clean Builds
# Clean output directory before building
# Or clean manually
Project Analysis
# Get detailed project statistics
Output includes:
- Number of source files discovered
- Total lines of documentation
- Average and largest file sizes
- Directory depth analysis
- Cross-reference count
๐ Debugging and Troubleshooting
Enable Verbose Logging
# Debug-level logging for detailed build information
# Or set environment variable
RUST_LOG=debug
Common Issues
Configuration Loading Errors
- Ensure YAML/JSON syntax is valid
- Check that required fields are present
- Use
--configto specify config file explicitly
Build Failures
- Check file permissions in source and output directories
- Verify source files are valid RST/Markdown
- Review warning output for specific issues
Performance Issues
- Reduce parallel jobs if memory-constrained:
--jobs 1 - Enable incremental builds:
--incremental - Check for large files that may slow processing
Getting Help
- Use
sphinx-ultra --helpfor command overview - Use
sphinx-ultra build --helpfor build options - Check project issues on GitHub
- Enable verbose logging for debugging
๐ค Contributing
We welcome contributors! This project is in active development and needs help with:
- ๐งช Testing: Try the builder on various documentation projects
- ๐ Bug Reports: Report issues with parsing, rendering, or performance
- ๐ก Feature Ideas: Suggest improvements or new capabilities
- ๐ Documentation: Help improve setup guides and usage examples
- ๐ง Code: Contribute to core features, optimizations, or new functionality
Development Setup
# Clone and build
# Install git pre-commit hooks (recommended)
# Run development commands
# Build documentation
Please see CONTRIBUTING.md for detailed guidelines.
Priority Areas: We need help with:
- ๐งช Testing: Try the builder on various documentation projects and report results
- ๐ Bug Reports: Report issues with parsing, rendering, or performance
- ๐ก Feature Validation: Test existing features and suggest improvements
- ๐ Documentation: Help improve setup guides and usage examples
- ๐ง Core Features: Contribute to parsing, theming, or search functionality
- ๐จ Themes: Develop modern, responsive documentation themes
- ๐ Extensions: Expand Sphinx extension compatibility
What Currently Works Well
- Basic RST and Markdown processing
- Fast parallel builds
- Configuration auto-detection
- File validation and warning systems
- Incremental caching
What Needs Development
- Advanced theming and templating
- Search index functionality
- Live development server
- Full Sphinx directive compatibility
๏ฟฝ Releases
This project uses an automated release system with version validation to ensure consistency.
For Users
Download pre-built binaries from the Releases page.
For Maintainers
# Setup release environment (one-time)
# Create a new patch release (0.1.2 โ 0.1.3)
# Create a new minor release (0.1.2 โ 0.2.0)
# Create a new major release (0.1.2 โ 1.0.0)
# Preview what a release would do
The release script automatically:
- โ Runs tests to ensure quality
- โ
Updates
Cargo.tomlversion - โ Creates and pushes git tags
- โ Triggers GitHub Actions to build and publish
Version Safety: The system prevents version mismatches between git tags and Cargo.toml. See scripts/README.md for detailed documentation.
๏ฟฝ๐ License
This project is licensed under the MIT License - see the LICENSE file for details.