hdx-python-api 6.4.3__tar.gz → 6.4.5__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 (143) hide show
  1. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/PKG-INFO +2 -2
  2. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/documentation/index.md +48 -0
  3. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/pyproject.toml +1 -1
  4. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/requirements.txt +26 -21
  5. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/src/hdx/api/_version.py +2 -2
  6. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/src/hdx/api/utilities/hdx_error_handler.py +11 -3
  7. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/src/hdx/facades/infer_arguments.py +11 -9
  8. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/hdx/api/utilities/test_hdx_error_handler.py +27 -1
  9. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/.coveragerc +0 -0
  10. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/.github/workflows/publish.yaml +0 -0
  11. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/.github/workflows/run-python-tests.yaml +0 -0
  12. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/.gitignore +0 -0
  13. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/.pre-commit-config.yaml +0 -0
  14. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/CONTRIBUTING.md +0 -0
  15. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/LICENSE +0 -0
  16. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/README.md +0 -0
  17. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/documentation/.readthedocs.yaml +0 -0
  18. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/documentation/mkdocs.yaml +0 -0
  19. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/hatch.toml +0 -0
  20. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/pytest.ini +0 -0
  21. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/ruff.toml +0 -0
  22. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/src/hdx/api/__init__.py +0 -0
  23. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/src/hdx/api/configuration.py +0 -0
  24. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/src/hdx/api/hdx_base_configuration.yaml +0 -0
  25. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/src/hdx/api/locations.py +0 -0
  26. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/src/hdx/api/remotehdx.py +0 -0
  27. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/src/hdx/api/utilities/__init__.py +0 -0
  28. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/src/hdx/api/utilities/dataset_title_helper.py +0 -0
  29. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/src/hdx/api/utilities/date_helper.py +0 -0
  30. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/src/hdx/api/utilities/filestore_helper.py +0 -0
  31. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/src/hdx/api/utilities/hdx_state.py +0 -0
  32. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/src/hdx/data/__init__.py +0 -0
  33. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/src/hdx/data/dataset.py +0 -0
  34. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/src/hdx/data/hdx_datasource_topline.yaml +0 -0
  35. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/src/hdx/data/hdxobject.py +0 -0
  36. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/src/hdx/data/indicator_resource_view_template.yaml +0 -0
  37. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/src/hdx/data/organization.py +0 -0
  38. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/src/hdx/data/resource.py +0 -0
  39. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/src/hdx/data/resource_matcher.py +0 -0
  40. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/src/hdx/data/resource_view.py +0 -0
  41. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/src/hdx/data/showcase.py +0 -0
  42. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/src/hdx/data/user.py +0 -0
  43. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/src/hdx/data/vocabulary.py +0 -0
  44. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/src/hdx/facades/__init__.py +0 -0
  45. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/src/hdx/facades/keyword_arguments.py +0 -0
  46. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/src/hdx/facades/simple.py +0 -0
  47. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/__init__.py +0 -0
  48. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/Accepted_Tags.csv +0 -0
  49. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/CKAN/hdx_dataset_static.yaml +0 -0
  50. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/Tag_Mapping.csv +0 -0
  51. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/Tag_Mapping_ChainRuleError.csv +0 -0
  52. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/config/empty.yaml +0 -0
  53. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/config/hdx_base_config.json +0 -0
  54. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/config/hdx_base_config.yaml +0 -0
  55. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/config/hdx_config.json +0 -0
  56. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/config/hdx_config.yaml +0 -0
  57. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/config/hdx_dataset_static.json +0 -0
  58. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/config/hdx_dataset_static.yaml +0 -0
  59. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/config/hdx_datasource_topline.json +0 -0
  60. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/config/hdx_datasource_topline.yaml +0 -0
  61. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/config/hdx_email_configuration.json +0 -0
  62. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/config/hdx_email_configuration.yaml +0 -0
  63. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/config/hdx_missing_site_config.json +0 -0
  64. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/config/hdx_organization_static.json +0 -0
  65. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/config/hdx_organization_static.yaml +0 -0
  66. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/config/hdx_resource_static.json +0 -0
  67. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/config/hdx_resource_static.yaml +0 -0
  68. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/config/hdx_resource_view_static.json +0 -0
  69. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/config/hdx_resource_view_static.yaml +0 -0
  70. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/config/hdx_showcase_static.json +0 -0
  71. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/config/hdx_showcase_static.yaml +0 -0
  72. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/config/hdx_user_static.json +0 -0
  73. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/config/hdx_user_static.yaml +0 -0
  74. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/config/hdx_vocabulary_static.json +0 -0
  75. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/config/hdx_vocabulary_static.yaml +0 -0
  76. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/config/project_configuration.json +0 -0
  77. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/config/project_configuration.yaml +0 -0
  78. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/config/user_agent_config.yaml +0 -0
  79. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/config/user_agent_config2.yaml +0 -0
  80. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/config/user_agent_config3.yaml +0 -0
  81. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/config/user_agent_config_wrong.yaml +0 -0
  82. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/dataset_search_results.yaml +0 -0
  83. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/datastore/ACLED-All-Africa-File_20170101-to-20170708.xlsx +0 -0
  84. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/empty.csv +0 -0
  85. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/gen_resource/conflict_data_alg.csv +0 -0
  86. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/gen_resource/min_qc_conflict_data_alg.csv +0 -0
  87. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/gen_resource/qc_conflict_data_alg.csv +0 -0
  88. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/gen_resource/test_data_no_data.csv +0 -0
  89. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/gen_resource/test_data_no_years.csv +0 -0
  90. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/organization_show_results.yaml +0 -0
  91. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/qc_from_rows/qc_conflict_data_alg.csv +0 -0
  92. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/qc_from_rows/qc_conflict_data_alg_one_col.csv +0 -0
  93. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/resource_formats.json +0 -0
  94. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/showcase_all_search_results.yaml +0 -0
  95. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/state/analysis_dates.txt +0 -0
  96. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/state/last_build_date.txt +0 -0
  97. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/test_data.csv +0 -0
  98. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/test_data.zip +0 -0
  99. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/update_dataset_resources/dem_data_zwe.csv +0 -0
  100. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/update_dataset_resources/dem_indicatorlist_zwe.csv +0 -0
  101. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/update_dataset_resources/expected_resources_to_update.json +0 -0
  102. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/update_dataset_resources/opri_data_zwe.csv +0 -0
  103. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/update_dataset_resources/opri_indicatorlist_zwe.csv +0 -0
  104. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/update_dataset_resources/opri_metadata_zwe.csv +0 -0
  105. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/update_dataset_resources/qc_sdg_data_zwe.csv +0 -0
  106. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/update_dataset_resources/sdg_data_zwe.csv +0 -0
  107. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/update_dataset_resources/sdg_indicatorlist_zwe.csv +0 -0
  108. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/update_dataset_resources/sdg_metadata_zwe.csv +0 -0
  109. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/update_dataset_resources/unesco_dataset.json +0 -0
  110. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/update_dataset_resources/unesco_update_dataset.json +0 -0
  111. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/update_logic/update_logic_resources.yaml +0 -0
  112. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/fixtures/update_logic/update_logic_resources_new.yaml +0 -0
  113. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/hdx/__init__.py +0 -0
  114. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/hdx/api/__init__.py +0 -0
  115. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/hdx/api/test_ckan.py +0 -0
  116. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/hdx/api/test_configuration.py +0 -0
  117. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/hdx/api/test_locations.py +0 -0
  118. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/hdx/api/utilities/__init__.py +0 -0
  119. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/hdx/api/utilities/test_dataset_title_helper.py +0 -0
  120. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/hdx/api/utilities/test_filestore_helper.py +0 -0
  121. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/hdx/api/utilities/test_hdx_state.py +0 -0
  122. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/hdx/conftest.py +0 -0
  123. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/hdx/data/__init__.py +0 -0
  124. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/hdx/data/test_dataset_add_hapi_error.py +0 -0
  125. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/hdx/data/test_dataset_core.py +0 -0
  126. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/hdx/data/test_dataset_noncore.py +0 -0
  127. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/hdx/data/test_dataset_resource_generation.py +0 -0
  128. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/hdx/data/test_organization.py +0 -0
  129. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/hdx/data/test_resource.py +0 -0
  130. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/hdx/data/test_resource_view.py +0 -0
  131. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/hdx/data/test_showcase.py +0 -0
  132. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/hdx/data/test_update_dataset_resources.py +0 -0
  133. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/hdx/data/test_update_logic.py +0 -0
  134. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/hdx/data/test_user.py +0 -0
  135. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/hdx/data/test_vocabulary.py +0 -0
  136. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/hdx/facades/__init__.py +0 -0
  137. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/hdx/facades/test_infer_arguments.py +0 -0
  138. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/hdx/facades/test_keyword_arguments.py +0 -0
  139. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/tests/hdx/facades/test_simple.py +0 -0
  140. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/workingexample/my_code.py +0 -0
  141. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/workingexample/my_resource.csv +0 -0
  142. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/workingexample/my_resource.xlsx +0 -0
  143. {hdx_python_api-6.4.3 → hdx_python_api-6.4.5}/workingexample/run.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hdx-python-api
