Contributing to EasySwitch¶
Prerequisites¶
- Python 3.9+
pip(oruvfor faster installs)
Local Setup¶
git clone https://github.com/AllDotPy/EasySwitch.git
cd EasySwitch
# Create virtual environment
python3 -m venv .venv
source .venv/bin/activate
# Install the package in editable mode with dev dependencies
pip install -e ".[dev]"
Code Conventions¶
- Typing: Use type annotations for all function signatures and public attributes
- Async: Use
async/awaitfor all I/O-bound operations - Naming:
- Variables/functions:
snake_case - Classes:
PascalCase - Constants:
UPPER_CASE - Comments: Write clear English comments explaining the why, not the what
- Imports: Standard library → third-party → local (separated by blank lines)
Testing¶
# Run all tests
python -m pytest tests/
# Run specific test file
python -m pytest tests/test_paystack.py -v
# Run with coverage
python -m pytest tests/ --cov=easyswitch
Tests use pytest-asyncio for async adapter methods. All external APIs are mocked.
Adding a New Provider¶
- Create
easyswitch/integrators/<name>.py - Inherit from
BaseAdapterand add@AdaptersRegistry.register() - Implement all abstract methods (see Base Adapter)
- Add the provider to the
Providerenum ineasyswitch/types.py - Write tests in
tests/test_<name>.py - Add documentation in
docs/integrations/<name>.md - Run tests:
python -m pytest tests/ -v
Pull Request Process¶
- Create a branch from
main - Implement your changes with tests
- Run the full test suite and ensure all tests pass
- Open a PR with a clear description of the changes