Releases: bernardopires/django-tenant-schemas
2.0.0
Version 2.0.0 - Major Modernization Release
This major release modernizes django-tenant-schemas for current Django and Python versions while maintaining API backward compatibility. After 2+ years since v1.12.0, this release drops legacy version support and introduces significant infrastructure improvements.
🔥 Breaking Changes
- ❌ Removed: Python 2.7, 3.6, 3.7
- ❌ Removed: Django 1.11 through 4.1
- ❌ Removed:
sixlibrary (Python 2/3 compatibility) - ❌ Removed:
psycopg2-binaryas required dependency
Migration Path
Existing projects can upgrade seamlessly as the package maintains backward compatibility at the API level. Update your environment:
- Upgrade to Python 3.8+ and Django 4.2+
- Choose PostgreSQL client:
pip install django-tenant-schemas[psycopg2]ordjango-tenant-schemas[psycopg] - Update middleware configuration if using deprecated patterns
- Update storage settings for Django 5.x if applicable
🚀 Major Features & Improvements
#708 - PostgreSQL Client Flexibility
- Dual PostgreSQL client support: Choose between
psycopg2orpsycopg(psycopg3) - Optional dependencies: Install with
[psycopg2]or[psycopg]extras - Automatic fallback logic: Seamless switching between PostgreSQL drivers
# Choose your PostgreSQL client
pip install django-tenant-schemas[psycopg2] # Traditional psycopg2
pip install django-tenant-schemas[psycopg] # Modern psycopg3#707 - Modern Python Packaging
- PEP 518 compliance: Migrated from
setup.pytopyproject.toml - src-layout adoption: Modern package structure (
src/tenant_schemas/) - GitHub Actions CI: Replaced Travis CI with modern workflow
uvintegration: Faster dependency management and builds- Improved test matrix: Comprehensive testing across Python/Django combinations
- Middleware modernization: Updated to current Django middleware patterns
- Storage configuration: Support for Django 5.x
STORAGESsetting - Migration compatibility: Fixed Django 5.2 compatibility issues
🐛 Critical Bug Fixes
#710 - RecursionError with psycopg3 and DEBUG=True
Fixed a critical issue where using psycopg with DEBUG=True caused infinite recursion:
- Root cause: Django's SQL debug logging triggered psycopg3's mogrify operation, creating fresh cursors that re-entered the
_cursor()method - Solution: Added
ContextVarguard to prevent recursion duringsearch_pathoperations - Performance: Smart caching only sets
search_pathwhen tenant configuration changes - Compatibility: Works with both
psycopg2andpsycopg
#712 - Django 4.2+ Introspection Support
Fixed NotImplementedError when running Django commands like flush:
- Problem: Django 4.2+ requires
get_sequences()method for database introspection - Solution: Implemented schema-aware sequence introspection using PostgreSQL system tables
- Impact: Enables full Django 4.2+ command compatibility
- Testing: Comprehensive test coverage prevents regression
🧹 Code Modernization
#709 - Python 3+ Syntax Modernization
- Removed defensive imports for old Django/Python versions
- Eliminated
__future__imports (not needed in Python 3.8+) - Updated documentation links from Django 1.8/1.11 to Django 4.2
- Removed legacy compatibility code for Django < 1.7
Infrastructure Improvements
- Removed deprecated middleware patterns
- Modernized import organization
- Updated test configurations
- Improved error handling
📚 Documentation & Developer Experience
#711 - Enhanced Tutorial and Examples
- Modern setup instructions: Updated for
uvdependency management - Automated validation: GitHub Actions workflow validates tutorial functionality
- New management command:
create_clientfor easier tenant creation - Django compatibility: Updated settings and URL patterns
- Clear migration path: Step-by-step upgrade guidance
Developer Tools
- Comprehensive CI matrix: Tests all supported Python/Django combinations
- Fast dependency management:
uvintegration for development - Modern packaging standards: PEP 518 compliance
- Improved test coverage: Better isolation and parallel execution
📋 Complete Change Log
Pull Requests Included
- #707 - Modernize for current Django and Python versions
- #708 - Support both
psycopg2andpsycopgPostgreSQL clients - #709 - Remove code for old Django and Python versions
- #710 - Fix
RecursionErrorwithpsycopgwhenDEBUG=True - #711 - Fix tutorial and add automated validation
- #712 - Implement
get_sequences()method for Django 4.2+ compatibility
🔮 Looking Forward
- Django LTS Alignment: Supports current and future Django LTS releases
- Modern Python: Takes advantage of Python 3.8+ features
- Performance: Optimized for current PostgreSQL drivers
- Maintainability: Clean, modern codebase easier to contribute to
💝 Acknowledgments
Special thanks to all contributors who made this release possible:
- @barkhabol and @shantanutomarr for the
get_sequences()implementation
Support Django4
Merge pull request #631 from timgates42/bugfix_typo_similar docs: Fix simple typo, similiar -> similar
v1.9.0
Added custom tenant strategies by refactoring a BaseTenantMiddleware to allow greater control over the method used for determining the active tenant.
Parallel execution of database migrations using ParallelExecutor.
Added codes to check framework warnings and errors.
Documentation improvements and updating example projects and tutorials for recent versions of Django.