A plug-and-play Redis integration library for Python frameworks like FastAPI, designed to simplify caching, session management, and data operations.
- Easy Integration: Drop-in Redis support for FastAPI and other Python frameworks
- Connection Pooling: Efficient connection management for production environments
- Type Safety: Built with Python 3.7+ type hints for better IDE support
- Async Support: Compatible with async/await patterns in modern Python frameworks
- Plug-and-Play: Minimal configuration required to get started
- Python 3.7+
- Redis
uvpackage managerjustcommand runner (optional, for task automation)
macOS and Linux:
curl -LsSf https://astral.sh/uv/install.sh | shWindows:
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"Verify installation:
uv --versiongit clone https://github.com/Motssembillahmahin/redis-python-integration.git
cd redis-python-integrationuv pip install redis uvicorn fastapi alembic sqlmodel psycopg2-binaryor
uv syncThis command will automatically:
- Detect or download the appropriate Python version
- Create a virtual environment in
.venv - Install all project dependencies from
pyproject.toml - Generate/update the
uv.locklockfile
Linux/macOS
.venv\bin\activateWindows
.venv\Scripts\activateCreate a .env file in your project root with the following variables:
# Redis Connection
REDIS_HOST=localhost
REDIS_PORT=14921
REDIS_DB=DB
REDIS_PASSWORD=PASSWORD
REDIS_URL=URL
# Cache TTL Settings (in seconds)
CACHE_TTL=300 # Default cache: 5 minutes
PRODUCT_CACHE_TTL=3600 # Product cache: 1 hour
SESSION_TTL=86400 # Session: 24 hoursor
cp .env.example .env
Using just
just runThe API will be available at http://localhost:8000
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project uses:
justfor task automation- Python 3.7+ type hints
- Black for code formatting
- Issues: GitHub Issues
- Discussions: GitHub Discussions