hdx-python-country 4.2.4__tar.gz → 4.2.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/PKG-INFO +26 -13
  2. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/README.md +23 -9
  3. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/documentation/index.md +2 -0
  4. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/pyproject.toml +7 -7
  5. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/src/hdx/location/_version.py +2 -2
  6. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/src/hdx/location/currency.py +2 -4
  7. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/src/hdx/location/wfp_exchangerates.py +2 -2
  8. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/uv.lock +174 -660
  9. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/.github/workflows/publish.yaml +0 -0
  10. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/.github/workflows/run-python-tests.yaml +0 -0
  11. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/.gitignore +0 -0
  12. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/.pre-commit-config.yaml +0 -0
  13. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/LICENSE +0 -0
  14. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/documentation/.readthedocs.yaml +0 -0
  15. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/documentation/mkdocs.yaml +0 -0
  16. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/src/hdx/location/Countries & Territories Taxonomy MVP - C&T Taxonomy.csv +0 -0
  17. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/src/hdx/location/__init__.py +0 -0
  18. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/src/hdx/location/adminlevel.py +0 -0
  19. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/src/hdx/location/country.py +0 -0
  20. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/src/hdx/location/int_timestamp.py +0 -0
  21. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/src/hdx/location/wfp_api.py +0 -0
  22. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/tests/fixtures/adminlevel.yaml +0 -0
  23. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/tests/fixtures/adminlevelparent.yaml +0 -0
  24. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/tests/fixtures/fixtures-download-global-pcode-lengths.csv +0 -0
  25. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/tests/fixtures/fixtures-download-global-pcodes-adm-1-2.csv +0 -0
  26. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/tests/fixtures/secondary_historic_rates.csv +0 -0
  27. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/tests/fixtures/secondary_rates.json +0 -0
  28. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/tests/fixtures/wfp/Currency_List_1.json +0 -0
  29. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/tests/fixtures/wfp/Currency_List_2.json +0 -0
  30. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/tests/fixtures/wfp/Currency_UsdIndirectQuotation_1.json +0 -0
  31. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/tests/fixtures/wfp/Currency_UsdIndirectQuotation_10.json +0 -0
  32. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/tests/fixtures/wfp/Currency_UsdIndirectQuotation_2.json +0 -0
  33. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/tests/fixtures/wfp/Currency_UsdIndirectQuotation_3.json +0 -0
  34. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/tests/fixtures/wfp/Currency_UsdIndirectQuotation_4.json +0 -0
  35. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/tests/fixtures/wfp/Currency_UsdIndirectQuotation_5.json +0 -0
  36. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/tests/fixtures/wfp/Currency_UsdIndirectQuotation_6.json +0 -0
  37. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/tests/fixtures/wfp/Currency_UsdIndirectQuotation_7.json +0 -0
  38. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/tests/fixtures/wfp/Currency_UsdIndirectQuotation_8.json +0 -0
  39. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/tests/fixtures/wfp/Currency_UsdIndirectQuotation_9.json +0 -0
  40. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/tests/fixtures/wfp/Markets_List_AFG_1.json +0 -0
  41. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/tests/fixtures/wfp/Markets_List_AFG_2.json +0 -0
  42. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/tests/hdx/location/Countries_UZB_Deleted.csv +0 -0
  43. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/tests/hdx/location/__init__.py +0 -0
  44. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/tests/hdx/location/conftest.py +0 -0
  45. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/tests/hdx/location/test_adminlevel.py +0 -0
  46. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/tests/hdx/location/test_country.py +0 -0
  47. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/tests/hdx/location/test_currency.py +0 -0
  48. {hdx_python_country-4.2.4 → hdx_python_country-4.2.6}/tests/hdx/location/test_wfp_exchangerates.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: hdx-python-country
3
- Version: 4.2.4
3
+ Version: 4.2.6
4
4
  Summary: HDX Python country code and exchange rate (fx) utilities
5
5
  Project-URL: Homepage, https://github.com/OCHA-DAP/hdx-python-country
6
6
  Project-URL: Repository, https://github.com/OCHA-DAP/hdx-python-country
@@ -20,14 +20,13 @@ Classifier: Operating System :: Unix
20
20
  Classifier: Programming Language :: Python
21
21
  Classifier: Programming Language :: Python :: 3
22
22
  Classifier: Programming Language :: Python :: 3 :: Only
23
- Classifier: Programming Language :: Python :: 3.10
24
23
  Classifier: Programming Language :: Python :: 3.11
25
24
  Classifier: Programming Language :: Python :: 3.12
26
25
  Classifier: Programming Language :: Python :: 3.13
27
26
  Classifier: Programming Language :: Python :: 3.14
