Thank you for your interest in contributing to the Soniox Pro SDK! This document provides guidelines and instructions for contributing.
- Code of Conduct
- Getting Started
- Development Setup
- Making Changes
- Testing
- Submitting Changes
- Style Guide
- Release Process
This project adheres to a code of conduct. By participating, you are expected to uphold this code. Please report unacceptable behaviour to the project maintainers.
- Be respectful and inclusive
- Accept constructive criticism gracefully
- Focus on what is best for the community
- Show empathy towards other community members
-
Fork the repository on GitHub
-
Clone your fork locally:
git clone https://github.com/YOUR-USERNAME/soniox-pro-sdk.git cd soniox-pro-sdk -
Add upstream remote:
git remote add upstream https://github.com/CodeWithBehnam/soniox-pro-sdk.git
- Python 3.12 or higher
- uv package manager
-
Install dependencies:
uv sync --all-extras
-
Install pre-commit hooks:
uv run pre-commit install
-
Set up API key for testing (optional):
cp .env.example .env # Edit .env and add your SONIOX_API_KEY
soniox-pro-sdk/
├── src/soniox/ # Main SDK code
│ ├── client.py # Synchronous HTTP client
│ ├── async_client.py # Asynchronous client
│ ├── realtime.py # WebSocket real-time client
│ ├── types.py # Pydantic models
│ ├── errors.py # Custom exceptions
│ ├── config.py # Configuration management
│ └── utils.py # Utility functions
├── tests/ # Test suite
├── examples/ # Example scripts
└── docs/ # Documentation
-
Create a new branch from
main:git checkout -b feature/your-feature-name # or git checkout -b fix/your-bug-fix -
Make your changes following the style guide
-
Test your changes:
# Run tests uv run pytest # Run linting uv run ruff check src/soniox # Run type checking uv run mypy src/soniox # Run all pre-commit hooks uv run pre-commit run --all-files
-
Commit your changes:
git add . git commit -m "feat: add new feature"
We use Conventional Commits:
<type>(<scope>): <subject>
<body>
<footer>
Types:
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changes (formatting, etc.)refactor: Code refactoringperf: Performance improvementstest: Adding or updating testschore: Maintenance tasksci: CI/CD changes
Examples:
feat(client): add support for custom headers
fix(realtime): handle WebSocket connection timeout
docs(readme): update installation instructions
test(types): add validation tests for Token model# Run all tests
uv run pytest
# Run with coverage
uv run pytest --cov=soniox --cov-report=html
# Run specific test file
uv run pytest tests/test_client.py
# Run specific test
uv run pytest tests/test_client.py::test_client_initialization- Place tests in the
tests/directory - Use descriptive test names:
test_<what>_<condition>_<expected_result> - Aim for high coverage of new code
- Mock external API calls
- Test both success and failure paths
Example:
def test_client_handles_authentication_error() -> None:
"""Test client raises AuthenticationError for 401 responses."""
# Test implementation-
Update your branch with latest main:
git fetch upstream git rebase upstream/main
-
Push to your fork:
git push origin feature/your-feature-name
-
Create a Pull Request on GitHub
-
Fill in the PR template with:
- Description of changes
- Related issue number (if applicable)
- Testing performed
- Breaking changes (if any)
-
Wait for review and address feedback
Before submitting, ensure:
- Code follows the style guide
- Tests pass locally
- New tests added for new functionality
- Documentation updated (if needed)
- CHANGELOG updated (for significant changes)
- Pre-commit hooks pass
- No merge conflicts with main
We follow PEP 8 with these tools:
- Ruff for linting and formatting
- mypy for type checking (strict mode)
- Line length: 100 characters
-
Type Hints: Use type hints for all functions
def transcribe(file_id: str, model: str = "stt-async-v3") -> Transcription: """Transcribe an audio file."""
-
Docstrings: Use Google-style docstrings
def upload_file(self, file_path: Path) -> File: """ Upload an audio file to Soniox. Args: file_path: Path to the audio file Returns: File object with metadata Raises: FileNotFoundError: If file doesn't exist """
-
British English: Use British spelling in documentation
- "colour" not "color"
- "optimise" not "optimize"
- "behaviour" not "behavior"
-
Imports: Organise imports with isort
# Standard library import os from pathlib import Path # Third-party import httpx from pydantic import BaseModel # Local from soniox.errors import SonioxError from soniox.types import Token
- Use clear, concise language
- Provide code examples
- Link to related documentation
- Keep README.md up to date
We use Semantic Versioning:
- MAJOR: Breaking changes
- MINOR: New features (backwards compatible)
- PATCH: Bug fixes
Maintainers will:
- Update version in
pyproject.toml - Update
CHANGELOG.md - Create a git tag
- Publish to PyPI via GitHub Actions
- Issues: Open an issue for bugs or feature requests
- Discussions: Use GitHub Discussions for questions
- Email: Contact maintainers for private matters
Contributors will be recognised in:
- CHANGELOG.md
- GitHub contributors page
- Release notes (for significant contributions)
Thank you for contributing to Soniox Pro SDK! 🎉