3
- Version: 6.4.3
3
+ Version: 6.4.5
4
4
  Summary: HDX Python API for interacting with the Humanitarian Data Exchange
5
5
  Project-URL: Homepage, https://github.com/OCHA-DAP/hdx-python-api
6
6
  Author: Michael Rans
@@ -26,7 +26,7 @@ Classifier: Programming Language :: Python :: 3.12
26
26
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
27
27
  Requires-Python: >=3.8
28
28
  Requires-Dist: ckanapi>=4.8
29
- Requires-Dist: defopt>=6.4.0
29
+ Requires-Dist: defopt>=7.0.0
30
30
  Requires-Dist: email-validator
31
31
  Requires-Dist: hdx-python-country>=3.9.4
32
32
  Requires-Dist: hdx-python-utilities>=3.8.7
@@ -34,6 +34,7 @@ upload your datasets to HDX.
34
34
  - [User Management](#user-management)
35
35
  - [Organization Management](#organization-management)
36
36
  - [Vocabulary Management](#vocabulary-management)
37
+ - [Pipeline State](#pipeline-state)
37
38
  - [Working Examples](#working-examples)
38
39
  - [Project Framework](#project-framework)
39
40
  - [IDMC Example](#idmc-example)
@@ -52,6 +53,8 @@ The library has detailed API documentation which can be found in the menu at the
52
53
 
53
54
 
54
55
  ## Breaking Changes
56
+ From 6.4.5, fix for changes in dependency defopt 7.0.0
57
+
55
58
  From 6.2.8, fix mark_data_updated which was broken due to an error in
56
59
  dataset_update_filestore_resource in which timezone information was
57
60
  incorrectly added to the iso formatted string
@@ -1088,6 +1091,51 @@ If you want to add a list of tags, you do it as follows:
1088
1091
 
1089
1092
  vocabulary.add_tags(["TAG","TAG","TAG"...])
1090
1093
 
1094
+ ## Pipeline State
1095
+
1096
+ The HDXState class allows the reading and writing of state to a given dataset. Input
1097
+ and output state transformations can be supplied in read_fn and write_fn
1098
+ respectively. The input state transformation takes in a string while the output
1099
+ transformation outputs a string. It is used as follows:
1100
+
1101
+ with temp_dir(folder="test_state") as tmpdir:
1102
+ statepath = join(tmpdir, statefile)
1103
+ copyfile(join(statefolder, statefile), statepath)
1104
+ date1 = datetime(2020, 9, 23, 0, 0, tzinfo=timezone.utc)
1105
+ date2 = datetime(2022, 5, 12, 10, 15, tzinfo=timezone.utc)
1106
+ with HDXState(
1107
+ "test_dataset", tmpdir, parse_date, iso_string_from_datetime
1108
+ ) as state:
1109
+ assert state.get() == date1
1110
+ state.set(date2)
1111
+ with HDXState(
1112
+ "test_dataset", tmpdir, parse_date, iso_string_from_datetime
1113
+ ) as state:
1114
+ assert state.get() == date2.replace(hour=0, minute=0)
1115
+
1116
+ with HDXState(
1117
+ "test_dataset",
1118
+ tmpdir,
1119
+ HDXState.dates_str_to_country_date_dict,
1120
+ HDXState.country_date_dict_to_dates_str,
1121
+ ) as state:
1122
+ state_dict = state.get()
1123
+ assert state_dict == {"DEFAULT": date1}
1124
+ state_dict["AFG"] = date2
1125
+ state.set(state_dict)
1126
+ with HDXState(
1127
+ "test_dataset",
1128
+ tmpdir,
1129
+ HDXState.dates_str_to_country_date_dict,
1130
+ HDXState.country_date_dict_to_dates_str,
1131
+ ) as state:
1132
+ state_dict = state.get()
1133
+ assert state_dict == {
1134
+ "DEFAULT": date1,
1135
+ "AFG": date2.replace(hour=0, minute=0),
1136
+ }
1137
+
1138
+
1091
1139
  # Working Examples
1092
1140
 
1093
1141
  For a working example of downloading data in a dataset on HDX, see
@@ -35,7 +35,7 @@ requires-python = ">=3.8"
35
35
 
36
36
  dependencies = [
37
37
  "ckanapi>=4.8",
38
- "defopt>=6.4.0",
38
+ "defopt>=7.0.0",
39
39
  "email_validator",
40
40
  "hdx-python-country>=3.9.4",
41
41
  "hdx-python-utilities>=3.8.7",
@@ -16,7 +16,7 @@ backrefs==5.8
16
16
  # via mkdocs-material
17
17
  cachetools==5.5.2
18
18
  # via google-auth
19
- certifi==2025.4.26
19
+ certifi==2025.6.15
20
20
  # via requests
21
21
  cfgv==3.4.0
22
22
  # via pre-commit
@@ -26,15 +26,15 @@ charset-normalizer==3.4.2
26
26
  # via requests
27
27
  ckanapi==4.8
28
28
  # via hdx-python-api (pyproject.toml)
29
- click==8.1.8
29
+ click==8.2.1
30
30
  # via
31
31
  # mkdocs
32
32
  # typer
33
33
  colorama==0.4.6
34
34
  # via mkdocs-material
35
- coverage==7.8.1
35
+ coverage==7.9.1
36
36
  # via pytest-cov
37
- defopt==6.4.0
37
+ defopt==7.0.0
38
38
  # via hdx-python-api (pyproject.toml)
39
39
  distlib==0.3.9
40
40
  # via virtualenv
@@ -56,7 +56,7 @@ frictionless==5.18.1
56
56
  # via hdx-python-utilities
57
57
  ghp-import==2.1.0
58
58
  # via mkdocs
59
- google-auth==2.40.2
59
+ google-auth==2.40.3
60
60
  # via
61
61
  # google-auth-oauthlib
62
62
  # gspread
@@ -72,7 +72,7 @@ hdx-python-utilities==3.8.7
72
72
  # hdx-python-country
73
73
  humanize==4.12.3
74
74
  # via frictionless
75
- identify==2.6.10
75
+ identify==2.6.12
76
76
  # via pre-commit
77
77
  idna==3.10
78
78
  # via
@@ -96,7 +96,7 @@ jsonlines==4.0.0
96
96
  # via hdx-python-utilities
97
97
  jsonpath-ng==1.7.0
98
98
  # via libhxl
99
- jsonschema==4.23.0
99
+ jsonschema==4.24.0
100
100
  # via
101
101
  # frictionless
102
102
  # tableschema-to-template
@@ -117,7 +117,7 @@ markdown==3.8
117
117
  # pymdown-extensions
118
118
  markdown-it-py==3.0.0
119
119
  # via rich
120
- marko==2.1.3
120
+ marko==2.1.4
121
121
  # via frictionless
122
122
  markupsafe==3.0.2
123
123
  # via
@@ -129,7 +129,7 @@ mergedeep==1.3.4
129
129
  # via
130
130
  # mkdocs
131
131
  # mkdocs-get-deps
132
- mkapi==4.4.0
132
+ mkapi==4.4.1
133
133
  # via hdx-python-api (pyproject.toml)
134
134
  mkdocs==1.6.1
135
135
  # via
@@ -166,7 +166,9 @@ platformdirs==4.3.8
166
166
  # mkdocs-get-deps
167
167
  # virtualenv
168
168
  pluggy==1.6.0
169
- # via pytest
169
+ # via
170
+ # pytest
171
+ # pytest-cov
170
172
  ply==3.11
171
173
  # via
172
174
  # jsonpath-ng
@@ -181,26 +183,27 @@ pyasn1==0.6.1
181
183
  # rsa
182
184
  pyasn1-modules==0.4.2
183
185
  # via google-auth
184
- pydantic==2.11.5
186
+ pydantic==2.11.7
185
187
  # via frictionless
186
188
  pydantic-core==2.33.2
187
189
  # via pydantic
188
190
  pygments==2.19.1
189
191
  # via
190
192
  # mkdocs-material
193
+ # pytest
191
194
  # rich
192
195
  pymdown-extensions==10.15
193
196
  # via mkdocs-material
194
197
  pyphonetics==0.5.3
195
198
  # via hdx-python-utilities
196
- pytest==8.3.5
199
+ pytest==8.4.0
197
200
  # via
198
201
  # hdx-python-api (pyproject.toml)
199
202
  # pytest-check
200
203
  # pytest-cov
201
204
  pytest-check==2.5.3
202
205
  # via hdx-python-api (pyproject.toml)
203
- pytest-cov==6.1.1
206
+ pytest-cov==6.2.1
204
207
  # via hdx-python-api (pyproject.toml)
205
208
  python-dateutil==2.9.0.post0
206
209
  # via
@@ -233,7 +236,7 @@ referencing==0.36.2
233
236
  # via
234
237
  # jsonschema
235
238
  # jsonschema-specifications
236
- requests==2.32.3
239
+ requests==2.32.4
237
240
  # via
238
241
  # hdx-python-api (pyproject.toml)
239
242
  # ckanapi
@@ -256,9 +259,11 @@ rpds-py==0.25.1
256
259
  # referencing
257
260
  rsa==4.9.1
258
261
  # via google-auth
259
- ruamel-yaml==0.18.10
262
+ ruamel-yaml==0.18.14
260
263
  # via hdx-python-utilities
261
- setuptools==80.8.0
264
+ ruamel-yaml-clib==0.2.12
265
+ # via ruamel-yaml
266
+ setuptools==80.9.0
262
267
  # via ckanapi
263
268
  shellingham==1.5.4
264
269
  # via typer
@@ -274,7 +279,7 @@ six==1.17.0
274
279
  # sphinxcontrib-napoleon
275
280
  sphinxcontrib-napoleon==0.7
276
281
  # via defopt
277
- structlog==25.3.0
282
+ structlog==25.4.0
278
283
  # via libhxl
279
284
  tableschema-to-template==0.0.13
280
285
  # via hdx-python-utilities
@@ -284,11 +289,11 @@ tenacity==9.1.2
284
289
  # via hdx-python-country
285
290
  text-unidecode==1.3
286
291
  # via python-slugify
287
- typeguard==4.4.2
292
+ typeguard==4.4.3
288
293
  # via inflect
289
- typer==0.15.4
294
+ typer==0.16.0
290
295
  # via frictionless
291
- typing-extensions==4.13.2
296
+ typing-extensions==4.14.0
292
297
  # via
293
298
  # frictionless
294
299
  # pydantic
@@ -314,7 +319,7 @@ watchdog==6.0.0
314
319
  # via mkdocs
315
320
  wheel==0.45.1
316
321
  # via libhxl
317
- xlrd==2.0.1
322
+ xlrd==2.0.2
318
323
  # via hdx-python-utilities
319
324
  xlrd3==1.1.0
320
325
  # via libhxl
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '6.4.3'
21
- __version_tuple__ = version_tuple = (6, 4, 3)
20
+ __version__ = version = '6.4.5'
21
+ __version_tuple__ = version_tuple = (6, 4, 5)
@@ -1,4 +1,5 @@
1
1
  import logging
2
+ from os import getenv
2
3
  from typing import Any, Tuple
3
4
 
4
5
  from hdx.data.dataset import Dataset
@@ -19,17 +20,24 @@ class HDXErrorHandler(ErrorHandler):
19
20
 
20
21
  Args:
21
22
  should_exit_on_error (bool): Whether to exit with a 1 code if there are errors. Default is False.
22
- write_to_hdx (bool): Whether to write errors to HDX resources. Default is False.
23
+ write_to_hdx (Any): Whether to write errors to HDX resources. Default is None (write errors).
23
24
 
24
25
  """
25
26
 
26
27
  def __init__(
27
28
  self,
28
29
  should_exit_on_error: bool = False,
29
- write_to_hdx: bool = False,
30
+ write_to_hdx: Any = None,
30
31
  ):
31
32
  super().__init__(should_exit_on_error)
32
- self._write_to_hdx = write_to_hdx
33
+ if write_to_hdx is None:
34
+ write_to_hdx = getenv("ERR_TO_HDX", True)
35
+ if write_to_hdx in (False, 0, "false", "False", "FALSE", "N", "n", ""):
36
+ self._write_to_hdx = False
37
+ logger.info("Errors won't be written to HDX")
38
+ else:
39
+ self._write_to_hdx = True
40
+ logger.info("Errors will be written to HDX")
33
41
  self.shared_errors["hdx_error"] = {}
34
42
 
35
43
  @staticmethod
@@ -37,10 +37,12 @@ def facade(projectmainfn: Callable[[Any], None], **kwargs: Any):
37
37
  #
38
38
 
39
39
  parsed_main_doc = defopt._parse_docstring(getdoc(projectmainfn))
40
- main_doc = [f"{parsed_main_doc.first_line}\n\nArgs:"]
41
- no_main_params = len(parsed_main_doc.params)
42
- for param_name, param_info in parsed_main_doc.params.items():
43
- main_doc.append(f"\n {param_name} ({param_info.type}): {param_info.text}")
40
+ main_doc = [f"{parsed_main_doc.doc}\n\nArgs:"]
41
+ no_main_parameters = len(parsed_main_doc.parameters)
42
+ for param_name, param_info in parsed_main_doc.parameters.items():
43
+ main_doc.append(
44
+ f"\n {param_name} ({param_info.annotation}): {param_info.doc}"
45
+ )
44
46
  create_config_doc = getdoc(Configuration.create)
45
47
  kwargs_index = create_config_doc.index("**kwargs")
46
48
  kwargs_index = create_config_doc.index("\n", kwargs_index)
@@ -54,13 +56,13 @@ def facade(projectmainfn: Callable[[Any], None], **kwargs: Any):
54
56
  param_names.append(str(param))
55
57
 
56
58
  parsed_main_doc = defopt._parse_docstring(main_doc)
57
- main_doc = [f"{parsed_main_doc.first_line}\n\nArgs:"]
59
+ main_doc = [f"{parsed_main_doc.doc}Args:"]
58
60
  count = 0
59
- for param_name, param_info in parsed_main_doc.params.items():
60
- param_type = param_info.type
61
+ for param_name, param_info in parsed_main_doc.parameters.items():
62
+ param_type = param_info.annotation
61
63
  if param_type == "dict":
62
64
  continue
63
- if count < no_main_params:
65
+ if count < no_main_parameters:
64
66
  count += 1
65
67
  else:
66
68
  if param_type == "str":
@@ -73,7 +75,7 @@ def facade(projectmainfn: Callable[[Any], None], **kwargs: Any):
73
75
  "Configuration.create has new parameter with unknown type!"
74
76
  )
75
77
  param_names.append(f"{param_name}: {param_type} = {default}")
76
- main_doc.append(f"\n {param_name} ({param_type}): {param_info.text}")
78
+ main_doc.append(f"\n {param_name} ({param_type}): {param_info.doc}")
77
79
  main_doc = "".join(main_doc)
78
80
 
79
81
  projectmainname = projectmainfn.__name__
@@ -12,9 +12,35 @@ setup_logging()
12
12
 
13
13
  class TestHDXErrorHandler:
14
14
  def test_hdx_error_handler(self, caplog):
15
+ error_handler = HDXErrorHandler()
16
+ assert error_handler._write_to_hdx is True
17
+ error_handler = HDXErrorHandler(write_to_hdx=None)
18
+ assert error_handler._write_to_hdx is True
19
+ error_handler = HDXErrorHandler(write_to_hdx="true")
20
+ assert error_handler._write_to_hdx is True
21
+ error_handler = HDXErrorHandler(write_to_hdx="Y")
22
+ assert error_handler._write_to_hdx is True
23
+ error_handler = HDXErrorHandler(write_to_hdx=True)
24
+ assert error_handler._write_to_hdx is True
25
+ error_handler = HDXErrorHandler(write_to_hdx=1)
26
+ assert error_handler._write_to_hdx is True
27
+ error_handler = HDXErrorHandler(write_to_hdx="")
28
+ assert error_handler._write_to_hdx is False
29
+ error_handler = HDXErrorHandler(write_to_hdx="false")
30
+ assert error_handler._write_to_hdx is False
31
+ error_handler = HDXErrorHandler(write_to_hdx="FALSE")
32
+ assert error_handler._write_to_hdx is False
33
+ error_handler = HDXErrorHandler(write_to_hdx="n")
34
+ assert error_handler._write_to_hdx is False
35
+ error_handler = HDXErrorHandler(write_to_hdx=False)
36
+ assert error_handler._write_to_hdx is False
37
+ error_handler = HDXErrorHandler(write_to_hdx=0)
38
+ assert error_handler._write_to_hdx is False
15
39
  with pytest.raises(SystemExit):
16
40
  with caplog.at_level(logging.ERROR):
17
- with HDXErrorHandler(should_exit_on_error=True) as errors:
41
+ with HDXErrorHandler(
42
+ should_exit_on_error=True, write_to_hdx=False
43
+ ) as errors:
18
44
  errors.add_message(
19
45
  "pipeline1",
20
46
  "dataset1",
File without changes
File without changes
File without changes