Thank you for your interest in contributing to altpg! This document provides guidelines and instructions for contributing.
- Rust 1.65 or later
- Python 3.8 or later
- PostgreSQL 9.6 or later (for integration tests)
- Clone the repository:
git clone https://github.com/manoelhc/altpg.git
cd altpg- Create a virtual environment:
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate- Install development dependencies:
pip install maturin pytest pytest-asyncio sqlalchemy- Build and install in development mode:
maturin developTo build the project:
# Development build
maturin build
# Release build (optimized)
maturin build --release# Run all tests
pytest tests/ -v
# Run specific test file
pytest tests/test_basic.py -v
# Run with coverage
pytest tests/ --cov=altpg --cov-report=htmlIntegration tests require a running PostgreSQL instance. Set up a test database:
createdb altpg_test
export DATABASE_URL="postgresql://postgres:password@localhost/altpg_test"
pytest tests/integration/ -vWe follow standard Rust formatting:
# Format code
cargo fmt
# Check formatting
cargo fmt -- --check
# Run linter
cargo clippy
# Run linter with all warnings as errors
cargo clippy -- -D warningsWe follow PEP 8 style guidelines:
# Format code with black
black python/
# Check with flake8
flake8 python/
# Type checking with mypy
mypy python/- Fork the repository
- Create a new branch for your feature (
git checkout -b feature/amazing-feature) - Make your changes
- Run tests and ensure they pass
- Run formatters and linters
- Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Write clear, descriptive commit messages
- Include tests for new features
- Update documentation as needed
- Ensure all tests pass
- Keep PRs focused on a single feature or fix
Please use GitHub Issues to report bugs or request features:
- Bug Reports: Include steps to reproduce, expected behavior, and actual behavior
- Feature Requests: Describe the feature and its use case
Current priorities for development:
-
Core Functionality
- Complete type adapter system
- Parameter binding improvements
- Result fetching optimization
-
Advanced Features
- Server-side cursors
- COPY operations
- NOTIFY/LISTEN support
- Connection pooling
-
Compatibility
- Full psycopg2/psycopg3 compatibility
- SQLAlchemy dialect improvements
- Django backend support
-
Performance
- Benchmarking suite
- Performance optimization
- Memory usage optimization
-
Testing
- Comprehensive test suite
- Integration tests with real PostgreSQL
- Compatibility tests with ORMs
altpg/
├── src/
│ └── lib.rs # Rust implementation
├── python/
│ └── altpg/
│ ├── __init__.py # Python wrapper
│ └── sqlalchemy/ # SQLAlchemy dialect
├── tests/ # Test suite
├── examples/ # Usage examples
├── Cargo.toml # Rust dependencies
└── pyproject.toml # Python package config
-
Rust Core (
src/lib.rs):- Connection management
- Query execution
- Type conversion
- Error handling
-
Python Wrapper (
python/altpg/__init__.py):- DB-API 2.0 interface
- Exception classes
- Module-level attributes
-
SQLAlchemy Dialect (
python/altpg/sqlalchemy/):- SQLAlchemy integration
- Dialect registration
- PyO3 Documentation
- rust-postgres Documentation
- Python DB-API 2.0 Specification
- SQLAlchemy Documentation
By contributing to altpg, you agree that your contributions will be licensed under the MIT License.
Feel free to open an issue for any questions or join discussions in the repository.