Migrate to Geocodio API v2#23
Merged
Merged
Conversation
Breaking change: migrate the client to the Geocodio v2 API. - Bump base URL version prefix from v1.x to v2 (BASE_PATH = "/v2"). - Remove the top-level `input` object from /geocode and /reverse response parsing. GeocodingResponse.input has been removed; parsed address data now lives in results[].address_components. - Rename AddressComponents fields to match v2: - zip -> postal_code - state -> state_province - add unit_type (was secondaryunit) and unit_number (was secondarynumber) - Structured address input now accepts state_province (legacy `state` still accepted for compatibility). - Bump version 0.5.1 -> 1.0.0 (pyproject.toml + _version.py); update CHANGELOG.md and smoke_lists.py version references. - Update unit-test fixtures and assertions for the v2 response shape. - Add isort black profile so black/isort agree on import formatting.
The unit tests were migrated to v2 but tests/e2e/test_api.py still asserted on the removed .state/.zip attributes, raising KeyError against the live v2 API. Rename to .state_province/.postal_code.
The live API returns state-legislative district_number as a string (model types it as Any); the e2e test wrongly asserted int. Assert presence instead. Unrelated to v2; surfaced now that e2e runs green on geocode/reverse. Congressional district_number (int) left as-is.
API returns proportion as int (1) for whole-district representation; test asserted float only. Accept (int, float). Same pre-existing type-assertion class as district_number, unrelated to v2.
Branch was cut from a stale main (v1.9/0.5.1). Merging brings in the v1.11 bump and the district_number/proportion e2e type fixes that main already landed. Resolved version/BASE_PATH/test-path conflicts in favor of the v2 migration (1.0.0, /v2); combined CHANGELOG; regenerated uv.lock. Full unit + live e2e suites pass.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrates the Python client to the Geocodio v2 API. This is a breaking change targeting release 1.0.0.
Breaking changes
v1.x→v2(https://api.geocod.io/v2/...).BASE_PATHis now/v2.inputremoved:/geocodeand/reverseresponses no longer include a top-levelinputobject.GeocodingResponse.inputhas been removed. Parsed address data now lives inresults[].address_components.AddressComponentsfield renames (clean rename, no aliases):zip→postal_codestate→state_provinceunit_type(wassecondaryunit) andunit_number(wassecondarynumber)state_province(legacystatestill accepted for compatibility).Other changes
0.5.1→1.0.0(pyproject.toml,_version.py);CHANGELOG.mdupdated;smoke_lists.pyversion log strings updated to/v2.blackprofile soblackandisortagree on import formatting.Verification
uv run pytest tests/unit/— 101 passed.flake8,black --check,isort --check— all clean.mypy src/— 19 errors, all pre-existing onmain(none introduced by this change).Release note
Breaking change targeting 1.0.0. Do not create a GitHub release/tag yet — a GitHub release triggers automatic PyPI publish.