This directory contains official Python packages for the countries-states-cities-database project.
- countrystatecity-countries - Countries, states, and cities database with type hints and lazy loading
- countrystatecity-timezones - IANA timezone data and utilities
- countrystatecity-currencies - Currency codes, symbols, and formatting
- countrystatecity-languages - Language codes and metadata
- countrystatecity-phonecodes - International dialing codes and validation
pip install countrystatecity-countriesfrom countrystatecity_countries import get_countries, get_country_by_code
# Get all countries
countries = get_countries()
# Get specific country
usa = get_country_by_code("US")
print(f"{usa.emoji} {usa.name}")python/
├── packages/
│ ├── countries/ # Priority 1: Core package
│ ├── timezones/ # Priority 2 (planned)
│ ├── currencies/ # Priority 3 (planned)
│ ├── languages/ # Priority 4 (planned)
│ └── phone-codes/ # Priority 5 (planned)
├── shared/ # Shared utilities
├── scripts/ # Build scripts
└── README.md # This file
For detailed documentation, please refer to the specifications folder:
# Navigate to a package
cd packages/countries
# Install dependencies
pip install -e ".[dev]"# Run tests
pytest
# Run with coverage
pytest --cov=countrystatecity_countries --cov-report=htmlmypy countrystatecity_countries/black countrystatecity_countries/ tests/
isort countrystatecity_countries/ tests/
ruff countrystatecity_countries/ tests/| Component | Technology | Purpose |
|---|---|---|
| Package Manager | pip/setuptools | Dependency management |
| Type System | Pydantic | Data validation, immutable models |
| Testing | pytest | Unit and integration tests |
| Type Checking | mypy | Static type checking |
| Formatting | black + isort | Code formatting |
| Linting | ruff | Fast Python linter |
| Data Format | JSON | Lazy-loadable data files |
- Type Safety - Full type hints with Pydantic models
- Performance - Lazy loading with LRU cache
- Minimal Dependencies - Only essential dependencies
- Python Best Practices - PEP 8 compliant, well-tested
- Developer Experience - Clear APIs, comprehensive docs
All packages are licensed under the Open Database License (ODbL-1.0).
Contributions are welcome! Please see the Contributing Guidelines.
- Documentation: GitHub Repository
- Issues: GitHub Issues
- Website: countrystatecity.in
Made with ❤️ by dr5hn