Releases: bendlikeabamboo/barangay
Release list
📦⬆️📅 v2026.7.13.0 — PSGC July 2026 Update
📊 PSGC Data Update (July 2026)
- Updated Philippine Standard Geographic Code resource data across all formats (JSON, YAML, Parquet) to the 2026-07-13 release
- Version bumped to
2026.7.13.0 - Refreshed dataset counts: municipalities 1,488 → 1,493, cities 146 → 150, regions 17 → 18 (barangays ~42,010)
✨ CLI — Hierarchy-Accurate Output (barangay/cli.py)
- New
rphicmsgb9-character hierarchy indicator (region / province / HUC / ICC / component city / municipality / sub-municipality / SGA / barangay) - Hierarchy-loyal table rendering: only active levels shown as columns; blank-only level and plugin columns are auto-dropped
- Plugin column collection via
_collect_plugin_columns - CSV output support (
_dict_to_csv) - New/refined commands:
search,list,search_history,batch_search, and newbatch_validate
📝 Documentation
- README and
index.qmdversion/count references updated; changelog entry added for2026.7.13 - Refreshed CLI reference, plugins, and supporting Quarto pages to match the new CLI
- Misc:
.github/FUNDING.yml,uv.lock
🧪 Tests
tests/test_cli.pyandtests/test_cli_plugin.pyupdated for the new CLI behavior
Full changelog: v2026.4.13.4...v2026.7.13.0
🚀 v2026.4.13.4 — Roman Numerals, Multi-Level Matching & Accurate Database View
🚀 v2026.4.13.4 — Roman Numerals, Multi-Level Matching & Accurate Database View
A breaking-change release that standardizes roman numerals, unlocks matching across every PSGC level, and makes the database view respect the full administrative hierarchy. Built on the existing 2026-04-13 PSGC dataset.
⚠️ Breaking Changes
Accurate Database View (barangay/database.py)
EnrichedRecord.city→ replaced with per-level properties:highly_urbanized_city,independent_component_city,component_city,submunicipality,special_geographic_area, andbarangayDatabaseViewnow acceptslevels: frozenset[AdminLevel]in addition to a singlelevel, enabling multi-level filtering- New
EnrichedRecord.available_attributesreports which levels are populated for a record to_dict()now emits all resolved hierarchy levels
Multi-Level Matching (barangay/search.py)
- The barangay match hook is no longer required — queries can now match on region, province, city (HUC/ICC/component), municipality, sub-municipality, special geographic area, or barangay
✨ New Features
Roman Numeral Standardization (barangay/fuzz.py, barangay/utils.py)
- Normalizes roman numerals (e.g.
IV,Iv,iv) so fuzzy search matches consistently regardless of casing/formatting
Database API
HierarchyIndex.resolve_level()— generic ancestor resolution for anyAdminLevelHierarchyIndex.records_of_types()— filter records by a set of levels
🧪 Fuzzer
- Regenerated
fuzzer_base.parquetwith refined fuzzer logic for more realistic fuzzy-match training
📝 Documentation & Types
- Improved
.pyistubs (__init__.pyi,database.pyi) - Updated
SKILL.md,AGENTS.md, anddocs/(API, CLI, data models)
🔧 Internal
- Roman numeral handling added to the parser pipeline (
parsers/psgc/) - Expanded test coverage (
test_search,test_database,test_models,test_utils,test_cli)
Full changelog: v2026.4.13.3...v2026.4.13.4
🚀 v2026.4.13.3 — Performance, Typing & Match Hooks
🚀 v2026.4.13.3 — Performance, Typing & Match Hooks
A focused update bringing lazy-loading and caching optimizations, comprehensive type stubs, match hooks for fine-grained search control, and dependency upgrades across the board.
⚡ Performance
Lazy-Loading & Cache Optimizations
- Lazy data imports — Top-level data containers (
BARANGAY,BARANGAY_EXTENDED,BARANGAY_FLAT) now defer loading until first access, significantly reducing import time - Cache-aware
as_of— Historical PSGC data lookups (use_version()) benefit from improved cache with proper cache key generation viaversion.py - Fuzzer lazy-init —
FuzzBaseinstances are created on-demand rather than at module import time
🔍 Match Hooks
Fine-Grained Fuzzy Search Control
match_hooksparameter — New parameter onsearch_fuzzy()andsearch()to control which name-levels (province, municipality, barangay) participate in fuzzy scoring- Typed with
MatchHookliteral —list[MatchHook]type frombarangay.typesensures only valid hooks are passed - Enables use cases like searching only by barangay name, or combining province + municipality matching while skipping barangay-level scoring
from barangay import search_fuzzy
# Only match against barangay names
results = search_fuzzy("Tongmageng", match_hooks=["barangay"])
# Match province + municipality, skip barangay scoring
results = search_fuzzy("Tawi-Tawi", match_hooks=["province", "municipality"])📐 Type System
Type Stubs (.pyi)
barangay/__init__.pyi— Full type stub for the public API (104 lines), enabling IDE autocompletion and static analysis without importing the packagebarangay/database.pyi— Type stub for Database API includingDatabaseView,EnrichedRecord,Database,RecordNotFoundError, and all view-level methods (140 lines)
Better Typing & Error Handling
RecordNotFoundErrorexported in public API for explicit "no results" error handlingDatabaseViewandEnrichedRecordnow publicly exported frombarangay.__init__to_python_identifierutility added toutils.pyfor safe identifier conversion- Internal type annotations improved across
database.py,search.py, andplugin_loader.py
📦 Dependency Upgrades
| Package | From | To |
|---|---|---|
pandas |
2.3.x | 3.0.3 |
pyarrow (replaces fastparquet) |
— | 18.0.0 |
pydantic |
2.11.x | 2.13.4 |
click |
8.1.x | 8.4.1 |
rich |
13.9.x | 15.0.0 |
tornado |
6.5.4 | 6.5.6 |
requests |
2.32.x | 2.34.2 |
ruff |
0.14.x | 0.15.16 |
pytest |
9.0.2 | 9.0.3 |
ty |
0.0.17 | 0.0.44 |
pytest-cov |
7.0.0 | 7.1.0 |
pytest-xdist |
3.7.0 | 3.8.0 |
Breaking:
fastparquetreplaced bypyarrowfor Parquet I/O. If you pinnedfastparquetexplicitly, update your dependencies.
🧪 Tests
test_cache_with_as_of.py— 200 lines of tests verifying cache behavior with historicalas_ofdates, ensuring correct cache hits and invalidation across version switches
🤖 Developer Experience
AGENTS.md— AI coding agent reference with project structure, commands, conventions, and workflow guide- Updated
CONTRIBUTING.mdand PR template with reference toAGENTS.md
📦 Installation
pip install barangay==2026.4.13.3Quick Start
from barangay import barangays, search_fuzzy
# Lazy-loaded — data loads on first access
print(barangays.count) # 42010
# Fine-grained search with match hooks
results = search_fuzzy("Tongmageng", match_hooks=["barangay"])
# Full type hints in your IDE thanks to new .pyi stubs
brgy = barangays.get(name="Tongmageng")
print(brgy.region.name) # type-safe autocompletionFull documentation: https://bendlikeabamboo.github.io/barangay/
🗄️ v2026.4.13.2 — Database API Redesign & Deprecations
🗄️ Database API Redesign & Deprecations
This release introduces the Database API — a new pycountry-style interface for accessing PSGC data, along with comprehensive deprecation notices for legacy APIs scheduled for removal in 2027.X.X.X.
✨ What's New
Database API (barangay.database)
Databasesingleton — Central data access point with lazy-loading and caching- Level views —
regions,provinces,municipalities,cities,submunicipalities,barangays,special_geographic_areasas iterable, filterable database views AdminDivRecord— Unified Pydantic model for all admin division types withAdminLevelenum- Hierarchy traversal —
.parent,.children,.ancestorsproperties on enriched records for navigating the PSGC tree - Context properties —
.region,.province,.municipality,.citycomputed properties on any record .get()/.lookup()— Exact lookup by PSGC ID or name, withMultipleResultsErrorfor ambiguous name matches.search_fuzzy()— Fuzzy search scoped to any admin level view.to_frame()/.to_dicts()— Direct Pandas DataFrame or dict export from any view, with automatic explode handling for array plugins.use_plugins()/.use_version()— Module-level helpers to configure the global Database singletonPluginAccessor— Attribute-accessible wrapper for plugin data on enriched records
New Public Models
AdminLevel— Enum:COUNTRY,REGION,PROVINCE,CITY,MUNICIPALITY,SUBMUNICIPALITY,BARANGAY,SPECIAL_GEOGRAPHIC_AREASearchResult— Typed search result with.record,.score,.match_type,.enrichedpropertiesValidationResult— Validation result with.input,.valid,.matched_record,.matched_name,.matched_psgc_idPluginInfo— Plugin metadata model with.name,.enabled,.description,.version,.format,.repositoryPluginExtension/PluginExtensionMetadata— Pydantic models for plugin data attached to records
Address Validation
validate()— Validate a single address string against PSGC data (default threshold 95.0)validate_many()— Batch validation for multiple addresses
Type System
barangay.types— New module withDataType,AdminDivType,MatchHook,PluginFormattype literals
⚠️ Deprecations (removal in 2027.X.X.X)
The following legacy APIs now emit DeprecationWarning at import/use:
| Deprecated Item | Replacement |
|---|---|
BARANGAY dict alias |
barangays.get(name=...) |
BARANGAY_EXTENDED dict alias |
brgy.parent, brgy.ancestors, brgy.children |
BARANGAY_FLAT list alias |
barangays.to_frame(), barangays.to_dicts() |
search() function |
search_fuzzy() |
BarangayModel class |
AdminDivRecord via Database API |
Not deprecated: Database API, AdminDivRecord, AdminLevel, SearchResult, ValidationResult, PluginInfo, search_fuzzy(), validate(), validate_many(), FuzzBase, DataManager, PluginLoader, sanitize_input().
📚 Documentation
- Comprehensive Database API reference added to
docs/api.md - New tutorials: Getting Started (
tutorials/database_api.md), updated Address Validation and Bulk Barangay Lookup with Database API examples - Deprecation admonitions added across all documentation (README, api.md, tutorials, llms.txt, llms-full.txt, index.md, data_models)
- README quick start and features table updated to showcase Database API
🧪 Tests
tests/test_database.py— 426 lines of Database API teststests/test_backward_compat.py— Backward compatibility tests for deprecated APIstests/test_models.py— Tests for new Pydantic modelstests/test_search.py— Tests forsearch_fuzzy()and_search_fuzzy_new()tests/test_validate.py— Tests forvalidate()andvalidate_many()tests/test_version.py— Tests foruse_version()anduse_plugins()
📦 Installation
pip install barangay==2026.4.13.2Quick Start
from barangay import barangays, search_fuzzy, validate
# Browse all 42,011 barangays
print(barangays) # <PSGC barangay database: 42010 records>
# Get a specific barangay
brgy = barangays.get(name="Tongmageng")
print(brgy.region) # Bangsamoro Autonomous Region In Muslim Mindanao (BARMM)
print(brgy.province) # Tawi-Tawi
print(brgy.psgc_id) # 1907005010
# Hierarchy traversal
for ancestor in brgy.ancestors:
print(f" {ancestor.type.value}: {ancestor.name}")
# Fuzzy search
for r in search_fuzzy("Tongmagen, Tawi-Tawi"):
print(f"{r.name} — score: {r.score}")
# Address validation
result = validate("Tongmageng, Tawi-Tawi")
print(result.valid) # True
# Pandas export
df = barangays.to_frame()Full documentation: https://bendlikeabamboo.github.io/barangay/
🧩 v2026.4.13.1 — Plug-in System & Explode Pipeline
🧩 Plug-in System & Explode Pipeline
This release introduces the plug-in system — a new way to enrich PSGC data with supplementary datasets (correspondence codes, old names, city classification, population, income class, urban/rural status, and more) alongside the explode pipeline for flattening array-type plugin data into denormalized rows.
✨ What's New
Plug-in System
PluginLoader— High-level API for loading barangay data with plugin enrichment (barangay/plugin_loader.py)psgc-aux-data— Built-in remote plugin with supplementary PSGC data sourced from official PSA releases (correspondence codes, old names, city class, income classification, urban/rural, population, status)- Built-in sample plugins —
sample_elevation,sample_population,sample_schools,sample_elevation_timefor demonstration and testing - Plugin discovery — Auto-discovers plugins from built-in directory,
BARANGAY_PLUGINS_DIRenv var,barangay.yamlconfig, and programmatic sources - Time-aware plugins — Supports date-based plugin data resolution with historical coverage back to 2021-08-19
- Remote data fetching — Plugins can reference GitHub repositories for data, with automatic caching
- Multiple data formats — CSV, JSON, and Parquet support
pyyamladded as a runtime dependency for plugin configuration parsing
Explode Pipeline
explode_flat()— Flattens array-type plugin data into denormalized rows (e.g., a barangay with 3 school entries becomes 3 rows)classify_plugins()— Classifies plugins as scalar or array typesvalidate_single_array()— Validates at most one array-type plugin per enrichment operation
CLI Integration
--pluginflag onsearch— Enrich search results with plugin data (barangay search "Tongmageng" --plugin psgc-aux-data --format json)--pluginflag onexport— Export enriched flat data with plugin extensions (barangay export --model flat --plugin psgc-aux-data --format json --output enriched.json)- Automatic column detection for plugin fields in table output
📚 Documentation
- New Plugins documentation section with 6 pages: Overview, CLI Reference, Python API, Configuration, Creating a Plugin, Built-in Plugins
- Updated CLI reference with
--pluginflag documentation - Added plug-in system to README, docs index, and LLM context files (
llms.txt,llms-full.txt) - Plugin guide link added to README
🛠️ Developer Infrastructure
- Added
uv runwrapper in pre-commit hooks for native execution during git commit - Resolved CVE vulnerabilities in dependencies (gitpython, idna, pip, pymdown-extensions, urllib3)
📦 Installation
pip install barangay==2026.4.13.1Quick Start with Plugins
from barangay import PluginLoader
loader = PluginLoader()
loader.enable_plugin("psgc-aux-data")
index = loader.build_index()
print(index["1907005010"]) # Enriched data for Tongmageng# CLI enrichment
barangay search "Tongmageng" --plugin psgc-aux-data --format json
barangay export --model flat --plugin psgc-aux-data --format json --output enriched.jsonFull plugin documentation: https://bendlikeabamboo.github.io/barangay/plugins/
Contributors:
@pyakz for opening the issue
📦⬆️📅 v2026.4.13.0 — PSGC April 2026 Update
What's Changed
📊 PSGC Data Update (April 2026)
- Updated Philippine Standard Geographic Code resource data across all formats (JSON, YAML, Parquet) to the 2026-04-13 release
- Version bumped to 2026.4.13.0
✨ Improvements
- SKILL.md — Restructured with YAML frontmatter, added CLI and Python API examples, and consolidated documentation for better machine readability (#53 (#53))
- Contributing Guide — Expanded with a dedicated data update guide and new contributing index (#52 (#52))
- Test fixtures — Added comprehensive test data files (barangay-tests.csv, expected-simple.json, expected-flat.json, expected-extended.json)
🛠️ CI/CD
🧹 Cleanup
- Removed outdated Jupyter notebooks from the repository (notebooks/)
📝 Full Changelog
🕰️📦 v2026.1.13.3: PSGC Historical Data
What's New
This release introduces official PSGC parsers, replacing the large CSV resource files with a more efficient parser-based approach.
Major Changes
- Official PSGC Parsers: Added
parsers/psgc/module with comprehensive CLI, models, and transformation logic - Data Processing: Implemented PSGC data reading, parsing, and export functionality
- Repository Size Optimization: Removed large CSV resource files (replaced by parser-based approach)
Technical Details
- Added
parsers/psgc/cli.py- Command-line interface for PSGC operations - Added
parsers/psgc/transform.py- Data transformation logic (574 lines) - Added
parsers/psgc/models.py- Data models and schemas - Added
parsers/psgc/read.py- Data reading utilities - Added
parsers/psgc/export.py- Data export functionality - Added
parsers/psgc/constants.py- Constants and configuration
Documentation & Testing
- Updated API documentation and README
- Added parsing process notebooks for main data
- Enhanced testing documentation notebook
- Updated project dependencies in
pyproject.toml
Removed Files
clean_rst.py,test.py,verify_implementation.py(deprecated utilities)- Large CSV resource files (now processed via parsers)
Installation
pip install barangayUsage
from barangay import search_barangay
# Search using the new parser infrastructure
results = search_barangay(mabini)For detailed usage examples, see the updated notebooks in the notebooks/ directory.
📚 v2026.1.13.2: Documentation Migration & Comprehensive Test Suite
Summary
This release represents a major documentation and quality assurance milestone. We've migrated our documentation infrastructure from Sphinx (RST) to MkDocs (Markdown), and added a comprehensive test suite covering CLI, configuration, models, and utilities.
🔄 Breaking Changes
Python Version Requirement
- Minimum Python version increased from 3.12 to 3.13
- Ensure your environment is updated before upgrading
Documentation URL
- Documentation is now hosted at: https://bendlikeabamboo.github.io/barangay/
- Previous README-based documentation links have been updated
🆕 New Features
Documentation Migration
- Migrated entire documentation from Sphinx/RST to MkDocs/Markdown
- New modern, responsive documentation site with shadcn/ui styling
- Simplified documentation structure for better maintainability
- API reference now in Markdown format (docs/api.md)
CLI Documentation
- Complete CLI reference with examples
- Documented all commands: search, export, info, history, cache, batch
- Usage examples for common operations
Comprehensive Test Suite
Added extensive test coverage:
- CLI Tests (841 lines): Full CLI command testing with Click testing framework
- Configuration Tests (156 lines): Environment variable handling and cache directory configuration
- Model Tests (400 lines): Pydantic model validation and serialization
- Utility Tests (112 lines): Input sanitization and helper functions
Enhanced Documentation
- New docs/api.md: Complete API reference
- New docs/cli.md: Full CLI command documentation
- New docs/configuration.md: Configuration options guide
- New docs/data_models/: Separate Python and overview documentation for data models
📝 Changes
Project Configuration
- Updated author email in pyproject.toml
- Changed documentation homepage URL
- Removed Sphinx dependencies
- Added MkDocs dependencies (mkdocs, mkdocs-shadcn, mkdocs-badges)
File Changes
- 74 files changed: 4,099 insertions, 19,866 deletions
- Removed 40+ RST documentation files
- Added 20+ Markdown documentation files
- Added 4 comprehensive test files
- Added SKILL.md for UI/UX skill integration
Documentation Files Added
- docs/api.md - Complete API documentation
- docs/cli.md - CLI command reference
- docs/configuration.md - Configuration guide
- docs/data_models/overview.md - Data models overview
- docs/data_models/python.md - Python data models reference
- docs/stylesheets/extra.css - Custom styling
Documentation Files Removed
- docs/api_reference/ - Entire directory (8 files)
- docs/advanced/ - Entire directory (4 files)
- docs/examples/ - Entire directory (4 files)
- docs/getting_started/ - Entire directory (3 files)
- docs/how_to/ - Entire directory (5 files)
- docs/troubleshooting/ - Entire directory (4 files)
- docs/conf.py - Sphinx configuration
- docs/index.rst - Old index
- docs/Makefile - Sphinx makefile
Core Module Improvements
- barangay/init.py: Streamlined exports and documentation
- barangay/cli.py: Enhanced CLI documentation and comments
- barangay/config.py: Improved configuration handling
- barangay/models.py: Enhanced Pydantic models with better validation
- barangay/utils.py: Improved utility functions
README Updates
- Reorganized feature table
- Added comprehensive CLI usage examples
- Updated Python version requirement note
- Improved getting started section
- Added links to new documentation site
🧪 Testing
New test files added:
- tests/test_cli.py - 841 lines of CLI tests
- tests/test_config.py - 156 lines of config tests
- tests/test_models.py - 400 lines of model tests
- tests/test_utils.py - 112 lines of utility tests
Total: 1,509 lines of new test coverage
📦 Dependencies Updated
Removed (Sphinx ecosystem)
- sphinx>=8.0.0
- furo>=2024.0.0
- sphinx-copybutton>=0.5.0
- sphinx-design>=0.6.0
- sphinx-autodoc-typehints>=2.0.0
- sphinx-autobuild>=2024.0.0
- shibuya>=2026.1.9
- docformatter>=1.7.7
- myst-parser>=5.0.0
- pydata-sphinx-theme>=0.16.1
Added (MkDocs ecosystem)
- mkdocs>=1.6.1
- mkdocs-shadcn>=0.9.9
- mkdocs-badges>=0.5.2
Dev Dependencies
- Added pytest-cov>=7.0.0 for coverage reporting
🔄 Migration Notes
If you have Sphinx-based documentation projects:
- RST files are no longer maintained
- Use the new MkDocs-based documentation structure
- Update any documentation build pipelines to use MkDocs
- Sphinx dependencies can be removed from your environment
📊 Statistics
- Total files changed: 74
- Lines added: 4,099
- Lines deleted: 19,866
- Net change: -15,767 lines (significant codebase simplification)
- Test coverage added: 1,509 lines
- Documentation files migrated: 40+ RST → 20+ Markdown
For full details, see the commits between v2026.1.13.1 and v2026.1.13.2.
🎉🎊 Release v2026.1.13.1: Access to Historical PSGC Data, and Command Line Interface
Release Notes v2026.1.13.1
Overview
This release (v2026.1.13.1) brings significant improvements to the barangay package, including a complete documentation overhaul, new CLI interface, historical data support, and automated documentation deployment via GitHub Pages.
🚀 Major Features
CLI Interface
- New Command-Line Interface: Added comprehensive CLI tool for interacting with barangay data
- Full CLI implementation in
barangay/cli.py - Command-line execution support via
barangay/__main__.py - Complete CLI operations documentation
- Full CLI implementation in
Historical Data Support
- Data Management System: New infrastructure for managing historical PSGC data
barangay/data_manager.py- Core data management functionalitybarangay/date_resolver.py- Date resolution and handlingbarangay/downloader.py- Automated data downloading- Version tracking via
barangay/data/CURRENT_VERSION - Removed outdated dated directories (2025-07-08, 2025-08-29, 2025-10-13)
Configuration Management
- Centralized Configuration: New configuration system for flexible package behavior
barangay/config.py- Configuration management- Comprehensive configuration documentation
📚 Documentation Overhaul
Complete restructure and expansion of documentation:
New Documentation Sections
-
API Reference: Complete API documentation for all modules
- CLI, Config, Data, Data Manager, Date Resolver, Downloader, Fuzz, Models, Search, Utils
-
Advanced Topics: In-depth guides for advanced users
- Caching strategies
- Custom sanitizers
- Error handling
- Fuzzy matching
-
How-To Guides: Practical guides for common tasks
- Address validation
- Batch processing
- CLI operations
- Custom matching
- Performance optimization
-
Core Concepts: Fundamental understanding
- Configuration
- Data models
- Historical data
- Search fundamentals
-
Examples: Real-world usage examples
- CLI usage
- Data analysis
- Geocoding
- Recipes
-
Getting Started: Beginner-friendly guides
- Common patterns
- First search
- Installation
-
Troubleshooting: Help when things go wrong
- Common errors
- FAQ
- Issues
- Performance
-
Contributing: Guide for contributors
🔄 Automation
GitHub Pages Deployment
- Automated Documentation Deployment: GitHub Actions workflow for automatic documentation builds and deployment
- Workflow triggers on manual dispatch and pushes to docs directory
- Automated building and deployment to GitHub Pages
- Workflow file:
.github/workflows/docs.yaml
🐛 Bug Fixes & Improvements
- Fixed
pyproject.tomlconfiguration - Updated README.md with improved documentation
- Enhanced documentation structure and organization
- Updated dependencies for CLI and documentation support
- Added documentation testing notebook
- Various documentation fixes and improvements
📦 Dependencies
Updated Dependencies
- Added CLI dependencies (click, rich)
- Added documentation dependencies (sphinx, furo, and various sphinx extensions)
- Updated existing dependencies to latest compatible versions
📊 Statistics
- Files Changed: 84 files
- Lines Added: 21,822
- Lines Removed: 3,688,242
- New Files: 30+ new documentation files
- New Modules: 5 new Python modules (cli, config, data_manager, date_resolver, downloader)
🔧 Migration Notes
For Users
- No breaking changes to existing API
- New CLI interface available via
barangaycommand - Enhanced documentation available at GitHub Pages
For Developers
- New module structure with better separation of concerns
- Improved configuration system
- Enhanced testing capabilities
v2026.1.13.0
What's Changed
- PSGC 2026-01-13 Update by @bendlikeabamboo in #38
Full Changelog: v2025.10.13.2...v2026.1.13.0