Skip to content

Commit 4f04d15

Browse files
Migrate to Geocodio API v2 (#23)
* Migrate to Geocodio API v2 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. * Update e2e test assertions to v2 address-component names 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. * Fix pre-existing state-legislative district_number type assertion 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. * Relax state-leg proportion assertion to accept int or float 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.
1 parent ec82fa2 commit 4f04d15

25 files changed

Lines changed: 1531 additions & 1261 deletions

CHANGELOG.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [1.0.0] - 2026-06-05
11+
12+
### Changed
13+
- **BREAKING**: Migrated to Geocodio API **v2**. The base URL version prefix changed from `v1.x` to `v2` (`https://api.geocod.io/v2/...`).
14+
- **BREAKING**: Removed the top-level `input` object from `/geocode` and `/reverse` responses. `GeocodingResponse.input` has been removed; parsed address information now lives in `results[].address_components`.
15+
- **BREAKING**: Renamed `AddressComponents` fields to match API v2:
16+
- `zip``postal_code`
17+
- `state``state_province`
18+
- Added `unit_type` (was `secondaryunit`) and `unit_number` (was `secondarynumber`)
19+
- Structured address input now accepts `state_province` (the legacy `state` field is still accepted for compatibility).
20+
1021
## [0.7.0] - 2026-03-12
1122

1223
### Changed
@@ -16,7 +27,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1627

1728
### Changed
1829
- Updated default API version from v1.9 to v1.10
19-
2030
## [0.5.1] - 2026-02-18
2131

2232
### Fixed
@@ -69,7 +79,8 @@ When ready to release:
6979
5. Push tags: `git push --tags`
7080
6. GitHub Actions will automatically publish to PyPI
7181

72-
[Unreleased]: https://github.com/Geocodio/geocodio-library-python/compare/v0.7.0...HEAD
82+
[Unreleased]: https://github.com/Geocodio/geocodio-library-python/compare/v1.0.0...HEAD
83+
[1.0.0]: https://github.com/Geocodio/geocodio-library-python/compare/v0.7.0...v1.0.0
7384
[0.7.0]: https://github.com/Geocodio/geocodio-library-python/compare/v0.6.0...v0.7.0
7485
[0.6.0]: https://github.com/Geocodio/geocodio-library-python/compare/v0.5.1...v0.6.0
7586
[0.5.1]: https://github.com/Geocodio/geocodio-library-python/compare/v0.5.0...v0.5.1

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "geocodio-library-python"
7-
version = "0.7.0"
7+
version = "1.0.0"
88
description = "A Python client for the Geocodio API"
99
readme = "README.md"
1010
requires-python = ">=3.11"
@@ -48,6 +48,9 @@ Issues = "https://github.com/geocodio/geocodio-library-python/issues"
4848
[tool.hatch.build.targets.wheel]
4949
packages = ["src/geocodio"]
5050

51+
[tool.isort]
52+
profile = "black"
53+
5154
[tool.pytest.ini_options]
5255
testpaths = ["tests"]
5356
python_files = "test_*.py"

smoke_lists.py

100755100644
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def main():
5757
logger.info("Creating a new list...")
5858
file_content = "Zip\n20003\n20001"
5959
# --- Capture request details ---
60-
logger.info("REQUEST: POST /v1.11/lists")
60+
logger.info("REQUEST: POST /v2/lists")
6161
logger.info(f"Request params: {{'api_key': '***', 'direction': 'forward', 'format': '{{A}}'}}")
6262
logger.info(f"Request files: {{'file': ('smoke_test_list.csv', {repr(file_content)})}}")
6363
new_list_response = client.create_list(
@@ -66,7 +66,7 @@ def main():
6666
format_="{{A}}"
6767
)
6868
# --- Capture response details ---
69-
logger.info("RESPONSE: POST /v1.11/lists")
69+
logger.info("RESPONSE: POST /v2/lists")
7070
print_headers_and_body("Response", {
7171
"id": new_list_response.id,
7272
"file": new_list_response.file,

src/geocodio/__init__.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,24 @@
88

99
# Distance API exports
1010
from .distance import (
11-
Coordinate,
12-
DISTANCE_MODE_STRAIGHTLINE,
1311
DISTANCE_MODE_DRIVING,
1412
DISTANCE_MODE_HAVERSINE,
15-
DISTANCE_UNITS_MILES,
16-
DISTANCE_UNITS_KM,
13+
DISTANCE_MODE_STRAIGHTLINE,
1714
DISTANCE_ORDER_BY_DISTANCE,
1815
DISTANCE_ORDER_BY_DURATION,
1916
DISTANCE_SORT_ASC,
2017
DISTANCE_SORT_DESC,
18+
DISTANCE_UNITS_KM,
19+
DISTANCE_UNITS_MILES,
20+
Coordinate,
2121
)
2222
from .models import (
23-
DistanceResponse,
24-
DistanceMatrixResponse,
2523
DistanceDestination,
26-
DistanceOrigin,
2724
DistanceJobResponse,
25+
DistanceMatrixResponse,
2826
DistanceMatrixResult,
27+
DistanceOrigin,
28+
DistanceResponse,
2929
)
3030

3131
__all__ = [

src/geocodio/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""Version information for geocodio package."""
22

3-
__version__ = "0.7.0"
3+
__version__ = "1.0.0"

0 commit comments

Comments
 (0)