Releases: datenoio/internacia-python
Releases · datenoio/internacia-python
v0.2.0 - Initial release of Internacia Python SDK
Initial release of Internacia Python SDK
Added
- Initial release of Internacia Python SDK
InternaciaClientmain client classCountriesClientfor querying country dataget_by_code(): Get country by ISO 3166-1 alpha-2 codeget_by_iso3(): Get country by ISO 3166-1 alpha-3 codeget_by_numeric_code(): Get country by numeric codeget_all(): Get all countriesget_by_region(): Get countries by World Bank regionget_by_income_level(): Get countries by income levelget_un_members(): Get UN member countriesget_independent(): Get independent countriesget_by_continent(): Get countries by continentget_by_currency(): Get countries by currencyget_by_language(): Get countries by languagecount(): Get total count of countries
IntblocksClientfor querying international blocks dataget_by_id(): Get block by IDget_all(): Get all blocksget_by_blocktype(): Get blocks by typeget_by_status(): Get blocks by statusget_by_geographic_scope(): Get blocks by geographic scopeget_by_member(): Get blocks containing a countryget_by_acronym(): Get blocks by acronymget_by_tag(): Get blocks by tagget_by_topic(): Get blocks by topicget_by_founded_year(): Get blocks by foundation yearcount(): Get total count of blocks
SearchClientfor fuzzy search functionalityfuzzy(): Multi-language fuzzy search across countries and blocks with configurable search scopesearch_countries(): Search only countriessearch_intblocks(): Search only blocks
- Database download functionality (similar to NLTK's download mechanism)
download_database(): Download pre-built database from GitHub releasesget_latest_version(): Get latest database versioncheck_for_updates(): Check if database updates are availableget_cache_dir(): Get cache directory pathget_cached_database_path(): Get cached database file path- Automatic caching in
~/.internacia/directory - Support for versioned downloads and force re-download
- Progress bar support (with optional
tqdmdependency)
- Configuration management
Configclass for centralized configuration- Environment variable support:
INTERNACIA_DB_PATH,INTERNACIA_LOG_LEVEL,INTERNACIA_CACHE_DIR - Automatic database path resolution (explicit → env var → default → cached)
- Logging configuration with configurable log levels
- Thread-safe
DatabaseManagerusing DuckDB read-only connections - Support for custom database paths
- Comprehensive type hints with TypedDict models
Country,Intblock,SearchResultand supporting types exported- Full type coverage for better IDE support and type checking
- Custom exception hierarchy
InternaciaError: Base exception classDatabaseError: Database-related errorsNotFoundError: Resource not found errorsValidationError: Input validation errorsDownloadError: Database download errorsVersionError: Version-related errors
- Comprehensive logging throughout the codebase
- Structured logging for all operations
- Configurable log levels via environment variable
- Debug logging for query execution and results
- Comprehensive documentation with examples
- Multi-language search support (searches across translations, native names, acronyms)
- Partial match support in search queries
- Comprehensive test suite with 104+ tests covering all public APIs
- 100% coverage of all public methods
- Tests for success cases, error scenarios, and edge cases
- Validation tests for all input parameters
- Connection management and error handling tests
Technical Details
- Built on DuckDB for high-performance queries
- Thread-safe connection handling
- Support for Python 3.8+
- Type hints throughout the codebase with TypedDict models
- Pre-commit hooks for code quality (black, ruff, mypy, pytest)
- MIT License