Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ jobs:
contents: read

steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Get history and tags for versioning to work
run: |
git fetch --prune --unshallow
git fetch --depth=1 origin +refs/tags/*:refs/tags/*

- name: Install uv
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2

- name: Build with uv
run: uv build
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/run-python-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
pull-requests: write

steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Install uv
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
with:
enable-cache: true
python-version: "3.13"
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ repos:
- id: check-ast

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.14
rev: v0.17.3
hooks:
# Run the linter.
- id: ruff-check
Expand All @@ -21,7 +21,7 @@ repos:
- id: ruff-format

- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.9.25
rev: 0.13.6
hooks:
# Ensure the lockfile is up-to-date with pyproject.toml
- id: uv-lock
2 changes: 1 addition & 1 deletion documentation/explanation/facades.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ project configuration is used for any configuration specific to your project.

The default logging configuration reads a configuration file internal to the library
that sets up an coloured console handler outputting at INFO level and a file handler
writing to errors.log at ERROR level.
writing to errors.log at ERROR level.
2 changes: 1 addition & 1 deletion documentation/explanation/history.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ resolve issues as quickly as possible. Static metadata can be held in human read
files so if it needs to be modified, it is straightforward.

The HDX Python library has expanded over time as needs have arisen and is used for a
range of tasks involving interaction with the HDX platform.
range of tasks involving interaction with the HDX platform.
2 changes: 1 addition & 1 deletion documentation/explanation/information.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ This library is part of the [Humanitarian Data Exchange](https://data.humdata.or
HDX.

The code for the library is [here](https://github.com/OCHA-DAP/hdx-python-api).
The library has detailed API documentation which can be found in the menu at the top.
The library has detailed API documentation which can be found in the menu at the top.
2 changes: 1 addition & 1 deletion documentation/how-to/api-key.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ the drop down menu
**.hdx_configuration.yaml** in the current user's home
directory. Then put in the YAML file:

hdx_key: "HDX API KEY"
hdx_key: "HDX API KEY"
2 changes: 1 addition & 1 deletion documentation/how-to/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
The library is also available set up and ready to go in a Docker image:

docker pull public.ecr.aws/unocha/hdx-scraper-baseimage:stable
docker run -i -t public.ecr.aws/unocha/hdx-scraper-baseimage:stable python3
docker run -i -t public.ecr.aws/unocha/hdx-scraper-baseimage:stable python3
2 changes: 1 addition & 1 deletion documentation/how-to/framework.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ Create a file **my_code.py** and copy into it the code below:
"""
logger.debug("Generating dataset!")

You can then fill out the function **generate_dataset** as required.
You can then fill out the function **generate_dataset** as required.
2 changes: 1 addition & 1 deletion documentation/how-to/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ package that are missing eg. for Ubuntu: python-dev, libffi-dev and libssl-dev.
If you get import or other errors, then please either recreate your virtualenv if you
are using one or uninstall hdx-python-api, hdx-python-country and hdx-python-utilities
using **pip uninstall**, then install hdx-python-api (which will pull in the other
dependencies).
dependencies).
2 changes: 1 addition & 1 deletion documentation/how-to/logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ Then use the logger like this:
logger.info("INFORMATION message")
logger.warning("WARNING message")
logger.error("ERROR message")
logger.critical("CRITICAL error message")
logger.critical("CRITICAL error message")
2 changes: 1 addition & 1 deletion documentation/how-to/objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,4 @@ You can delete HDX objects using **delete_from_hdx** and update an object that
already exists in HDX with the method **update_in_hdx**. These take various
boolean parameters that all have defaults and are documented in the API docs.
They do not return anything and they throw exceptions for failures like the
object to update not existing.
object to update not existing.
2 changes: 1 addition & 1 deletion documentation/how-to/operate-datasets/dataset-resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,4 @@ dataset is updated from the result:

dataset.set_qa_completed(True)
dataset.qa_revise_resources("pii", "false")
dataset.reset_fs_check()
dataset.reset_fs_check()
2 changes: 1 addition & 1 deletion documentation/how-to/operate-datasets/location.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ If you want to add any other kind of location (which must be in this
[list of valid locations](https://data.humdata.org/api/action/group_list?all_fields=true)),
you do as shown below.

dataset.add_other_location("LOCATION")
dataset.add_other_location("LOCATION")
2 changes: 1 addition & 1 deletion documentation/how-to/operate-datasets/maintainer.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ If you want to set the maintainer, you do it like this:

dataset.set_maintainer(USER)

USER is either a string id, dictionary or a User object.
USER is either a string id, dictionary or a User object.
2 changes: 1 addition & 1 deletion documentation/how-to/operate-datasets/organization.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ If you want to set the organization, you do it like this:
dataset.set_organization(ORGANIZATION)

ORGANIZATION is either a string id, dictionary or an Organization
object.
object.
2 changes: 1 addition & 1 deletion documentation/how-to/operate-datasets/tags.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ If you want to add a list of tags, you do it as follows:

To obtain the predefined set of approved tags:

approved_tags = Vocabulary.approved_tags()
approved_tags = Vocabulary.approved_tags()
2 changes: 1 addition & 1 deletion documentation/how-to/operate-datasets/time-period.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ The method below allows you to set the time period using a year range. The start
end year can be supplied as integers or strings. If no end year is supplied then the
range will be from the beginning of the start year to the end of that year.

dataset.set_time_period_year_range(START YEAR, END YEAR)
dataset.set_time_period_year_range(START YEAR, END YEAR)
2 changes: 1 addition & 1 deletion documentation/how-to/operate-datasets/update-frequency.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ A list of valid update frequencies can be found using:
Transforming backwards and forwards between representations can be achieved with this
function:

update_frequency = Dataset.transform_update_frequency("UPDATE_FREQUENCY")
update_frequency = Dataset.transform_update_frequency("UPDATE_FREQUENCY")
2 changes: 1 addition & 1 deletion documentation/reference/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@ List[str]] (Tuple containing list of added tags and list of deleted tags and tag
added).

From 3.7.1, the list of tags must be from a set of approved tags (see
[Set Tags](../how-to/operate-datasets/tags.md)).
[Set Tags](../how-to/operate-datasets/tags.md)).
2 changes: 1 addition & 1 deletion documentation/tutorials/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,4 @@ virtualenv if not installed:

On other OSs:

rm -rf test
rm -rf test
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ dependencies = [
"defopt>=7.0.0",
"email_validator",
"hdx-python-country>=4.2.6",
"hdx-python-utilities>=4.2.5",
"hdx-python-utilities>=4.2.6",
"makefun",
"requests",
]
Expand All @@ -55,7 +55,7 @@ dev = [
"pytest-cov",
"pytest-mock",
"pre-commit",
"ruff==0.14.14",
"ruff==0.17.3",
]

[project.urls]
Expand Down
2 changes: 1 addition & 1 deletion src/hdx/api/configuration.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def __init__(self, **kwargs: Any) -> None:
if hdx_read_only is None:
hdx_read_only = False
self.hdx_read_only = hdx_read_only
logger.info(f"Read only access to HDX: {str(self.hdx_read_only)}")
logger.info(f"Read only access to HDX: {self.hdx_read_only!s}")

if self.hdx_site == "hdx_custom_site":
hdx_key = None
Expand Down
Empty file modified src/hdx/api/locations.py
100755 → 100644
Empty file.
4 changes: 3 additions & 1 deletion src/hdx/api/utilities/date_helper.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def get_hdx_date(
def get_time_period_info(
hdx_time_period: str,
date_format: str | None = None,
today: datetime = now_utc(),
today: datetime | None = None,
) -> dict:
"""Get time period as datetimes and strings in specified format.
If no format is supplied, the ISO 8601 format is used. Returns a
Expand All @@ -80,6 +80,8 @@ def get_time_period_info(
Returns:
Dictionary of date information
"""
if today is None:
today = now_utc()
result = {}
if hdx_time_period:
if hdx_time_period[0] == "[" and hdx_time_period[-1] == "]":
Expand Down
Empty file modified src/hdx/api/utilities/filestore_helper.py
100755 → 100644
Empty file.
10 changes: 8 additions & 2 deletions src/hdx/api/utilities/hdx_error_handler.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging
from collections.abc import Sequence
from os import getenv
from types import TracebackType
from typing import Any

from hdx.utilities.dictandlist import dict_of_sets_add
Expand Down Expand Up @@ -32,7 +33,7 @@ def __init__(
):
super().__init__(should_exit_on_error)
if write_to_hdx is None:
write_to_hdx = getenv("ERR_TO_HDX", True)
write_to_hdx = getenv("ERR_TO_HDX", "True")
if write_to_hdx in (False, 0, "false", "False", "FALSE", "N", "n", ""):
self._write_to_hdx = False
logger.info("Errors won't be written to HDX")
Expand Down Expand Up @@ -210,7 +211,12 @@ def output_errors(self) -> None:
if self._write_to_hdx:
self.write_errors_to_hdx()

def __exit__(self, exc_type: Any, exc_value: Any, traceback: Any) -> None:
def __exit__(
self,
exc_type: type[BaseException] | None,
exc_value: BaseException | None,
traceback: TracebackType | None,
) -> None:
if self._write_to_hdx:
self.write_errors_to_hdx()
super().__exit__(exc_type, exc_value, traceback)
Expand Down
Empty file modified src/hdx/data/__init__.py
100755 → 100644
Empty file.
Loading
Loading