Contributing to Fast-Rich¶
Thank you for your interest in contributing to Fast-Rich! This guide covers development setup, coding standards, and the contribution process.
Development Setup¶
Prerequisites¶
- Rust (stable, 1.70+)
- Python 3.8+ (for bindings development)
- maturin (for Python bindings):
pip install maturin
Clone and Build¶
Run Tests¶
# Run all tests
cargo test
# Run with all features
cargo test --all-features
# Run a specific test
cargo test test_name
Run Examples¶
cargo run --example showcase --features full
cargo run --example tables_demo
cargo run --example progress_bar
Project Structure¶
fast-rich/
├── src/ # Rust library source
│ ├── lib.rs # Main library entry
│ ├── console.rs # Console output
│ ├── style.rs # Colors and styles
│ ├── table.rs # Tables
│ ├── progress/ # Progress bars
│ └── ...
├── examples/ # Example programs
├── tests/ # Integration tests
├── bindings/ # Python bindings
├── docs/ # Documentation (this site)
└── benches/ # Benchmarks
Coding Standards¶
Formatting¶
We use rustfmt. Always format before committing:
Linting¶
We use clippy. Address all warnings:
Documentation¶
- All public items must have doc comments
- Include examples in doc comments where helpful
- Keep doc comments concise but complete
/// Creates a new styled text span.
///
/// # Arguments
///
/// * `content` - The text content
/// * `style` - The style to apply
///
/// # Example
///
/// ```
/// let text = Text::styled("Hello", Style::new().bold());
/// ```
pub fn styled(content: &str, style: Style) -> Self {
// ...
}
Pull Request Process¶
- Fork the repository
- Create a branch for your feature or fix:
- Make your changes with clear, atomic commits
- Run checks:
- Push and open a Pull Request
Commit Convention¶
Use conventional commits:
feat: add new table border stylefix: correct color parsing for RGBdocs: update progress bar guidetest: add tests for layout splittingrefactor: simplify console output logic
Python Bindings¶
The Python bindings are in bindings/python.
Build and Test¶
Structure¶
bindings/python/
├── src/
│ └── lib.rs # PyO3 bindings
├── python/
│ └── fast_rich/ # Python package
└── tests/
└── test_*.py # Python tests
Documentation¶
Building Docs¶
This documentation uses MkDocs with Material theme.
# Install dependencies
pip install mkdocs-material pymdown-extensions
# Serve locally
mkdocs serve
# Build static site
mkdocs build
Documentation Standards¶
- Use clear, concise prose
- Include code examples for every feature
- Show real terminal output where possible
- Use admonitions (tips, warnings, notes) sparingly
- Keep the structure consistent across pages
See Building Docs for more details.
Testing Guidelines¶
Unit Tests¶
Place unit tests in the same file as the code:
Integration Tests¶
Place integration tests in tests/:
// tests/test_tables.rs
use fast_rich::prelude::*;
#[test]
fn test_table_rendering() {
let console = Console::capture();
// ...
let output = console.get_captured_output();
assert!(output.contains("expected"));
}
ANSI Output Testing¶
For ANSI escape code testing, use byte-level assertions:
#[test]
fn test_ansi_output() {
let console = Console::capture();
console.print("[red]Hello[/]");
let output = console.get_captured_output();
// Check for ANSI red escape code
assert!(output.contains("\x1b[31m"));
}
Getting Help¶
- Issues: GitHub Issues
- Discussions: GitHub Discussions
We appreciate all contributions, from bug reports to major features!