HDX CLI tool kit for commandline interaction with HDX
Project description
HDX CLI Toolkit
Overview
This toolkit provides a commandline interface to the Humanitarian Data Exchange (HDX) to allow for bulk modification operations and other administrative activities such as getting id values for users and organization. It is useful for those managing HDX and developers building data pipelines for HDX. The currently supported commands are as follows:
configuration Print configuration information to terminal
data_quality_report Compile a data quality report
download Download dataset resources from HDX
get_organization_metadata Get an organization id and other metadata
get_user_metadata Get user id and other metadata
list List datasets in HDX
print Print datasets in HDX to the terminal
remove_extras_key Remove extras key from a dataset
scan Scan all of HDX and perform an action
showcase Upload showcase to HDX
update Update datasets in HDX
update_resource Update a resource in HDX
In the most part it is a thin wrapper to the hdx-python-api library written by Mike Rans.
The library requires some configuration, described below, to authenticate to the HDX instance.
Installation
hdx-cli-toolkit is a Python application published to the PyPI package repository, therefore it can be installed easily with:
pip install hdx_cli_toolkit
Users may prefer to make a global, isolated installation using pipx which will make the hdx-toolkit commands available across their projects:
pipx install hdx_cli_toolkit
hdx-toolkit can then be updated with:
pipx install --force hdx_cli_toolkit
hdx-cli-toolkit uses the hdx-python-api library, this requires the following to be added to a file called .hdx_configuration.yaml in the user's home directory.
hdx_key_stage: "[an HDX API token from the staging HDX site]"
hdx_key: "[an HDX API token from the prod HDX site]"
default_organization: "[your organization]"
The default_organization is required for the configuration command and can be supplied using the --organization= commandline parament. If not defined it will default to hdx.
A user agent (hdx_cli_toolkit_*) is specified in the ~/.useragents.yaml file with the * replaced with the users initials.
hdx-cli-toolkit:
preprefix: [YOUR_ORGANIZATION]
user_agent: hdx_cli_toolkit_ih
Usage
The hdx-toolkit is built using the Python click library. Details of the currently implemented commands can be revealed by running hdx-toolkit --help, and details of the arguments for a command can be found using hdx-toolkit [COMMAND] --help
A detailed guide can be found in the USERGUIDE.md file
Changelog
Entries commence with 2026.2.1
2026.2.1 - this release removes the quickcharts command since HXL is to be removed from HDX and quickcharts depends on this. There are also a couple of removals of hxl_update=False from calls which should make no difference to the end user.
Maintenance
For the data_quality_report data on membership of Data Grid and HDX Signals is hard-coded. To update the coding for datasets in Data Grids:
- clone this repo: https://github.com/OCHA-DAP/data-grid-recipes
- Run the script
scripts/data_grid_recipes_compiler.pyscript in the root of the data-grid-recipes repo - copy the output datagrid-datasets.csv to
src/hdx_cli_toolkit/data
To update the coding for datasets in HDX Signals, check the code at this path in the hdx-ckan repo:
hdx-ckan/ckanext-hdx_theme/ckanext/hdx_theme/helpers/ui_constants/landing_pages/signals.py
for the DATA_COVERAGE_CONSTANTS note that the links in this constant are sometimes to datasets and sometimes to organizations. Copy the dataset and organization names to the SIGNALS_DATASETS and SIGNALS_ORGANIZATIONS constants in src\hdx_cli_toolkit\data_quality_utilities.py in this repo.
These are ugly methods for identifying Data Grid and HDX Signals datasets but with the current HDX implementation they are the most straightforward.
Contributions
For developers the code should be cloned installed from the GitHub repo, and a virtual enviroment created:
python -m venv venv
source venv/Scripts/activate
And then an editable installation created:
pip install -e .
The library is then configured, as described above.
This project uses a GitHub Action to run tests and linting. It requires the following environment variables/secrets to be set in the test environment:
HDX_KEY - secret. Value: fake secret
HDX_KEY_STAGE - secret. Value: a live API token for the stage server
HDX_SITE - environment variable. Value: stage
USER_AGENT - environment variable. Value: hdx_cli_toolkit_gha
PREPREFIX - - environment variable. Value: [YOUR_organization]
Most tests use mocking in place of HDX, although the test_integration.py suite runs against the stage server.
New features should be developed against a GitHub issue on a separate branch with a name starting GH[issue number]_. PULL_REQUEST_TEMPLATE.md should be used in preparing pull requests. Versioning is updated manually in pyproject.toml and is described in the template, in brief it is CalVer YYYY.MM.Micro.
Publication
Publication to PyPI is done automatically when a release is created.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hdx_cli_toolkit-2026.2.1.tar.gz.
File metadata
- Download URL: hdx_cli_toolkit-2026.2.1.tar.gz
- Upload date:
- Size: 50.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e80ab46fd9ec955f0947a2429f31d7f52ade004750f6a51564b60e40daf04c07
|
|
| MD5 |
9d18804d9e883c59c2dfe52e11c06aad
|
|
| BLAKE2b-256 |
97adb67e773f5f233c48b03673377bc197e7697ca9fca4bfcb9d6b42c9f03ba6
|
Provenance
The following attestation bundles were made for hdx_cli_toolkit-2026.2.1.tar.gz:
Publisher:
publish.yaml on OCHA-DAP/hdx-cli-toolkit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hdx_cli_toolkit-2026.2.1.tar.gz -
Subject digest:
e80ab46fd9ec955f0947a2429f31d7f52ade004750f6a51564b60e40daf04c07 - Sigstore transparency entry: 973160579
- Sigstore integration time:
-
Permalink:
OCHA-DAP/hdx-cli-toolkit@d12d19a9c33310e5b8a658f7e7d2454825453829 -
Branch / Tag:
refs/tags/v2026.2.1 - Owner: https://github.com/OCHA-DAP
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@d12d19a9c33310e5b8a658f7e7d2454825453829 -
Trigger Event:
release
-
Statement type:
File details
Details for the file hdx_cli_toolkit-2026.2.1-py3-none-any.whl.
File metadata
- Download URL: hdx_cli_toolkit-2026.2.1-py3-none-any.whl
- Upload date:
- Size: 43.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8007f18a538344944d94d766746701c9168a40c35ffef79c248e8304f9fc0174
|
|
| MD5 |
501ea84deaea94f5483a61012e41e99d
|
|
| BLAKE2b-256 |
e5c1448fc68956652f2c51fae3ffe28f933e796a52c3c20bdc26b51136335c64
|
Provenance
The following attestation bundles were made for hdx_cli_toolkit-2026.2.1-py3-none-any.whl:
Publisher:
publish.yaml on OCHA-DAP/hdx-cli-toolkit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hdx_cli_toolkit-2026.2.1-py3-none-any.whl -
Subject digest:
8007f18a538344944d94d766746701c9168a40c35ffef79c248e8304f9fc0174 - Sigstore transparency entry: 973160583
- Sigstore integration time:
-
Permalink:
OCHA-DAP/hdx-cli-toolkit@d12d19a9c33310e5b8a658f7e7d2454825453829 -
Branch / Tag:
refs/tags/v2026.2.1 - Owner: https://github.com/OCHA-DAP
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@d12d19a9c33310e5b8a658f7e7d2454825453829 -
Trigger Event:
release
-
Statement type: