Thank you for your interest in contributing to text2speech-py! This document provides guidelines and instructions for contributing.
Please be respectful and considerate in all interactions. We aim to maintain a welcoming and inclusive environment.
- Python 3.10 or higher
uvpackage manager (recommended) orpip- Git
-
Fork and clone the repository:
git clone https://github.com/yourusername/text2speech-py.git cd text2speech-py -
Create a virtual environment:
# Using uv (recommended) uv venv source .venv/bin/activate # On Windows: .venv\Scripts\activate # Or using standard Python python -m venv .venv source .venv/bin/activate
-
Install dependencies:
# Install main dependencies uv pip install -e . # Install development dependencies uv pip install -e ".[dev]"
We enforce strict code quality standards. Please ensure your code follows these guidelines:
- Follow PEP 8 style guidelines
- Use type hints for all function signatures
- Write docstrings for all public functions, classes, and methods
- Use 4 spaces for indentation (never tabs)
- Limit line length to 88 characters
- No emoji in code (except in tests for multibyte character testing)
We use the following tools to maintain code quality:
# Format code with Ruff
ruff format .
# Check code with Ruff linter
ruff check . --fix
# Type check with mypy
mypy *.py
# Run tests
pytestBefore committing, ensure:
- All tests pass:
pytest - Code is formatted:
ruff format . - No linting errors:
ruff check . - Type checking passes:
mypy *.py - All functions have type hints
- All functions have docstrings
- No commented-out code
- No debug print statements
Use descriptive branch names:
feature/add-vietnamese-supportfix/audio-processing-bugdocs/update-readmerefactor/cleanup-helpers
Write clear, descriptive commit messages:
Add Vietnamese text preprocessing function
- Implement tone marker handling
- Add text splitting for long sentences
- Include parameter recommendations
Format:
- First line: Brief summary (50 chars or less)
- Blank line
- Detailed description (wrap at 72 characters)
- Update documentation if you've changed functionality
- Add tests for new features
- Update CHANGELOG.md with your changes
- Ensure all tests pass and code quality checks succeed
- Create a pull request with a clear description
## Description
Brief description of the changes
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
## Testing
How has this been tested?
## Checklist
- [ ] My code follows the style guidelines
- [ ] I have performed a self-review
- [ ] I have commented my code where needed
- [ ] I have updated the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests
- [ ] All tests pass locally- Place tests in the
tests/directory - Use
pytestas the testing framework - Mock external dependencies (APIs, file systems, etc.)
- Follow the Arrange-Act-Assert pattern
Example:
def test_prepare_vietnamese_text():
"""Test Vietnamese text preparation."""
helper = VietnameseTTSHelper()
# Arrange
text = "Xin chào,thế giới!"
# Act
result = helper.prepare_vietnamese_text(text)
# Assert
assert result == "Xin chào, thế giới! "# Run all tests
pytest
# Run with coverage
pytest --cov=. --cov-report=html
# Run specific test file
pytest tests/test_vietnamese_helper.pyUse Google-style docstrings:
def function_name(param1: str, param2: int = 0) -> bool:
"""Brief description of function.
Longer description if needed.
Args:
param1: Description of param1
param2: Description of param2 (default: 0)
Returns:
Description of return value
Raises:
ValueError: When invalid input is provided
"""
pass- Open an issue for bugs or feature requests
- Join discussions in existing issues
- Ask questions in pull request comments
Contributors will be recognized in:
- CHANGELOG.md
- Project README.md
- Git commit history
Thank you for contributing to text2speech-py!