Skip to content

Migrate to Geocodio API v2#23

Merged
MiniCodeMonkey merged 5 commits into
mainfrom
feat/api-v2
Jun 5, 2026
Merged

Migrate to Geocodio API v2#23
MiniCodeMonkey merged 5 commits into
mainfrom
feat/api-v2

Conversation

@MiniCodeMonkey
Copy link
Copy Markdown
Member

Summary

Migrates the Python client to the Geocodio v2 API. This is a breaking change targeting release 1.0.0.

Breaking changes

  • Base URL: version prefix v1.xv2 (https://api.geocod.io/v2/...). BASE_PATH is now /v2.
  • Top-level input removed: /geocode and /reverse responses no longer include a top-level input object. GeocodingResponse.input has been removed. Parsed address data now lives in results[].address_components.
  • AddressComponents field renames (clean rename, no aliases):
    • zippostal_code
    • statestate_province
    • added unit_type (was secondaryunit) and unit_number (was secondarynumber)
  • Structured address input now accepts state_province (legacy state still accepted for compatibility).

Other changes

  • Version bumped 0.5.11.0.0 (pyproject.toml, _version.py); CHANGELOG.md updated; smoke_lists.py version log strings updated to /v2.
  • Unit-test fixtures/assertions updated to the v2 response shape.
  • Added isort black profile so black and isort agree 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 on main (none introduced by this change).
  • e2e tests not run (require a live API key).

Release note

Breaking change targeting 1.0.0. Do not create a GitHub release/tag yet — a GitHub release triggers automatic PyPI publish.

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.
@MiniCodeMonkey MiniCodeMonkey merged commit 4f04d15 into main Jun 5, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant