UK Postcodes Parsing v2.1.0
Major Performance & Size Optimizations
Massive Size Reductions
- PyPi Package size: Reduced from 9MB to ~4MB via outcode-based sharding
- Download size: Reduced from 797MB to 40MB via XZ compression
- Memory usage: Reduced via lazy loading of sharded outcode files (replacing monolith python set)
- Setup time: Reduced from ~60s to ~12s via optimized workflow
Database Architecture
- XZ Compression: Database now downloads as 40MB compressed file, expands to ~700MB with indices
- Outcode Sharding: Split monolithic postcode file into 2,977 outcode-specific files for lazy loading
- Index Optimization: Indices created automatically after decompression for optimal query performance
- Backward Compatibility: Both compressed (.db.xz) and full (.db) files available in releases
Enhanced User Experience
- Core functionality works without database: Basic postcode validation now uses lightweight outcode system
- Environment-aware downloads: Interactive prompts in terminals/Jupyter, clear instructions for CI/CD
Technical Improvements
Logging Standardization
- Improved log levels: Better categorization (DEBUG for fixes, WARNING for parse failures)
Documentation Updates
- README optimization: Prominently featured lightweight design and database requirements
- Setup clarity: Clear explanation of when database download is needed vs. core functionality
Migration Notes
- 100% backward compatible: All existing APIs work unchanged
- Automatic optimization: Users get benefits with no code changes required
- Environment variables: Same configuration options work as before
Installation
pip install uk-postcodes-parsing==2.1.0Database
Both compressed (postcodes.db.xz) and full (postcodes.db) database files are attached below. The compressed file is downloaded automatically on first use for optimal setup.
Changes
- See CHANGELOG.md for details