Thank you for your interest in contributing to Aparsoft TTS! This document provides guidelines and instructions for contributing.
We are committed to providing a welcoming and inclusive environment. Please be respectful and professional in all interactions.
git clone https://github.com/aparsoft/youtube-tts.git
cd youtube-ttspython -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate# Install in development mode with all optional dependencies
pip install -e ".[dev,mcp,cli,all]"
# Install pre-commit hooks
pre-commit installUbuntu/Debian:
sudo apt-get install espeak-ng ffmpeg libsndfile1macOS:
brew install espeak ffmpeggit checkout -b feature/your-feature-name
# or
git checkout -b fix/your-bug-fix- Write clear, documented code
- Follow the existing code style
- Add tests for new features
- Update documentation as needed
# Run all tests
pytest
# Run with coverage
pytest --cov=aparsoft_tts
# Run specific test file
pytest tests/unit/test_engine.py
# Run with verbose output
pytest -v# Format code with Black
black .
# Lint with Ruff
ruff check .
# Type check with mypy
mypy aparsoft_tts/git add .
git commit -m "feat: add new feature"
# or
git commit -m "fix: resolve bug in audio processing"Use conventional commit messages:
feat:New featurefix:Bug fixdocs:Documentation changestest:Test additions/changesrefactor:Code refactoringperf:Performance improvementschore:Maintenance tasks
git push origin feature/your-feature-nameThen create a Pull Request on GitHub.
- Follow PEP 8
- Use Black for formatting (line length: 100)
- Use type hints where appropriate
- Write descriptive docstrings (Google style)
def process_audio(
audio: NDArray[np.float32],
sample_rate: int = 24000,
enhance: bool = True,
) -> NDArray[np.float32]:
"""Process audio with enhancement.
Args:
audio: Input audio array
sample_rate: Sample rate in Hz
enhance: Apply enhancement
Returns:
Processed audio array
Raises:
AudioProcessingError: If processing fails
Example:
>>> audio = np.random.randn(24000)
>>> processed = process_audio(audio)
"""
passUse structured logging with appropriate log levels:
from aparsoft_tts.utils.logging import get_logger
log = get_logger(__name__)
log.info("processing_started", file="audio.wav", size=12345)
log.error("processing_failed", error=str(e))Use custom exceptions and provide context:
from aparsoft_tts.utils.exceptions import AudioProcessingError
try:
result = process_audio(audio)
except Exception as e:
log.error("processing_failed", error=str(e))
raise AudioProcessingError(f"Failed to process audio: {e}") from e- Test individual functions and methods
- Use mocks for external dependencies
- Aim for >80% code coverage
- Test complete workflows
- Test actual TTS generation (may be slow)
- Mark slow tests with
@pytest.mark.slow
import pytest
from aparsoft_tts import TTSEngine
def test_generate_audio(tmp_path):
"""Test audio generation."""
engine = TTSEngine()
output = tmp_path / "test.wav"
result = engine.generate("Hello", output_path=output)
assert output.exists()
assert output.stat().st_size > 0- Use Google-style docstrings
- Include examples where helpful
- Document all parameters and return values
- List possible exceptions
Update README.md if you:
- Add new features
- Change installation steps
- Modify usage examples
- Update dependencies
- Ensure CI passes: All tests, linting, and type checks must pass
- Update documentation: Add/update relevant documentation
- Add tests: Include tests for new features
- Update CHANGELOG: Add entry describing your changes
- Request review: Wait for maintainer review
- Address feedback: Make requested changes
- Merge: Maintainer will merge after approval
Include:
- Clear description of the bug
- Steps to reproduce
- Expected vs actual behavior
- System information (OS, Python version)
- Relevant logs/error messages
Include:
- Clear description of the feature
- Use case/motivation
- Proposed implementation (optional)
- Examples of similar features elsewhere (optional)
- Open an issue for questions
- Email: contact@aparsoft.com
- Website: https://aparsoft.com
By contributing, you agree that your contributions will be licensed under the Apache License 2.0.
Thank you for contributing to Aparsoft TTS! 🎙️