Docs: https://geosub.readthedocs.io/
Lookup ISO 3166-2 geographic subdivisions from postal and country codes, using GeoNames and pycountry.
Adapted from a very similar library for looking up timezones: https://github.com/dmayo3/geotz
- Easy to use. No API key or external API service required.
- Fast offline lookup.
- No downloads required; the necessary data comes bundled with the package.
- No network requests.
- I tried to keep the extra dependencies to a minimum. Only pycountry is required.
- Data is loaded from disk on demand, so as to not use unnecessary memory.
To run the build, there's the GitHub actions workflows as well as the option to run locally.
For running the build locally, use pip install tox and the run tox in the repository base directory (or tox -p to run the build in parallel).
- Ensure you have tox installed e.g. by running pip install tox
- Extract data tox -e extract_data
- Run the build: tox