Thank you for your interest in contributing to the Lumen Python SDK! This document provides guidelines and instructions for contributing.
- Clone the repository
git clone https://github.com/getlumen/lumen-python-sdk.git
cd lumen-python-sdk- Create a virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install development dependencies
make dev
# or
pip install -e ".[dev,flask,fastapi,django]"- Set up your API key for testing
export LUMEN_API_KEY="your_test_api_key"# Run all tests
make test
# Run with coverage
make test-cov
# Run specific test file
pytest tests/test_events.py -v# Format code
make format
# Run linters
make lint
# Both format and lint
make format lintmypy lumen- We use Black for code formatting (100 character line length)
- We use Ruff for linting
- We use mypy for type checking
- All code must have type hints
- All public functions must have docstrings
- Place tests in the
tests/directory - Name test files as
test_*.py - Use pytest fixtures for common setup
- Mock external API calls
- Aim for high test coverage
Example test:
import pytest
from lumen import send_event
@pytest.mark.asyncio
async def test_send_event():
"""Test sending an event."""
# Your test code here
passUse clear, descriptive commit messages:
feat:for new featuresfix:for bug fixesdocs:for documentation changestest:for test additions/changesrefactor:for code refactoringchore:for maintenance tasks
Example:
feat: add support for custom metadata in seat operations
fix: handle timeout errors gracefully in send_event
docs: update README with FastAPI example
- Create a new branch for your changes
git checkout -b feature/your-feature-name- Make your changes and commit them
git add .
git commit -m "feat: your feature description"- Run tests and linters
make test lint- Push to your fork and create a pull request
git push origin feature/your-feature-name- Ensure CI passes and address any review comments
Before submitting a pull request, ensure:
- Code follows the project's style guidelines
- All tests pass
- New code has tests
- Documentation is updated (if applicable)
- Type hints are added for new code
- Commit messages are clear and descriptive
- No unnecessary dependencies added
When adding new features:
- Discuss first - Open an issue to discuss major changes
- Update types - Add type definitions in
lumen/types.py - Write tests - Add comprehensive tests
- Update docs - Update README and docstrings
- Add examples - Include usage examples if appropriate
- Use Google-style docstrings
- Include type hints in function signatures
- Provide examples in docstrings for complex functions
- Keep README.md up to date
Example docstring:
async def my_function(
user_id: str,
api_key: Optional[str] = None,
) -> Dict[str, Any]:
"""
Brief description of the function.
More detailed description if needed, explaining the purpose,
behavior, and any important considerations.
Args:
user_id: Description of the user_id parameter
api_key: Optional API key override
Returns:
Dictionary containing the result
Example:
>>> result = await my_function(user_id="user_123")
>>> print(result)
"""- Update version in
pyproject.toml - Update
CHANGELOG.md - Create a git tag
- Build and publish to PyPI
Feel free to open an issue or reach out:
- 📧 Email: hello@getlumen.dev
- 💬 Discord: Join our community
Thank you for contributing! 🎉