oda-data 2.8.2__tar.gz → 3.0.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.
- oda_data-3.0.0/LICENSE +21 -0
- oda_data-3.0.0/PKG-INFO +105 -0
- oda_data-3.0.0/README.md +72 -0
- {oda_data-2.8.2 → oda_data-3.0.0}/pyproject.toml +32 -67
- oda_data-3.0.0/pyproject.toml.orig +179 -0
- oda_data-3.0.0/src/oda_data/__init__.py +168 -0
- oda_data-3.0.0/src/oda_data/_combine.py +1431 -0
- oda_data-3.0.0/src/oda_data/_compat.py +184 -0
- oda_data-3.0.0/src/oda_data/_compile.py +754 -0
- oda_data-3.0.0/src/oda_data/_completeness.py +730 -0
- oda_data-3.0.0/src/oda_data/_context.py +1733 -0
- {oda_data-2.8.2/src/oda_data/clean_data → oda_data-3.0.0/src/oda_data/_data}/crs_channel_mapping.csv +13 -3
- oda_data-3.0.0/src/oda_data/_data/crs_channel_mapping_vintage.json +9 -0
- oda_data-3.0.0/src/oda_data/_data/group_membership.json +578 -0
- oda_data-3.0.0/src/oda_data/_data/names.json +1302 -0
- {oda_data-2.8.2/src/oda_data/settings → oda_data-3.0.0/src/oda_data/_data}/recipient_groupings.json +0 -29
- oda_data-3.0.0/src/oda_data/_data/sector_groups.json +820 -0
- oda_data-3.0.0/src/oda_data/_data/v2_map.json +48866 -0
- oda_data-3.0.0/src/oda_data/_discover.py +682 -0
- oda_data-3.0.0/src/oda_data/_errors.py +159 -0
- oda_data-3.0.0/src/oda_data/_factors.py +299 -0
- oda_data-3.0.0/src/oda_data/_groups.py +446 -0
- oda_data-3.0.0/src/oda_data/_ids.py +56 -0
- oda_data-3.0.0/src/oda_data/_methods/__init__.py +8 -0
- oda_data-3.0.0/src/oda_data/_methods/channels.py +147 -0
- oda_data-3.0.0/src/oda_data/_methods/eu.py +296 -0
- oda_data-3.0.0/src/oda_data/_methods/imputation.py +515 -0
- oda_data-3.0.0/src/oda_data/_methods/imputation_quality.py +111 -0
- oda_data-3.0.0/src/oda_data/_model.py +1087 -0
- oda_data-3.0.0/src/oda_data/_names.py +222 -0
- oda_data-3.0.0/src/oda_data/_provenance.py +429 -0
- oda_data-3.0.0/src/oda_data/_registry/__init__.py +35 -0
- oda_data-3.0.0/src/oda_data/_registry/_validate.py +101 -0
- oda_data-3.0.0/src/oda_data/_registry/crs.py +287 -0
- oda_data-3.0.0/src/oda_data/_registry/dac1.py +350 -0
- oda_data-3.0.0/src/oda_data/_registry/dac2a.py +286 -0
- oda_data-3.0.0/src/oda_data/_registry/multisystem.py +98 -0
- oda_data-3.0.0/src/oda_data/_registry/one.py +252 -0
- oda_data-3.0.0/src/oda_data/_resolve.py +557 -0
- oda_data-3.0.0/src/oda_data/_rows.py +306 -0
- oda_data-3.0.0/src/oda_data/_store.py +117 -0
- oda_data-3.0.0/src/oda_data/_tables.py +228 -0
- oda_data-3.0.0/src/oda_data/_types.py +51 -0
- oda_data-3.0.0/src/oda_data/_units.py +77 -0
- oda_data-2.8.2/PKG-INFO +0 -570
- oda_data-2.8.2/README.md +0 -539
- oda_data-2.8.2/pyproject.toml.orig +0 -251
- oda_data-2.8.2/src/oda_data/__init__.py +0 -114
- oda_data-2.8.2/src/oda_data/api/constants.py +0 -174
- oda_data-2.8.2/src/oda_data/api/oecd.py +0 -316
- oda_data-2.8.2/src/oda_data/api/representations.py +0 -10
- oda_data-2.8.2/src/oda_data/api/sources.py +0 -1019
- oda_data-2.8.2/src/oda_data/cache/__init__.py +0 -42
- oda_data-2.8.2/src/oda_data/cache/_migrate.py +0 -388
- oda_data-2.8.2/src/oda_data/cache/api.py +0 -625
- oda_data-2.8.2/src/oda_data/cache/config.py +0 -122
- oda_data-2.8.2/src/oda_data/cache/types.py +0 -99
- oda_data-2.8.2/src/oda_data/clean_data/__init__.py +0 -0
- oda_data-2.8.2/src/oda_data/clean_data/channels.py +0 -346
- oda_data-2.8.2/src/oda_data/clean_data/common.py +0 -268
- oda_data-2.8.2/src/oda_data/clean_data/crs_channel_mapping_vintage.json +0 -8
- oda_data-2.8.2/src/oda_data/clean_data/dtypes.py +0 -242
- oda_data-2.8.2/src/oda_data/clean_data/schema.py +0 -580
- oda_data-2.8.2/src/oda_data/clean_data/validation.py +0 -104
- oda_data-2.8.2/src/oda_data/config.py +0 -54
- oda_data-2.8.2/src/oda_data/indicators/__init__.py +0 -0
- oda_data-2.8.2/src/oda_data/indicators/common.py +0 -33
- oda_data-2.8.2/src/oda_data/indicators/crs/__init__.py +0 -0
- oda_data-2.8.2/src/oda_data/indicators/crs/common.py +0 -294
- oda_data-2.8.2/src/oda_data/indicators/crs/crs_functions.py +0 -112
- oda_data-2.8.2/src/oda_data/indicators/crs/crs_indicators.json +0 -98891
- oda_data-2.8.2/src/oda_data/indicators/crs/oecd.py +0 -413
- oda_data-2.8.2/src/oda_data/indicators/crs/one.py +0 -136
- oda_data-2.8.2/src/oda_data/indicators/dac1/__init__.py +0 -0
- oda_data-2.8.2/src/oda_data/indicators/dac1/common.py +0 -38
- oda_data-2.8.2/src/oda_data/indicators/dac1/dac1_functions.py +0 -95
- oda_data-2.8.2/src/oda_data/indicators/dac1/dac1_indicators.json +0 -2596
- oda_data-2.8.2/src/oda_data/indicators/dac1/oecd.py +0 -50
- oda_data-2.8.2/src/oda_data/indicators/dac1/one.py +0 -120
- oda_data-2.8.2/src/oda_data/indicators/dac2a/__init__.py +0 -0
- oda_data-2.8.2/src/oda_data/indicators/dac2a/common.py +0 -10
- oda_data-2.8.2/src/oda_data/indicators/dac2a/dac2a_functions.py +0 -17
- oda_data-2.8.2/src/oda_data/indicators/dac2a/dac2a_indicators.json +0 -423
- oda_data-2.8.2/src/oda_data/indicators/dac2a/oecd.py +0 -40
- oda_data-2.8.2/src/oda_data/indicators/dac2a/one.py +0 -39
- oda_data-2.8.2/src/oda_data/indicators/indicator.py +0 -21
- oda_data-2.8.2/src/oda_data/indicators/research/__init__.py +0 -0
- oda_data-2.8.2/src/oda_data/indicators/research/eu.py +0 -153
- oda_data-2.8.2/src/oda_data/indicators/research/imputation_quality.py +0 -202
- oda_data-2.8.2/src/oda_data/indicators/research/imputation_shares.py +0 -707
- oda_data-2.8.2/src/oda_data/indicators/research/policy_markers.py +0 -161
- oda_data-2.8.2/src/oda_data/indicators/research/sector_imputations.py +0 -757
- oda_data-2.8.2/src/oda_data/logger.py +0 -34
- oda_data-2.8.2/src/oda_data/oda_data_indicators.csv +0 -3050
- oda_data-2.8.2/src/oda_data/settings/crs_flow_types.json +0 -14
- oda_data-2.8.2/src/oda_data/settings/crs_modalities.json +0 -90
- oda_data-2.8.2/src/oda_data/settings/crs_purpose.json +0 -182
- oda_data-2.8.2/src/oda_data/settings/crs_type_of_finance.json +0 -94
- oda_data-2.8.2/src/oda_data/settings/dac1_aid_flow_types.json +0 -558
- oda_data-2.8.2/src/oda_data/settings/dac2a_aid_type.json +0 -24
- oda_data-2.8.2/src/oda_data/settings/flow_types.json +0 -13
- oda_data-2.8.2/src/oda_data/settings/indicators.json +0 -1143
- oda_data-2.8.2/src/oda_data/settings/key_columns.json +0 -94
- oda_data-2.8.2/src/oda_data/settings/v1_indicators_mapping.json +0 -285
- oda_data-2.8.2/src/oda_data/tools/__init__.py +0 -0
- oda_data-2.8.2/src/oda_data/tools/cache.py +0 -973
- oda_data-2.8.2/src/oda_data/tools/compatibility.py +0 -77
- oda_data-2.8.2/src/oda_data/tools/gni.py +0 -98
- oda_data-2.8.2/src/oda_data/tools/groupings.py +0 -30
- oda_data-2.8.2/src/oda_data/tools/names/__init__.py +0 -0
- oda_data-2.8.2/src/oda_data/tools/names/add.py +0 -59
- oda_data-2.8.2/src/oda_data/tools/names/create_mapping.py +0 -207
- oda_data-2.8.2/src/oda_data/tools/names/crs_names.json +0 -1199
- oda_data-2.8.2/src/oda_data/tools/names/dac1_names.json +0 -217
- oda_data-2.8.2/src/oda_data/tools/names/dac2a_names.json +0 -482
- oda_data-2.8.2/src/oda_data/tools/sector_lists.py +0 -307
- {oda_data-2.8.2/src/oda_data/clean_data → oda_data-3.0.0/src/oda_data/_data}/channel_share_proxies.csv +0 -0
- {oda_data-2.8.2/src/oda_data/settings → oda_data-3.0.0/src/oda_data/_data}/crs_policy_markers.json +0 -0
- {oda_data-2.8.2/src/oda_data/clean_data → oda_data-3.0.0/src/oda_data/_data}/multilateral_channel_crosswalk.csv +0 -0
- {oda_data-2.8.2/src/oda_data/settings → oda_data-3.0.0/src/oda_data/_data}/provider_groupings.json +0 -0
- /oda_data-2.8.2/src/oda_data/api/__init__.py → /oda_data-3.0.0/src/oda_data/py.typed +0 -0
oda_data-3.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 ONE Campaign
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
oda_data-3.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: oda_data
|
|
3
|
+
Version: 3.0.0
|
|
4
|
+
Summary: A python package to work with Official Development Assistance data from the OECD DAC.
|
|
5
|
+
Author: Jorge Rivera, Miguel Haro Ruiz
|
|
6
|
+
Author-email: Jorge Rivera <jorge.rivera@one.org>, Miguel Haro Ruiz <miguel.haroruiz@one.org>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
16
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering
|
|
18
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
19
|
+
Requires-Dist: duckdb>=1.1.0
|
|
20
|
+
Requires-Dist: oda-reader>=1.15.0
|
|
21
|
+
Requires-Dist: pandas>=2.2.0
|
|
22
|
+
Requires-Dist: pyarrow>=17.0.0
|
|
23
|
+
Requires-Dist: pydeflate>=2.7.0
|
|
24
|
+
Requires-Dist: readerkit>=0.1.0
|
|
25
|
+
Requires-Dist: resolvekit>=0.1.13
|
|
26
|
+
Requires-Dist: polars>=1.0.0 ; extra == 'polars'
|
|
27
|
+
Requires-Python: >=3.12
|
|
28
|
+
Project-URL: Homepage, https://github.com/ONEcampaign/oda_data_package
|
|
29
|
+
Project-URL: Repository, https://github.com/ONEcampaign/oda_data_package
|
|
30
|
+
Project-URL: Documentation, https://github.com/ONEcampaign/oda_data_package/blob/main/docs/docs/index.md
|
|
31
|
+
Provides-Extra: polars
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
[](https://pypi.org/project/oda_data/)
|
|
35
|
+
[](https://pypi.org/project/oda_data/)
|
|
36
|
+
[](https://codecov.io/gh/ONEcampaign/oda_data_package)
|
|
37
|
+
[](https://opensource.org/licenses/MIT)
|
|
38
|
+
|
|
39
|
+
# oda-data
|
|
40
|
+
|
|
41
|
+
oda-data gives you official development assistance (ODA) figures from the OECD's DAC tables by name, for any years and providers, in any currency, with a record of where each number came from.
|
|
42
|
+
|
|
43
|
+
```text
|
|
44
|
+
provider_name year basis value
|
|
45
|
+
0 France 2024 grant_equivalent 15448.26
|
|
46
|
+
1 Germany 2024 grant_equivalent 32836.11
|
|
47
|
+
2 United Kingdom 2024 grant_equivalent 17991.79
|
|
48
|
+
3 United States 2024 grant_equivalent 65475.37
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
import oda_data as oda
|
|
53
|
+
|
|
54
|
+
df = oda.get("oecd.dac1.total_oda", years=2024, providers=["USA", "DEU", "GBR", "FRA"])
|
|
55
|
+
print(df[["provider_name", "year", "basis", "value"]])
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Values are USD millions. The first call downloads the OECD's DAC1 table (about 10 MB) and keeps it on disk.
|
|
59
|
+
|
|
60
|
+
## Install
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pip install oda-data
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
oda-data needs Python 3.12 or later. `pip install "oda-data[polars]"` adds `Query.to_polars()`.
|
|
67
|
+
|
|
68
|
+
## What it does
|
|
69
|
+
|
|
70
|
+
Most ODA figures depend on reading a DAC table correctly: DAC1 for official totals, DAC2A for what recipients receive, the CRS for sectors and channels. Each table has its own codes, bases, aggregate rows, and lines that nest inside each other. oda-data holds those rules in more than 40 named indicators, such as `oecd.dac1.total_oda`, `oecd.crs.bilateral_oda`, and `one.crs.imputed_multilateral_oda`, so one call returns one tidy table.
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
import oda_data as oda
|
|
74
|
+
|
|
75
|
+
dac = oda.groups.dac_countries
|
|
76
|
+
|
|
77
|
+
# Each DAC country and the DAC total, in constant 2024 euros
|
|
78
|
+
oda.get(
|
|
79
|
+
"oecd.dac1.total_oda",
|
|
80
|
+
years=range(2015, 2025),
|
|
81
|
+
providers=[dac, oda.total(dac)],
|
|
82
|
+
unit=oda.constant("EUR", 2024),
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
# Bilateral ODA to Kenya by broad sector
|
|
86
|
+
oda.get("oecd.crs.bilateral_oda", years=2023, recipients="KEN", by=["broad_sector"])
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Every result has the same columns, converts money provider by provider before any sum, and refuses a question its table cannot answer with an error that names the indicator that can. [oda-reader](https://github.com/ONEcampaign/oda_reader) downloads and caches the OECD tables, and [pydeflate](https://github.com/jm-rivera/pydeflate) supplies deflators and exchange rates from the same DAC1 release.
|
|
90
|
+
|
|
91
|
+
oda-data is the wrong tool for a pipeline that needs the raw OECD tables. Read those with oda-reader.
|
|
92
|
+
|
|
93
|
+
## Documentation
|
|
94
|
+
|
|
95
|
+
- [Tutorial](https://github.com/ONEcampaign/oda_data_package/blob/main/docs/docs/tutorial.md): chart ten years of G7 aid
|
|
96
|
+
- [How-to guides](https://github.com/ONEcampaign/oda_data_package/blob/main/docs/docs/how-to/find-an-indicator.md): finding the indicator for a question, units, groups, sectors, imputed multilateral sectors, records, provenance, offline use
|
|
97
|
+
- [Indicators](https://github.com/ONEcampaign/oda_data_package/blob/main/docs/docs/reference/indicators.md) and the [public API](https://github.com/ONEcampaign/oda_data_package/blob/main/docs/docs/reference/api.md)
|
|
98
|
+
- [Counting rules](https://github.com/ONEcampaign/oda_data_package/blob/main/docs/docs/explanation/counting-rules.md): which rows count, and why
|
|
99
|
+
- [Migrating from 2.x](https://github.com/ONEcampaign/oda_data_package/blob/main/docs/docs/migration.md): the 3.0 call for any 2.x code, and the numbers that change
|
|
100
|
+
|
|
101
|
+
3.0 replaces the 2.x API. `oda.search("DAC1.10.1010")` returns the 3.0 call for any 2.x indicator code.
|
|
102
|
+
|
|
103
|
+
Questions and bug reports go to the [issue tracker](https://github.com/ONEcampaign/oda_data_package/issues). [CONTRIBUTING.md](https://github.com/ONEcampaign/oda_data_package/blob/main/CONTRIBUTING.md) explains how to work on the package.
|
|
104
|
+
|
|
105
|
+
MIT licence. See [LICENSE](https://github.com/ONEcampaign/oda_data_package/blob/main/LICENSE).
|
oda_data-3.0.0/README.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
[](https://pypi.org/project/oda_data/)
|
|
2
|
+
[](https://pypi.org/project/oda_data/)
|
|
3
|
+
[](https://codecov.io/gh/ONEcampaign/oda_data_package)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
# oda-data
|
|
7
|
+
|
|
8
|
+
oda-data gives you official development assistance (ODA) figures from the OECD's DAC tables by name, for any years and providers, in any currency, with a record of where each number came from.
|
|
9
|
+
|
|
10
|
+
```text
|
|
11
|
+
provider_name year basis value
|
|
12
|
+
0 France 2024 grant_equivalent 15448.26
|
|
13
|
+
1 Germany 2024 grant_equivalent 32836.11
|
|
14
|
+
2 United Kingdom 2024 grant_equivalent 17991.79
|
|
15
|
+
3 United States 2024 grant_equivalent 65475.37
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
```python
|
|
19
|
+
import oda_data as oda
|
|
20
|
+
|
|
21
|
+
df = oda.get("oecd.dac1.total_oda", years=2024, providers=["USA", "DEU", "GBR", "FRA"])
|
|
22
|
+
print(df[["provider_name", "year", "basis", "value"]])
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Values are USD millions. The first call downloads the OECD's DAC1 table (about 10 MB) and keeps it on disk.
|
|
26
|
+
|
|
27
|
+
## Install
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pip install oda-data
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
oda-data needs Python 3.12 or later. `pip install "oda-data[polars]"` adds `Query.to_polars()`.
|
|
34
|
+
|
|
35
|
+
## What it does
|
|
36
|
+
|
|
37
|
+
Most ODA figures depend on reading a DAC table correctly: DAC1 for official totals, DAC2A for what recipients receive, the CRS for sectors and channels. Each table has its own codes, bases, aggregate rows, and lines that nest inside each other. oda-data holds those rules in more than 40 named indicators, such as `oecd.dac1.total_oda`, `oecd.crs.bilateral_oda`, and `one.crs.imputed_multilateral_oda`, so one call returns one tidy table.
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
import oda_data as oda
|
|
41
|
+
|
|
42
|
+
dac = oda.groups.dac_countries
|
|
43
|
+
|
|
44
|
+
# Each DAC country and the DAC total, in constant 2024 euros
|
|
45
|
+
oda.get(
|
|
46
|
+
"oecd.dac1.total_oda",
|
|
47
|
+
years=range(2015, 2025),
|
|
48
|
+
providers=[dac, oda.total(dac)],
|
|
49
|
+
unit=oda.constant("EUR", 2024),
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
# Bilateral ODA to Kenya by broad sector
|
|
53
|
+
oda.get("oecd.crs.bilateral_oda", years=2023, recipients="KEN", by=["broad_sector"])
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Every result has the same columns, converts money provider by provider before any sum, and refuses a question its table cannot answer with an error that names the indicator that can. [oda-reader](https://github.com/ONEcampaign/oda_reader) downloads and caches the OECD tables, and [pydeflate](https://github.com/jm-rivera/pydeflate) supplies deflators and exchange rates from the same DAC1 release.
|
|
57
|
+
|
|
58
|
+
oda-data is the wrong tool for a pipeline that needs the raw OECD tables. Read those with oda-reader.
|
|
59
|
+
|
|
60
|
+
## Documentation
|
|
61
|
+
|
|
62
|
+
- [Tutorial](https://github.com/ONEcampaign/oda_data_package/blob/main/docs/docs/tutorial.md): chart ten years of G7 aid
|
|
63
|
+
- [How-to guides](https://github.com/ONEcampaign/oda_data_package/blob/main/docs/docs/how-to/find-an-indicator.md): finding the indicator for a question, units, groups, sectors, imputed multilateral sectors, records, provenance, offline use
|
|
64
|
+
- [Indicators](https://github.com/ONEcampaign/oda_data_package/blob/main/docs/docs/reference/indicators.md) and the [public API](https://github.com/ONEcampaign/oda_data_package/blob/main/docs/docs/reference/api.md)
|
|
65
|
+
- [Counting rules](https://github.com/ONEcampaign/oda_data_package/blob/main/docs/docs/explanation/counting-rules.md): which rows count, and why
|
|
66
|
+
- [Migrating from 2.x](https://github.com/ONEcampaign/oda_data_package/blob/main/docs/docs/migration.md): the 3.0 call for any 2.x code, and the numbers that change
|
|
67
|
+
|
|
68
|
+
3.0 replaces the 2.x API. `oda.search("DAC1.10.1010")` returns the 3.0 call for any 2.x indicator code.
|
|
69
|
+
|
|
70
|
+
Questions and bug reports go to the [issue tracker](https://github.com/ONEcampaign/oda_data_package/issues). [CONTRIBUTING.md](https://github.com/ONEcampaign/oda_data_package/blob/main/CONTRIBUTING.md) explains how to work on the package.
|
|
71
|
+
|
|
72
|
+
MIT licence. See [LICENSE](https://github.com/ONEcampaign/oda_data_package/blob/main/LICENSE).
|
|
@@ -1,35 +1,33 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "oda_data"
|
|
3
|
-
version = "
|
|
3
|
+
version = "3.0.0"
|
|
4
4
|
description = "A python package to work with Official Development Assistance data from the OECD DAC."
|
|
5
|
-
requires-python = ">=3.
|
|
5
|
+
requires-python = ">=3.12"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
license-files = ["LICENSE"]
|
|
6
8
|
readme = "README.md"
|
|
7
9
|
classifiers = [
|
|
8
10
|
"Development Status :: 5 - Production/Stable",
|
|
9
11
|
"Intended Audience :: Developers",
|
|
10
12
|
"Intended Audience :: Science/Research",
|
|
11
|
-
"License :: OSI Approved :: MIT License",
|
|
12
13
|
"Programming Language :: Python :: 3",
|
|
13
|
-
"Programming Language :: Python :: 3.11",
|
|
14
14
|
"Programming Language :: Python :: 3.12",
|
|
15
15
|
"Programming Language :: Python :: 3.13",
|
|
16
|
+
"Programming Language :: Python :: 3.14",
|
|
16
17
|
"Programming Language :: Python :: 3 :: Only",
|
|
17
18
|
"Topic :: Scientific/Engineering",
|
|
18
19
|
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
19
20
|
]
|
|
20
21
|
dependencies = [
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
22
|
+
"duckdb>=1.1.0",
|
|
23
|
+
"oda-reader>=1.15.0",
|
|
24
|
+
"pandas>=2.2.0",
|
|
25
|
+
"pyarrow>=17.0.0",
|
|
26
|
+
"pydeflate>=2.7.0",
|
|
27
|
+
"readerkit>=0.1.0",
|
|
28
|
+
"resolvekit>=0.1.13",
|
|
28
29
|
]
|
|
29
30
|
|
|
30
|
-
[project.license]
|
|
31
|
-
text = "MIT"
|
|
32
|
-
|
|
33
31
|
[[project.authors]]
|
|
34
32
|
name = "Jorge Rivera"
|
|
35
33
|
email = "jorge.rivera@one.org"
|
|
@@ -38,13 +36,16 @@ email = "jorge.rivera@one.org"
|
|
|
38
36
|
name = "Miguel Haro Ruiz"
|
|
39
37
|
email = "miguel.haroruiz@one.org"
|
|
40
38
|
|
|
39
|
+
[project.optional-dependencies]
|
|
40
|
+
polars = ["polars>=1.0.0"]
|
|
41
|
+
|
|
41
42
|
[project.urls]
|
|
42
43
|
Homepage = "https://github.com/ONEcampaign/oda_data_package"
|
|
43
44
|
Repository = "https://github.com/ONEcampaign/oda_data_package"
|
|
44
|
-
Documentation = "https://github.com/ONEcampaign/oda_data_package"
|
|
45
|
+
Documentation = "https://github.com/ONEcampaign/oda_data_package/blob/main/docs/docs/index.md"
|
|
45
46
|
|
|
46
47
|
[build-system]
|
|
47
|
-
requires = ["uv_build>=0.
|
|
48
|
+
requires = ["uv_build>=0.12.0,<0.13"]
|
|
48
49
|
build-backend = "uv_build"
|
|
49
50
|
|
|
50
51
|
[dependency-groups]
|
|
@@ -56,15 +57,11 @@ dev = [
|
|
|
56
57
|
]
|
|
57
58
|
test = [
|
|
58
59
|
"pytest>=8.0.0",
|
|
59
|
-
"pytest-mock>=3.12.0",
|
|
60
60
|
"pytest-cov>=4.1.0",
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
]
|
|
64
|
-
maintenance = [
|
|
65
|
-
"resolvekit==0.1.12 ; python_version >= '3.12'",
|
|
66
|
-
"pyyaml>=6.0 ; python_version >= '3.12'",
|
|
61
|
+
"polars>=1.0.0",
|
|
62
|
+
"matplotlib>=3.8.0",
|
|
67
63
|
]
|
|
64
|
+
maintenance = ["pyyaml>=6.0"]
|
|
68
65
|
|
|
69
66
|
[tool.uv]
|
|
70
67
|
default-groups = [
|
|
@@ -74,7 +71,7 @@ default-groups = [
|
|
|
74
71
|
|
|
75
72
|
[tool.ruff]
|
|
76
73
|
line-length = 88
|
|
77
|
-
target-version = "
|
|
74
|
+
target-version = "py312"
|
|
78
75
|
extend-include = ["*.ipynb"]
|
|
79
76
|
exclude = [
|
|
80
77
|
".git",
|
|
@@ -123,23 +120,12 @@ unfixable = []
|
|
|
123
120
|
"ANN",
|
|
124
121
|
"E501",
|
|
125
122
|
"PLR2004",
|
|
126
|
-
"RUF002",
|
|
127
|
-
"RUF003",
|
|
128
|
-
"PLW0603",
|
|
129
|
-
"ERA001",
|
|
130
123
|
]
|
|
131
124
|
"src/oda_data/__init__.py" = [
|
|
132
125
|
"PLW0603",
|
|
133
126
|
"PLW0602",
|
|
134
127
|
"F811",
|
|
135
128
|
]
|
|
136
|
-
"src/oda_data/cache/config.py" = ["PLW0603"]
|
|
137
|
-
"src/oda_data/cache/api.py" = ["PLW0603"]
|
|
138
|
-
"src/oda_data/tools/cache.py" = ["PLW2901"]
|
|
139
|
-
"src/oda_data/api/oecd.py" = ["PLR0912"]
|
|
140
|
-
"src/oda_data/indicators/crs/crs_functions.py" = ["B023"]
|
|
141
|
-
"src/oda_data/indicators/research/sector_imputations.py" = ["B023"]
|
|
142
|
-
"src/oda_data/tools/sector_lists.py" = ["N816"]
|
|
143
129
|
|
|
144
130
|
[tool.ruff.lint.pydocstyle]
|
|
145
131
|
convention = "google"
|
|
@@ -151,10 +137,13 @@ skip-magic-trailing-comma = false
|
|
|
151
137
|
line-ending = "auto"
|
|
152
138
|
|
|
153
139
|
[tool.ty.environment]
|
|
154
|
-
python-version = "3.
|
|
140
|
+
python-version = "3.12"
|
|
155
141
|
|
|
156
142
|
[tool.ty.src]
|
|
157
|
-
include = [
|
|
143
|
+
include = [
|
|
144
|
+
"src/oda_data",
|
|
145
|
+
"tests/unit/typing_checks.py",
|
|
146
|
+
]
|
|
158
147
|
|
|
159
148
|
[tool.ty.analysis]
|
|
160
149
|
replace-imports-with-any = [
|
|
@@ -170,28 +159,9 @@ possibly-unresolved-reference = "ignore"
|
|
|
170
159
|
|
|
171
160
|
[tool.pytest.ini_options]
|
|
172
161
|
testpaths = ["tests"]
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
addopts = """
|
|
177
|
-
-v
|
|
178
|
-
--strict-markers
|
|
179
|
-
--tb=short
|
|
180
|
-
--cov=src/oda_data
|
|
181
|
-
--cov-report=term-missing
|
|
182
|
-
--cov-report=html
|
|
183
|
-
--cov-branch
|
|
184
|
-
-m "not integration and not network"
|
|
185
|
-
"""
|
|
186
|
-
markers = [
|
|
187
|
-
"""slow: marks tests as slow (deselect with '-m "not slow"')""",
|
|
188
|
-
"integration: marks tests that call real OECD API (deselected by default)",
|
|
189
|
-
"network: marks tests requiring live network access (opt-in via RUN_NETWORK_TESTS=1; deselected by default)",
|
|
190
|
-
"unit: marks tests as unit tests",
|
|
191
|
-
"cache: marks tests related to caching functionality",
|
|
192
|
-
"validation: marks tests related to input validation",
|
|
193
|
-
"cleaning: marks tests related to data cleaning",
|
|
194
|
-
]
|
|
162
|
+
addopts = "-ra --strict-markers --strict-config"
|
|
163
|
+
filterwarnings = ["error"]
|
|
164
|
+
markers = ["data: reads the real OECD tables through the oda-reader cache (needs a warm cache; ODA_DATA_REQUIRE_DATA=1 turns a skip into a failure)"]
|
|
195
165
|
norecursedirs = [
|
|
196
166
|
".git",
|
|
197
167
|
".venv",
|
|
@@ -205,22 +175,17 @@ norecursedirs = [
|
|
|
205
175
|
[tool.coverage.run]
|
|
206
176
|
source = ["src/oda_data"]
|
|
207
177
|
branch = true
|
|
208
|
-
omit = [
|
|
209
|
-
"*/tests/*",
|
|
210
|
-
"*/__init__.py",
|
|
211
|
-
"*/config.py",
|
|
212
|
-
"*/logger.py",
|
|
213
|
-
]
|
|
214
178
|
|
|
215
179
|
[tool.coverage.report]
|
|
216
180
|
precision = 2
|
|
217
181
|
show_missing = true
|
|
218
182
|
exclude_lines = [
|
|
219
183
|
"pragma: no cover",
|
|
220
|
-
"def __repr__",
|
|
221
184
|
"raise AssertionError",
|
|
222
185
|
"raise NotImplementedError",
|
|
223
186
|
"if __name__ == .__main__.:",
|
|
224
187
|
"if TYPE_CHECKING:",
|
|
225
|
-
"@abstractmethod",
|
|
226
188
|
]
|
|
189
|
+
|
|
190
|
+
[tool.codespell]
|
|
191
|
+
ignore-words-list = "NotIn,Programm"
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "oda_data"
|
|
3
|
+
version = "3.0.0"
|
|
4
|
+
description = "A python package to work with Official Development Assistance data from the OECD DAC."
|
|
5
|
+
requires-python = ">=3.12"
|
|
6
|
+
|
|
7
|
+
license = "MIT"
|
|
8
|
+
license-files = ["LICENSE"]
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
authors = [
|
|
11
|
+
{name = "Jorge Rivera", email = "jorge.rivera@one.org"},
|
|
12
|
+
{name = "Miguel Haro Ruiz", email = "miguel.haroruiz@one.org"}
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 5 - Production/Stable",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Intended Audience :: Science/Research",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3.12",
|
|
21
|
+
"Programming Language :: Python :: 3.13",
|
|
22
|
+
"Programming Language :: Python :: 3.14",
|
|
23
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
24
|
+
"Topic :: Scientific/Engineering",
|
|
25
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
dependencies = [
|
|
29
|
+
"duckdb>=1.1.0",
|
|
30
|
+
"oda-reader>=1.15.0",
|
|
31
|
+
"pandas>=2.2.0",
|
|
32
|
+
"pyarrow>=17.0.0",
|
|
33
|
+
"pydeflate>=2.7.0",
|
|
34
|
+
"readerkit>=0.1.0",
|
|
35
|
+
"resolvekit>=0.1.13",
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
[project.optional-dependencies]
|
|
39
|
+
polars = ["polars>=1.0.0"]
|
|
40
|
+
|
|
41
|
+
[project.urls]
|
|
42
|
+
Homepage = "https://github.com/ONEcampaign/oda_data_package"
|
|
43
|
+
Repository = "https://github.com/ONEcampaign/oda_data_package"
|
|
44
|
+
Documentation = "https://github.com/ONEcampaign/oda_data_package/blob/main/docs/docs/index.md"
|
|
45
|
+
|
|
46
|
+
[build-system]
|
|
47
|
+
requires = ["uv_build>=0.12.0,<0.13"]
|
|
48
|
+
build-backend = "uv_build"
|
|
49
|
+
|
|
50
|
+
[dependency-groups]
|
|
51
|
+
dev = [
|
|
52
|
+
"pre-commit>=4.5.0",
|
|
53
|
+
"ruff>=0.14.9",
|
|
54
|
+
"ty>=0.0.33",
|
|
55
|
+
"mkdocs-material>=9.7.0",
|
|
56
|
+
]
|
|
57
|
+
test = [
|
|
58
|
+
"pytest>=8.0.0",
|
|
59
|
+
"pytest-cov>=4.1.0",
|
|
60
|
+
"polars>=1.0.0",
|
|
61
|
+
# The tutorial's chart example, which tests/docs runs.
|
|
62
|
+
"matplotlib>=3.8.0",
|
|
63
|
+
]
|
|
64
|
+
# Maintenance-only tooling for scripts/refresh_channel_crosswalk.py.
|
|
65
|
+
maintenance = [
|
|
66
|
+
"pyyaml>=6.0",
|
|
67
|
+
]
|
|
68
|
+
|
|
69
|
+
[tool.uv]
|
|
70
|
+
default-groups = ["dev", "test"]
|
|
71
|
+
|
|
72
|
+
[tool.ruff]
|
|
73
|
+
line-length = 88
|
|
74
|
+
target-version = "py312"
|
|
75
|
+
extend-include = ["*.ipynb"]
|
|
76
|
+
exclude = [
|
|
77
|
+
".git",
|
|
78
|
+
".venv",
|
|
79
|
+
"venv",
|
|
80
|
+
"__pycache__",
|
|
81
|
+
"build",
|
|
82
|
+
"dist",
|
|
83
|
+
"*.egg-info",
|
|
84
|
+
".pytest_cache",
|
|
85
|
+
"htmlcov",
|
|
86
|
+
]
|
|
87
|
+
|
|
88
|
+
[tool.ruff.lint]
|
|
89
|
+
select = [
|
|
90
|
+
"E", # pycodestyle errors
|
|
91
|
+
"W", # pycodestyle warnings
|
|
92
|
+
"F", # pyflakes
|
|
93
|
+
"I", # isort
|
|
94
|
+
"N", # pep8-naming
|
|
95
|
+
"UP", # pyupgrade
|
|
96
|
+
"B", # flake8-bugbear
|
|
97
|
+
"C4", # flake8-comprehensions
|
|
98
|
+
"SIM", # flake8-simplify
|
|
99
|
+
"PL", # pylint
|
|
100
|
+
"RUF", # ruff-specific rules
|
|
101
|
+
"ERA", # eradicate (commented-out code)
|
|
102
|
+
"PERF", # perflint
|
|
103
|
+
"ANN", # flake8-annotations (require type hints on public APIs)
|
|
104
|
+
]
|
|
105
|
+
ignore = [
|
|
106
|
+
"E501", # Line too long (handled by formatter)
|
|
107
|
+
"PLR0913", # Too many arguments
|
|
108
|
+
"PLR0912", # Too many branches
|
|
109
|
+
"PLR0914", # Too many locals
|
|
110
|
+
"PLR0915", # Too many statements
|
|
111
|
+
"PLR2004", # Magic value used in comparison
|
|
112
|
+
"PLC0415", # Import outside top-level (the package defers heavy imports)
|
|
113
|
+
"ANN401", # Allow `Any` in typed signatures
|
|
114
|
+
]
|
|
115
|
+
fixable = ["ALL"]
|
|
116
|
+
unfixable = []
|
|
117
|
+
|
|
118
|
+
[tool.ruff.lint.per-file-ignores]
|
|
119
|
+
"tests/**/*.py" = ["ANN", "E501", "PLR2004"]
|
|
120
|
+
# The module-level __getattr__ loads names lazily and caches them in globals().
|
|
121
|
+
"src/oda_data/__init__.py" = ["PLW0603", "PLW0602", "F811"]
|
|
122
|
+
|
|
123
|
+
[tool.ruff.lint.pydocstyle]
|
|
124
|
+
convention = "google"
|
|
125
|
+
|
|
126
|
+
[tool.ruff.format]
|
|
127
|
+
quote-style = "double"
|
|
128
|
+
indent-style = "space"
|
|
129
|
+
skip-magic-trailing-comma = false
|
|
130
|
+
line-ending = "auto"
|
|
131
|
+
|
|
132
|
+
[tool.ty.environment]
|
|
133
|
+
python-version = "3.12"
|
|
134
|
+
|
|
135
|
+
[tool.ty.src]
|
|
136
|
+
include = ["src/oda_data", "tests/unit/typing_checks.py"]
|
|
137
|
+
|
|
138
|
+
# pandas and numpy stubs are incomplete; treating them as Any avoids a cascade
|
|
139
|
+
# of false positives without disabling checks on this package's own code.
|
|
140
|
+
[tool.ty.analysis]
|
|
141
|
+
replace-imports-with-any = [
|
|
142
|
+
"pandas",
|
|
143
|
+
"pandas.**",
|
|
144
|
+
"numpy",
|
|
145
|
+
"numpy.**",
|
|
146
|
+
]
|
|
147
|
+
|
|
148
|
+
[tool.ty.rules]
|
|
149
|
+
possibly-missing-attribute = "ignore"
|
|
150
|
+
possibly-unresolved-reference = "ignore"
|
|
151
|
+
|
|
152
|
+
[tool.pytest.ini_options]
|
|
153
|
+
testpaths = ["tests"]
|
|
154
|
+
addopts = "-ra --strict-markers --strict-config"
|
|
155
|
+
filterwarnings = ["error"]
|
|
156
|
+
markers = [
|
|
157
|
+
"data: reads the real OECD tables through the oda-reader cache (needs a warm cache; ODA_DATA_REQUIRE_DATA=1 turns a skip into a failure)",
|
|
158
|
+
]
|
|
159
|
+
norecursedirs = [".git", ".venv", "venv", "__pycache__", "*.egg-info", ".pytest_cache", "htmlcov"]
|
|
160
|
+
|
|
161
|
+
[tool.coverage.run]
|
|
162
|
+
source = ["src/oda_data"]
|
|
163
|
+
branch = true
|
|
164
|
+
|
|
165
|
+
[tool.coverage.report]
|
|
166
|
+
precision = 2
|
|
167
|
+
show_missing = true
|
|
168
|
+
exclude_lines = [
|
|
169
|
+
"pragma: no cover",
|
|
170
|
+
"raise AssertionError",
|
|
171
|
+
"raise NotImplementedError",
|
|
172
|
+
"if __name__ == .__main__.:",
|
|
173
|
+
"if TYPE_CHECKING:",
|
|
174
|
+
]
|
|
175
|
+
|
|
176
|
+
[tool.codespell]
|
|
177
|
+
# NotIn is a filter class in _model.py; Programm is a deliberate typo that
|
|
178
|
+
# tests/unit/test_resolve.py feeds the resolver.
|
|
179
|
+
ignore-words-list = "NotIn,Programm"
|