28
27
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
29
- Requires-Python: >=3.10
30
- Requires-Dist: hdx-python-utilities<5,>=4.2.3
28
+ Requires-Python: >=3.11
29
+ Requires-Dist: hdx-python-utilities<5,>=4.2.5
31
30
  Requires-Dist: tenacity
32
31
  Provides-Extra: docs
33
32
  Requires-Dist: mkapi; extra == 'docs'
@@ -146,24 +145,38 @@ documentation at `documentation/index.md`.
146
145
  ## WFP DataBridges Client
147
146
 
148
147
  The `WFPAPI` class (`hdx.location.wfp_api`) uses WFP's `data-bridges-client` library, which is
149
- published on WFP's own package index rather than PyPI. To install it, use the `wfp` extra with
150
- that index added:
148
+ published on WFP's own package index rather than PyPI. That index hosts only
149
+ `data-bridges-client`, so install it from there first without dependencies, then install the
150
+ `wfp` extra from PyPI:
151
151
 
152
152
  ```shell
153
- pip install "hdx-python-country[wfp]" \
154
- --extra-index-url https://d2i4vvypvg40rv.cloudfront.net/pypi/ \
155
- --index-strategy unsafe-best-match
153
+ pip install "data-bridges-client>=9,<10" --no-deps \
154
+ --index-url https://d2i4vvypvg40rv.cloudfront.net/pypi/
155
+ pip install "hdx-python-country[wfp]"
156
156
  ```
157
157
 
158
- If using `uv`, add the following to your project's `pyproject.toml`:
158
+ Avoid `--extra-index-url`: pip then picks the highest version from either index, so a package
159
+ published on PyPI under the name `data-bridges-client` would be installed instead.
160
+
161
+ If using `uv`, add the following to your project's `pyproject.toml` so that only
162
+ `data-bridges-client` is fetched from WFP's index. `data-bridges-client` must be a direct
163
+ dependency because `tool.uv.sources` does not apply to transitive dependencies; without it, uv
164
+ falls back to an old `hdx-python-country` that has no `wfp` extra:
159
165
 
160
166
  ```toml
161
- [tool.uv]
162
- index-strategy = "unsafe-best-match"
167
+ [project]
168
+ dependencies = [
169
+ "hdx-python-country[wfp]",
170
+ "data-bridges-client>=9,<10",
171
+ ]
163
172
 
164
173
  [[tool.uv.index]]
165
174
  name = "wfp"
166
175
  url = "https://d2i4vvypvg40rv.cloudfront.net/pypi/"
176
+ explicit = true
177
+
178
+ [tool.uv.sources]
179
+ data-bridges-client = { index = "wfp" }
167
180
  ```
168
181
 
169
- then run `uv sync --extra wfp`.
182
+ then run `uv sync`.
@@ -109,24 +109,38 @@ documentation at `documentation/index.md`.
109
109
  ## WFP DataBridges Client
110
110
 
111
111
  The `WFPAPI` class (`hdx.location.wfp_api`) uses WFP's `data-bridges-client` library, which is
112
- published on WFP's own package index rather than PyPI. To install it, use the `wfp` extra with
113
- that index added:
112
+ published on WFP's own package index rather than PyPI. That index hosts only
113
+ `data-bridges-client`, so install it from there first without dependencies, then install the
114
+ `wfp` extra from PyPI:
114
115
 
115
116
  ```shell
116
- pip install "hdx-python-country[wfp]" \
117
- --extra-index-url https://d2i4vvypvg40rv.cloudfront.net/pypi/ \
118
- --index-strategy unsafe-best-match
117
+ pip install "data-bridges-client>=9,<10" --no-deps \
118
+ --index-url https://d2i4vvypvg40rv.cloudfront.net/pypi/
119
+ pip install "hdx-python-country[wfp]"
119
120
  ```
120
121
 
121
- If using `uv`, add the following to your project's `pyproject.toml`:
122
+ Avoid `--extra-index-url`: pip then picks the highest version from either index, so a package
123
+ published on PyPI under the name `data-bridges-client` would be installed instead.
124
+
125
+ If using `uv`, add the following to your project's `pyproject.toml` so that only
126
+ `data-bridges-client` is fetched from WFP's index. `data-bridges-client` must be a direct
127
+ dependency because `tool.uv.sources` does not apply to transitive dependencies; without it, uv
128
+ falls back to an old `hdx-python-country` that has no `wfp` extra:
122
129
 
123
130
  ```toml
124
- [tool.uv]
125
- index-strategy = "unsafe-best-match"
131
+ [project]
132
+ dependencies = [
133
+ "hdx-python-country[wfp]",
134
+ "data-bridges-client>=9,<10",
135
+ ]
126
136
 
127
137
  [[tool.uv.index]]
128
138
  name = "wfp"
129
139
  url = "https://d2i4vvypvg40rv.cloudfront.net/pypi/"
140
+ explicit = true
141
+
142
+ [tool.uv.sources]
143
+ data-bridges-client = { index = "wfp" }
130
144
  ```
