hdx-python-country 4.0.0__tar.gz → 4.1.0__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 (54) hide show
  1. hdx_python_country-4.1.0/.github/workflows/publish.yaml +34 -0
  2. hdx_python_country-4.1.0/.github/workflows/run-python-tests.yaml +49 -0
  3. {hdx_python_country-4.0.0 → hdx_python_country-4.1.0}/.pre-commit-config.yaml +8 -9
  4. {hdx_python_country-4.0.0 → hdx_python_country-4.1.0}/PKG-INFO +28 -46
  5. {hdx_python_country-4.0.0 → hdx_python_country-4.1.0}/README.md +24 -37
  6. {hdx_python_country-4.0.0 → hdx_python_country-4.1.0}/documentation/index.md +32 -21
  7. hdx_python_country-4.1.0/pyproject.toml +140 -0
  8. hdx_python_country-4.0.0/src/hdx/location/Countries & Territories Taxonomy MVP - C&T Taxonomy with HXL Tags.csv → hdx_python_country-4.1.0/src/hdx/location/Countries & Territories Taxonomy MVP - C&T Taxonomy.csv +256 -257
  9. {hdx_python_country-4.0.0 → hdx_python_country-4.1.0}/src/hdx/location/_version.py +2 -2
  10. {hdx_python_country-4.0.0 → hdx_python_country-4.1.0}/src/hdx/location/adminlevel.py +5 -4
  11. {hdx_python_country-4.0.0 → hdx_python_country-4.1.0}/src/hdx/location/country.py +154 -93
  12. {hdx_python_country-4.0.0 → hdx_python_country-4.1.0}/src/hdx/location/currency.py +5 -4
  13. {hdx_python_country-4.0.0 → hdx_python_country-4.1.0}/src/hdx/location/wfp_api.py +2 -1
  14. {hdx_python_country-4.0.0 → hdx_python_country-4.1.0}/tests/hdx/location/Countries_UZB_Deleted.csv +2 -3
  15. {hdx_python_country-4.0.0 → hdx_python_country-4.1.0}/tests/hdx/location/conftest.py +3 -3
  16. {hdx_python_country-4.0.0 → hdx_python_country-4.1.0}/tests/hdx/location/test_adminlevel.py +4 -6
  17. {hdx_python_country-4.0.0 → hdx_python_country-4.1.0}/tests/hdx/location/test_country.py +480 -450
  18. {hdx_python_country-4.0.0 → hdx_python_country-4.1.0}/tests/hdx/location/test_currency.py +2 -4
  19. hdx_python_country-4.1.0/uv.lock +1829 -0
  20. hdx_python_country-4.0.0/.coveragerc +0 -17
  21. hdx_python_country-4.0.0/.github/workflows/publish.yaml +0 -37
  22. hdx_python_country-4.0.0/.github/workflows/run-python-tests.yaml +0 -53
  23. hdx_python_country-4.0.0/hatch.toml +0 -37
  24. hdx_python_country-4.0.0/pyproject.toml +0 -53
  25. hdx_python_country-4.0.0/pytest.ini +0 -4
  26. hdx_python_country-4.0.0/requirements.txt +0 -157
  27. hdx_python_country-4.0.0/ruff.toml +0 -10
  28. {hdx_python_country-4.0.0 → hdx_python_country-4.1.0}/.gitignore +0 -0
  29. {hdx_python_country-4.0.0 → hdx_python_country-4.1.0}/LICENSE +0 -0
  30. {hdx_python_country-4.0.0 → hdx_python_country-4.1.0}/documentation/.readthedocs.yaml +0 -0
  31. {hdx_python_country-4.0.0 → hdx_python_country-4.1.0}/documentation/mkdocs.yaml +0 -0
  32. {hdx_python_country-4.0.0 → hdx_python_country-4.1.0}/src/hdx/location/__init__.py +0 -0
  33. {hdx_python_country-4.0.0 → hdx_python_country-4.1.0}/src/hdx/location/int_timestamp.py +0 -0
  34. {hdx_python_country-4.0.0 → hdx_python_country-4.1.0}/src/hdx/location/wfp_exchangerates.py +0 -0
  35. {hdx_python_country-4.0.0 → hdx_python_country-4.1.0}/tests/fixtures/adminlevel.yaml +0 -0
  36. {hdx_python_country-4.0.0 → hdx_python_country-4.1.0}/tests/fixtures/adminlevelparent.yaml +0 -0
  37. {hdx_python_country-4.0.0 → hdx_python_country-4.1.0}/tests/fixtures/download-global-pcode-lengths.csv +0 -0
  38. {hdx_python_country-4.0.0 → hdx_python_country-4.1.0}/tests/fixtures/download-global-pcodes-adm-1-2.csv +0 -0
  39. {hdx_python_country-4.0.0 → hdx_python_country-4.1.0}/tests/fixtures/secondary_historic_rates.csv +0 -0
  40. {hdx_python_country-4.0.0 → hdx_python_country-4.1.0}/tests/fixtures/secondary_rates.json +0 -0
  41. {hdx_python_country-4.0.0 → hdx_python_country-4.1.0}/tests/fixtures/wfp/Currency_List_1.json +0 -0
  42. {hdx_python_country-4.0.0 → hdx_python_country-4.1.0}/tests/fixtures/wfp/Currency_List_2.json +0 -0
  43. {hdx_python_country-4.0.0 → hdx_python_country-4.1.0}/tests/fixtures/wfp/Currency_UsdIndirectQuotation_1.json +0 -0
  44. {hdx_python_country-4.0.0 → hdx_python_country-4.1.0}/tests/fixtures/wfp/Currency_UsdIndirectQuotation_10.json +0 -0
  45. {hdx_python_country-4.0.0 → hdx_python_country-4.1.0}/tests/fixtures/wfp/Currency_UsdIndirectQuotation_2.json +0 -0
  46. {hdx_python_country-4.0.0 → hdx_python_country-4.1.0}/tests/fixtures/wfp/Currency_UsdIndirectQuotation_3.json +0 -0
  47. {hdx_python_country-4.0.0 → hdx_python_country-4.1.0}/tests/fixtures/wfp/Currency_UsdIndirectQuotation_4.json +0 -0
  48. {hdx_python_country-4.0.0 → hdx_python_country-4.1.0}/tests/fixtures/wfp/Currency_UsdIndirectQuotation_5.json +0 -0
  49. {hdx_python_country-4.0.0 → hdx_python_country-4.1.0}/tests/fixtures/wfp/Currency_UsdIndirectQuotation_6.json +0 -0
  50. {hdx_python_country-4.0.0 → hdx_python_country-4.1.0}/tests/fixtures/wfp/Currency_UsdIndirectQuotation_7.json +0 -0
  51. {hdx_python_country-4.0.0 → hdx_python_country-4.1.0}/tests/fixtures/wfp/Currency_UsdIndirectQuotation_8.json +0 -0
  52. {hdx_python_country-4.0.0 → hdx_python_country-4.1.0}/tests/fixtures/wfp/Currency_UsdIndirectQuotation_9.json +0 -0
  53. {hdx_python_country-4.0.0 → hdx_python_country-4.1.0}/tests/hdx/location/__init__.py +0 -0
  54. {hdx_python_country-4.0.0 → hdx_python_country-4.1.0}/tests/hdx/location/test_wfp_exchangerates.py +0 -0
