Thank you for your interest in contributing to Phoenix Channels Python Client! This document provides guidelines and instructions for contributing.
- Python 3.11+
- uv package manager (recommended) or pip
- Fork the repository
- Clone your fork:
git clone https://github.com/YOUR_USERNAME/phoenix-channels-python-client.git cd phoenix-channels-python-client - Add upstream remote:
git remote add upstream https://github.com/band-ai/phoenix-channels-python-client.git
- Install dependencies:
# Using uv (recommended) uv sync --all-extras # Or using pip python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install -e ".[dev]"
- Set up pre-commit hooks:
pre-commit install pre-commit install --hook-type commit-msg
-
Create a feature branch from
main:git checkout main git pull upstream main git checkout -b feat/your-feature-name # or fix/your-bug-fix for bug fixes -
Make your changes following the code standards below
-
Run tests:
pytest
-
Run pre-commit checks:
pre-commit run --all-files
-
Commit your changes using Conventional Commits:
git commit -m "feat: add new feature description" # or git commit -m "fix: resolve issue description"
-
Push and create a pull request to
main
- Formatter/Linter: Ruff (88-character line limit)
- Type Checker: Pyrefly
- Secret Detection: Gitleaks
All formatting is enforced via pre-commit hooks.
- Use type hints for all function parameters and return types
- Use modern Python syntax where possible:
# Good def process(items: list[str]) -> dict[str, int]: ... def get_value(key: str) -> str | None: ...
This library is async-first. Follow these guidelines:
- Use
async deffor functions that perform I/O operations - Use
awaitfor calling async functions - Use
asynciofor concurrency patterns
async def handle_message(message):
"""Process incoming Phoenix Channel message."""
# Your async handling logic here
pass# All tests
pytest
# With verbose output
pytest -v
# Specific test file
pytest tests/test_client.py
# Specific test
pytest -k "test_name"- Place tests in the
tests/directory - Use pytest and pytest-asyncio for async tests
- Follow existing test patterns in the codebase
- Ensure all tests pass
- Ensure pre-commit checks pass
- Update documentation if needed
- Fill out the PR template completely
- Request review from maintainers
- Address any feedback
Use component prefixes to categorize issues:
[Component] Brief description
Components:
[Client]- PHXChannelsClient core functionality[Protocol]- Phoenix protocol handling (v1/v2)[WebSocket]- WebSocket connection management[Events]- Event handlers and message routing[Docs]- Documentation[CI]- CI/CD and workflows[Performance]- Performance improvements
Examples:
[Client] Add automatic reconnection support[Protocol] Fix v2 message parsing[WebSocket] Handle connection timeouts gracefully
Follow Conventional Commits format:
type(scope): description
Types: feat, fix, docs, style, refactor, test, chore
Examples:
feat(client): add heartbeat configurationfix(protocol): resolve v2 join response parsingdocs: update README with protocol examples
PR titles are validated by CI - PRs with invalid titles will fail the check.
feat/description- New featuresfix/description- Bug fixesdocs/description- Documentation changes
This project uses Conventional Commits enforced by Commitizen:
feat:- New featurefix:- Bug fixdocs:- Documentation changesstyle:- Code style changes (formatting, etc.)refactor:- Code refactoringtest:- Adding or updating testschore:- Maintenance tasks
Releases follow Semantic Versioning:
- MAJOR: Breaking API changes
- MINOR: New features (backward compatible)
- PATCH: Bug fixes (backward compatible)
Releases are managed automatically via Release Please.
If you have questions or need help, please open an issue on GitHub.