131
145
 
132
- then run `uv sync --extra wfp`.
146
+ then run `uv sync`.
@@ -42,6 +42,8 @@ The code for the library is [here](https://github.com/OCHA-DAP/hdx-python-countr
42
42
  The library has detailed API documentation which can be found in the menu at the top.
43
43
 
44
44
  ## Breaking Changes
45
+ From 4.2.6, Python 3.11 or later and HDX Python Utilities 4.2.5 or later are required.
46
+
45
47
  From 4.2.4, the AdminLevel matcher parameter is removed and HDX Python Utilities
46
48
  4.2.3 or later is required.
47
49
 
@@ -18,7 +18,6 @@ classifiers = [
18
18
  "Programming Language :: Python",
19
19
  "Programming Language :: Python :: 3",
20
20
  "Programming Language :: Python :: 3 :: Only",
21
- "Programming Language :: Python :: 3.10",
22
21
  "Programming Language :: Python :: 3.11",
23
22
  "Programming Language :: Python :: 3.12",
24
23
  "Programming Language :: Python :: 3.13",
@@ -33,10 +32,10 @@ classifiers = [
33
32
  ]
34
33
  readme = "README.md"
35
34
  dynamic = ["version"]
36
- requires-python = ">=3.10"
35
+ requires-python = ">=3.11"
37
36
 
38
37
  dependencies = [
39
- "hdx-python-utilities>=4.2.3,<5",
38
+ "hdx-python-utilities>=4.2.5,<5",
40
39
  "tenacity",
41
40
  ]
42
41
 
@@ -82,19 +81,20 @@ allow-direct-references = true
82
81
  # uv (Package Management)
83
82
  # ----------------------------------------------------------------------------
84
83
 
85
- [tool.uv]
86
- index-strategy = "unsafe-best-match"
87
-
88
84
  [[tool.uv.index]]
89
85
  name = "wfp"
90
86
  url = "https://d2i4vvypvg40rv.cloudfront.net/pypi/"
87
+ explicit = true
88
+
89
+ [tool.uv.sources]
90
+ data-bridges-client = { index = "wfp" }
91
91
 
92
92
  # ----------------------------------------------------------------------------
93
93
  # Ruff (Linting & Formatting)
94
94
  # ----------------------------------------------------------------------------
95
95
 
96
96
  [tool.ruff]
97
- target-version = "py310"
97
+ target-version = "py311"
98
98
  src = ["src"]
99
99
  exclude = ["_version.py"]
100
100
 
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
18
18
  commit_id: str | None
19
19
  __commit_id__: str | None
20
20
 
21
- __version__ = version = '4.2.4'
22
- __version_tuple__ = version_tuple = (4, 2, 4)
21
+ __version__ = version = '4.2.6'
22
+ __version_tuple__ = version_tuple = (4, 2, 6)
23
23
 
24
24
  __commit_id__ = commit_id = None
@@ -2,7 +2,7 @@
2
2
 
3
3
  import logging
4
4
  from copy import deepcopy
5
- from datetime import datetime, timezone
5
+ from datetime import UTC, datetime
6
6
  from pathlib import Path
7
7
 
8
8
  from hdx.utilities.dateparse import (
@@ -484,9 +484,7 @@ class Currency:
484
484
  if currency == "USD":
485
485
  return 1
486
486
  if ignore_timeinfo:
487
- date = date.replace(
488
- hour=0, minute=0, second=0, microsecond=0, tzinfo=timezone.utc
489
- )
487
+ date = date.replace(hour=0, minute=0, second=0, microsecond=0, tzinfo=UTC)
490
488
  timestamp = get_int_timestamp(date)
491
489
  return cls._get_historic_rate(currency, timestamp)
492
490
 
@@ -1,6 +1,6 @@
1
1
  import logging
2
2
  from collections.abc import Sequence
3
- from datetime import timezone
3
+ from datetime import UTC
4
4
 
5
5
  from .int_timestamp import get_int_timestamp
6
6
  from .wfp_api import WFPAPI
@@ -62,7 +62,7 @@ class WFPExchangeRates:
62
62
  # data_bridges_client parses WFP's timezone-less date strings
63
63
  # into naive datetimes; assume UTC to match previous
64
64
  # parse_date-based behaviour
65
- date = date.replace(tzinfo=timezone.utc)
65
+ date = date.replace(tzinfo=UTC)
66
66
  timestamp = get_int_timestamp(date)
67
67
  historic_rates[timestamp] = quote.value
68
68
  return historic_rates