@@ -0,0 +1,34 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ publish:
9
+ runs-on: ubuntu-latest
10
+
11
+ environment:
12
+ name: pypi
13
+ url: https://pypi.org/p/hdx-python-country
14
+
15
+ permissions:
16
+ id-token: write
17
+ contents: read
18
+
19
+ steps:
20
+ - uses: actions/checkout@v6
21
+
22
+ - name: Get history and tags for versioning to work
23
+ run: |
24
+ git fetch --prune --unshallow
25
+ git fetch --depth=1 origin +refs/tags/*:refs/tags/*
26
+
27
+ - name: Install uv
28
+ uses: astral-sh/setup-uv@v7
29
+
30
+ - name: Build with uv
31
+ run: uv build
32
+
33
+ - name: Publish distribution 📦 to PyPI
34
+ run: uv publish
@@ -0,0 +1,49 @@
1
+ name: Run tests
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ push:
6
+ branches-ignore: [gh-pages, "dependabot/**"]
7
+ pull_request:
8
+ branches-ignore: [gh-pages]
9
+
10
+ jobs:
11
+ build:
12
+ runs-on: ubuntu-latest
13
+ permissions:
14
+ contents: read
15
+ checks: write
16
+ pull-requests: write
17
+
18
+ steps:
19
+ - uses: actions/checkout@v6
20
+
21
+ - name: Install uv
22
+ uses: astral-sh/setup-uv@v7
23
+ with:
24
+ enable-cache: true
25
+ python-version: "3.13"
26
+
27
+ - name: Install dependencies
28
+ run: uv sync --frozen
29
+
30
+ - name: Check styling
31
+ run: |
32
+ uv run ruff format --check
33
+ uv run ruff check
34
+
35
+ - name: Test with pytest
36
+ run: uv run pytest
37
+
38
+ - name: Publish Unit Test Results
39
+ uses: EnricoMi/publish-unit-test-result-action@v2
40
+ if: always()
41
+ with:
42
+ files: test-results.xml
43
+
44
+ - name: Publish in Coveralls
45
+ uses: coverallsapp/github-action@v2
46
+ if: always()
47
+ with:
48
+ flag-name: tests
49
+ format: lcov
@@ -1,5 +1,6 @@
1
1
  default_language_version:
2
- python: python3.13
2
+ python: python3.13
3
+
3
4
  repos:
4
5
  - repo: https://github.com/pre-commit/pre-commit-hooks
5
6
  rev: v6.0.0
@@ -7,20 +8,18 @@ repos:
7
8
  - id: trailing-whitespace
8
9
  - id: end-of-file-fixer
9
10
  - id: check-ast
11
+
10
12
  - repo: https://github.com/astral-sh/ruff-pre-commit
11
- rev: v0.14.10
13
+ rev: v0.14.13
12
14
  hooks:
13
15
  # Run the linter.
14
16
  - id: ruff-check
15
17
  args: [ --fix ]
16
18
  # Run the formatter.
17
19
  - id: ruff-format
20
+
18
21
  - repo: https://github.com/astral-sh/uv-pre-commit
19
- rev: 0.9.22
22
+ rev: 0.9.25
20
23
  hooks:
21
- # Run the pip compile
22
- - id: pip-compile
23
- name: pip-compile requirements.txt
24
- files: pyproject.toml
25
- args: [ pyproject.toml, --resolver=backtracking, --upgrade, -q,
26
- -o, requirements.txt ]
24
+ # Ensure the lockfile is up-to-date with pyproject.toml
25
+ - id: uv-lock
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hdx-python-country
3
- Version: 4.0.0
3
+ Version: 4.1.0
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
  Author: Michael Rans
@@ -18,23 +18,18 @@ Classifier: Operating System :: Unix
18
18
  Classifier: Programming Language :: Python
19
19
  Classifier: Programming Language :: Python :: 3
20
20
  Classifier: Programming Language :: Python :: 3 :: Only
21
- Classifier: Programming Language :: Python :: 3.8
22
- Classifier: Programming Language :: Python :: 3.9
23
21
  Classifier: Programming Language :: Python :: 3.10
24
22
  Classifier: Programming Language :: Python :: 3.11
25
23
  Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Programming Language :: Python :: 3.13
25
+ Classifier: Programming Language :: Python :: 3.14
26
26
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
27
27
  Requires-Python: >=3.10
28
- Requires-Dist: hdx-python-utilities>=4.0.0
28
+ Requires-Dist: hdx-python-utilities>=4.0.4
29
29
  Requires-Dist: libhxl>=5.2.2
30
30
  Requires-Dist: tenacity
31
- Provides-Extra: dev
32
- Requires-Dist: pre-commit; extra == 'dev'
33
31
  Provides-Extra: docs
34
32
  Requires-Dist: mkapi; extra == 'docs'
35
- Provides-Extra: test
36
- Requires-Dist: pytest; extra == 'test'
37
- Requires-Dist: pytest-cov; extra == 'test'
38
33
  Description-Content-Type: text/markdown
39
34
 
40
35
  [![Build Status](https://github.com/OCHA-DAP/hdx-python-country/actions/workflows/run-python-tests.yaml/badge.svg)](https://github.com/OCHA-DAP/hdx-python-country/actions/workflows/run-python-tests.yaml)
@@ -70,30 +65,24 @@ This library is part of the [Humanitarian Data Exchange](https://data.humdata.or
70
65
  (HDX) project. If you have humanitarian related data, please upload your datasets to
71
66
  HDX.
72
67
 
73
- ## Development
68
+ # Development
74
69
 
75
- ### Environment
70
+ ## Environment
76
71
 
77
- Development is currently done using Python 3.12. We recommend using a virtual
78
- environment such as ``venv``:
72
+ Development is currently done using Python 3.13. The environment can be created with:
79
73
 
80
74
  ```shell
81
- python -m venv venv
82
- source venv/bin/activate
75
+ uv sync
83
76
  ```
84
77
 
85
- In your virtual environment, install all packages for development by running:
86
-
87
- ```shell
88
- pip install -r requirements.txt
89
- ```
78
+ This creates a .venv folder with the versions specified in the project's uv.lock file.
90
79
 
91
80
  ### Pre-commit
92
81
 
93
- Be sure to install `pre-commit`, which is run every time you make a git commit:
82
+ pre-commit will be installed when syncing uv. It is run every time you make a git
83
+ commit if you call it like this:
94
84
 
95
85
  ```shell
96
- pip install pre-commit
97
86
  pre-commit install
98
87
  ```
99
88
 
@@ -106,20 +95,6 @@ To check if your changes pass pre-commit without committing, run:
106
95
  pre-commit run --all-files
107
96
  ```
108
97
 
109
- ### Testing
110
-
111
- Ensure you have the required packages to run the tests:
112
-
113
- ```shell
114
- pip install -r requirements.txt
115
- ```
116
-
117
- To run the tests and view coverage, execute:
118
-
119
- ```shell
120
- pytest -c --cov hdx
121
- ```
122
-
123
98
  ## Packages
124
99
 
125
100
  [uv](https://github.com/astral-sh/uv) is used for package management. If
@@ -127,33 +102,40 @@ you’ve introduced a new package to the source code (i.e. anywhere in `src/`),
127
102
  please add it to the `project.dependencies` section of `pyproject.toml` with
128
103
  any known version constraints.
129
104
 
130
- To add packages required only for testing, add them to the `test` section under
131
- `[project.optional-dependencies]`.
105
+ To add packages required only for testing, add them to the
106
+ `[dependency-groups]`.
132
107
 
133
108
  Any changes to the dependencies will be automatically reflected in
134
- `requirements.txt` with `pre-commit`, but you can re-generate the file without
135
- committing by executing:
109
+ `uv.lock` with `pre-commit`, but you can re-generate the files without committing by
110
+ executing:
136
111
 
137
112
  ```shell
138
- pre-commit run pip-compile --all-files
113
+ uv lock --upgrade
139
114
  ```
140
115
 
141
116
  ## Project
142
117
 
143
- [Hatch](https://hatch.pypa.io/) is used for project management. The project can be built using:
118
+ [uv](https://github.com/astral-sh/uv) is used for project management. The project can be
119
+ built using:
144
120
 
145
121
  ```shell
146
- hatch build
122
+ uv build
147
123
  ```
148
124
 
149
125
  Linting and syntax checking can be run with:
150
126
 
151
127
  ```shell
152
- hatch fmt --check
128
+ uv run ruff check
153
129
  ```
154
130
 
155
- Tests can be executed using:
131
+ To run the tests and view coverage, execute:
156
132
 
157
133
  ```shell
158
- hatch test
134
+ uv run pytest
159
135
  ```
136
+
137
+ ## Documentation
138
+
139
+ The documentation, including API documentation, is generated using ReadtheDocs and
140
+ MkDocs with Material. As you change the source code, remember to update the
141
+ documentation at `documentation/index.md`.
@@ -31,30 +31,24 @@ This library is part of the [Humanitarian Data Exchange](https://data.humdata.or
31
31
  (HDX) project. If you have humanitarian related data, please upload your datasets to
32
32
  HDX.
33
33
 
34
- ## Development
34
+ # Development
35
35
 
36
- ### Environment
36
+ ## Environment
37
37
 
38
- Development is currently done using Python 3.12. We recommend using a virtual
39
- environment such as ``venv``:
38
+ Development is currently done using Python 3.13. The environment can be created with:
40
39
 
41
40
  ```shell
42
- python -m venv venv
43
- source venv/bin/activate
41
+ uv sync
44
42
  ```
45
43
 
46
- In your virtual environment, install all packages for development by running:
47
-
48
- ```shell
49
- pip install -r requirements.txt
50
- ```
44
+ This creates a .venv folder with the versions specified in the project's uv.lock file.
51
45
 
52
46
  ### Pre-commit
53
47
 
54
- Be sure to install `pre-commit`, which is run every time you make a git commit:
48
+ pre-commit will be installed when syncing uv. It is run every time you make a git
49
+ commit if you call it like this:
55
50
 
56
51
  ```shell
57
- pip install pre-commit
58
52
  pre-commit install
59
53
  ```
60
54
 
@@ -67,20 +61,6 @@ To check if your changes pass pre-commit without committing, run:
67
61
  pre-commit run --all-files
68
62
  ```
69
63
 
70
- ### Testing
71
-
72
- Ensure you have the required packages to run the tests:
73
-
74
- ```shell
75
- pip install -r requirements.txt
76
- ```
77
-
78
- To run the tests and view coverage, execute:
79
-
80
- ```shell
81
- pytest -c --cov hdx
82
- ```
83
-
84
64
  ## Packages
85
65
 
86
66
  [uv](https://github.com/astral-sh/uv) is used for package management. If
@@ -88,33 +68,40 @@ you’ve introduced a new package to the source code (i.e. anywhere in `src/`),
88
68
  please add it to the `project.dependencies` section of `pyproject.toml` with
89
69
  any known version constraints.
90
70
 
91
- To add packages required only for testing, add them to the `test` section under
92
- `[project.optional-dependencies]`.
71
+ To add packages required only for testing, add them to the
72
+ `[dependency-groups]`.
93
73
 
94
74
  Any changes to the dependencies will be automatically reflected in
95
- `requirements.txt` with `pre-commit`, but you can re-generate the file without
96
- committing by executing:
75
+ `uv.lock` with `pre-commit`, but you can re-generate the files without committing by
76
+ executing:
97
77
 
98
78
  ```shell
99
- pre-commit run pip-compile --all-files
79
+ uv lock --upgrade
100
80
  ```
101
81
 
102
82
  ## Project
103
83
 
104
- [Hatch](https://hatch.pypa.io/) is used for project management. The project can be built using:
84
+ [uv](https://github.com/astral-sh/uv) is used for project management. The project can be
85
+ built using:
105
86
 
106
87
  ```shell
107
- hatch build
88
+ uv build
108
89
  ```
109
90
 
110
91
  Linting and syntax checking can be run with:
111
92
 
112
93
  ```shell
113
- hatch fmt --check
94
+ uv run ruff check
114
95
  ```
115
96
 
116
- Tests can be executed using:
97
+ To run the tests and view coverage, execute:
117
98
 
118
99
  ```shell
119
- hatch test
100
+ uv run pytest
120
101
  ```
102
+
103
+ ## Documentation
104
+
105
+ The documentation, including API documentation, is generated using ReadtheDocs and
106
+ MkDocs with Material. As you change the source code, remember to update the
107
+ documentation at `documentation/index.md`.
@@ -42,7 +42,11 @@ 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.0.0, Python 3.10 or later is required
45
+ From 4.1.0, HXL hashtags no longer used in Country class. The header names are used
46
+ instead.
47
+
48
+ From 4.0.0, Python 3.10 or later is required as well as HDX Python Utilities >= 4. To
49
+ continue using HDX Python Country < 4, please pin to HDX Python Utilities < 4.
46
50
 
47
51
  From 3.9.2, must call Currency.setup before using Currency methods.
48
52
 
@@ -91,26 +95,33 @@ The usage of the country mappings functionality is best illustrated by some exam
91
95
  # returns ("CZE", False)
92
96
 
93
97
  Country.get_country_info_from_iso2("jp")
94
- # Returns dictionary with HXL hashtags as keys. For more on HXL, see http://hxlstandard.org/
95
- # {"#country+alt+i_ar+name+v_m49": "اليابان", "#country+alt+i_ar+name+v_unterm": "اليابان",
96
- # "#country+alt+i_en+name+v_m49": "Japan", "#country+alt+i_en+name+v_unterm": "Japan",
97
- # "#country+alt+i_es+name+v_m49": "Japón", "#country+alt+i_es+name+v_unterm": "Japón",
98
- # "#country+alt+i_fr+name+v_m49": "Japon", "#country+alt+i_fr+name+v_unterm": "Japon",
99
- # "#country+alt+i_ru+name+v_m49": "Япония", "#country+alt+i_ru+name+v_unterm": "Япония",
100
- # "#country+alt+i_zh+name+v_m49": "日本", "#country+alt+i_zh+name+v_unterm": "日本",
101
- # "#country+alt+name+v_dgacm": "", "#country+alt+name+v_hpctools": "",
102
- # "#country+alt+name+v_iso": "", "#country+alt+name+v_reliefweb": "",
103
- # "#country+code+num+v_m49": "392", "#country+code+v_hpctools": "112",
104
- # "#country+code+v_iso2": "JP", "#country+code+v_iso3": "JPN",
105
- # "#country+code+v_reliefweb": "128", "#country+formal+i_en+name+v_unterm": "Japan",
106
- # "#country+name+preferred": "Japan", "#country+name+short+v_reliefweb": "",
107
- # "#country+regex": "japan", "#currency+code": "JPY", "#date+start": "1974-01-01",
108
- # "#geo+admin_level": "0", "#geo+lat": "37.63209801", "#geo+lon": "138.0812256",
109
- # "#indicator+bool+hrp": "", "#indicator+bool+gho": "", "#indicator+incomelevel": "High",
110
- # "#meta+bool+deprecated": "N", "#meta+bool+independent": "Y", "#meta+id": "112",
111
- # "#region+code+intermediate": "", "#region+code+main": "142", "#region+code+sub": "30",
112
- # "#region+intermediate+name+preferred": "", "#region+main+name+preferred": "Asia",
113
- # "#region+name+preferred+sub": "Eastern Asia"}
98
+ # Returns dictionary of country data
99
+ # {
100
+ # "Admin Level": "0", "Appears in DGACM list": "Y",
101
+ # "Appears in UNTERM list": "Y", "Arabic Short": "اليابان",
102
+ # "Chinese Short": "日本", "Concatenation": "112 - Japan",
103
+ # "Currency": "JPY", "DGACM Alt Term": None,
104
+ # "Deprecated": "N", "English Formal": "Japan",
105
+ # "English Short": "Japan", "French Short": "Japon",
106
+ # "HPC Tools API ID": "112", "HPC Tools Alt Term": None,
107
+ # "Has HRP": None, "ID": "112",
108
+ # "ISO 3166-1 Alpha 2-Codes": "JP", "ISO 3166-1 Alpha 3-Codes": "JPN",
109
+ # "ISO Alt Term": None, "In GHO": None,
110
+ # "Independent": "Y", "Intermediate Region Code": None,
111
+ # "Intermediate Region Name": None, "Latitude": "37.63209801",
112
+ # "Longitude": "138.0812256", "M49 Arabic": "اليابان",
113
+ # "M49 Chinese": "日本", "M49 English": "Japan",
114
+ # "M49 French": "Japon", "M49 Russian": "Япония",
115
+ # "M49 Spanish": "Japón", "Preferred Term": "Japan",
116
+ # "RW API Alt Term": None, "RW ID": "128",
117
+ # "RW Short Name": None, "Reference Period Start": "1974-01-01",
118
+ # "Regex": "japan", "Region Code": "142",
119
+ # "Region Name": "Asia", "Russian Short": "Япония",
120
+ # "Spanish Short": "Japón", "Sub-region Code": "30",
121
+ # "Sub-region Name": "Eastern Asia", "World Bank Income Level": "High",
122
+ # "m49 numerical code": "392", "x Alpha2 codes": None,
123
+ # "x Alpha3 codes": None
124
+ # }
114
125
  Country.get_countries_in_region("Channel Islands")
115
126
  # ["GGY", "JEY"]
116
127
  len(Country.get_countries_in_region("Africa"))
@@ -0,0 +1,140 @@
1
+ #########################
2
+ # Project Configuration #
3
+ #########################
4
+
5
+ [build-system]
6
+ requires = ["hatchling", "hatch-vcs"]
7
+ build-backend = "hatchling.build"
8
+
9
+ [project]
10
+ name = "hdx-python-country"
11
+ description = "HDX Python country code and exchange rate (fx) utilities"
12
+ authors = [{name = "Michael Rans"}]
13
+ license = {text = "MIT"}
14
+ keywords = ["HDX", "location", "country", "country code", "iso 3166", "iso2", "iso3", "region", "fx", "currency", "currencies", "exchange rate", "foreign exchange"]
15
+ classifiers = [
16
+ "Development Status :: 5 - Production/Stable",
17
+ "Topic :: Software Development :: Libraries :: Python Modules",
18
+ "Programming Language :: Python",
19
+ "Programming Language :: Python :: 3",
20
+ "Programming Language :: Python :: 3 :: Only",
21
+ "Programming Language :: Python :: 3.10",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ "Programming Language :: Python :: 3.13",
25
+ "Programming Language :: Python :: 3.14",
26
+ "Intended Audience :: Developers",
27
+ "License :: OSI Approved :: MIT License",
28
+ "Natural Language :: English",
29
+ "Operating System :: POSIX :: Linux",
30
+ "Operating System :: Unix",
31
+ "Operating System :: MacOS",
32
+ "Operating System :: Microsoft :: Windows",
33
+ ]
34
+ readme = "README.md"
35
+ dynamic = ["version"]
36
+ requires-python = ">=3.10"
37
+
38
+ dependencies = [
39
+ "hdx-python-utilities>=4.0.4",
40
+ "libhxl>=5.2.2",
41
+ "tenacity",
42
+ ]
43
+
44
+ [project.optional-dependencies]
45
+ docs = ["mkapi"]
46
+
47
+ [dependency-groups]
48
+ dev = [
49
+ "pytest",
50
+ "pytest-cov",
51
+ "pre-commit",
52
+ "ruff==0.14.13",
53
+ ]
54
+
55
+ [project.urls]
56
+ Homepage = "https://github.com/OCHA-DAP/hdx-python-country"
57
+
58
+ # ----------------------------------------------------------------------------
59
+ # Hatchling (Build & Versioning)
60
+ # ----------------------------------------------------------------------------
61
+
62
+ [tool.hatch.version]
63
+ source = "vcs"
64
+
65
+ [tool.hatch.version.raw-options]
66
+ local_scheme = "no-local-version"
67
+ version_scheme = "python-simplified-semver"
68
+
69
+ [tool.hatch.build.hooks.vcs]
70
+ version-file = "src/hdx/location/_version.py"
71
+
72
+ [tool.hatch.build.targets.wheel]
73
+ packages = ["src/hdx"]
74
+
75
+ [tool.hatch.metadata]
76
+ allow-direct-references = true
77
+
78
+ # ----------------------------------------------------------------------------
79
+ # Ruff (Linting & Formatting)
80
+ # ----------------------------------------------------------------------------
81
+
82
+ [tool.ruff]
83
+ target-version = "py310"
84
+ src = ["src"]
85
+ exclude = ["_version.py"]
86
+
87
+ [tool.ruff.lint]
88
+ # Defaults are E (pycodestyle) and F (pyflakes). We extend them:
89
+ extend-select = [
90
+ "I", # isort
91
+ "UP", # pyupgrade
92
+ ]
93
+ ignore = [
94
+ "E501", # Line too long
95
+ ]
96
+
97
+ [tool.ruff.lint.isort]
98
+ known-local-folder = ["hdx.location"]
99
+ known-third-party = [
100
+ "hdx.utilities",
101
+ ]
102
+
103
+ # ----------------------------------------------------------------------------
104
+ # Pytest (Testing)
105
+ # ----------------------------------------------------------------------------
106
+
107
+ [tool.pytest.ini_options]
108
+ pythonpath = "src"
109
+ log_cli = true
110
+ addopts = """
111
+ --color=yes
112
+ --rootdir=.
113
+ --junitxml=test-results.xml
114
+ --cov
115
+ --no-cov-on-fail
116
+ --cov-report=lcov
117
+ --cov-report=term-missing
118
+ """
119
+
120
+ # ----------------------------------------------------------------------------
121
+ # Coverage (Reporting)
122
+ # ----------------------------------------------------------------------------
123
+
124
+ [tool.coverage.run]
125
+ source = ["src"]
126
+ omit = ["*/_version.py"]
127
+
128
+ [tool.coverage.report]
129
+ exclude_also = [
130
+ "from ._version",
131
+ "def __repr__",
132
+ "if self.debug:",
133
+ "if settings.DEBUG",
134
+ "raise AssertionError",
135
+ "raise NotImplementedError",
136
+ "if 0:",
137
+ "if __name__ == .__main__.:",
138
+ "if TYPE_CHECKING:",
139
+ "@(abc\\.)?abstractmethod",
140
+ ]