Skip to main content

Chile Open Data SDK

An unofficial, typed Python SDK for Chile's datos.gob.cl, with a reusable CKAN Action API core. This community project is not an official SDK of the Government of Chile or the maintainers of datos.gob.cl.

v0.2.0 scope

This alpha adds typed dataset search and metadata lookup, resource metadata, organization/group/tag discovery, and lazy catalog pagination to the synchronous CKAN client. Configuration, connection pooling, explicit token authentication, generic actions, and structured errors remain available.

DataStore wrappers, async clients, retries, downloads, and dataframe integrations belong to later milestones. See the catalog guide.

Installation

Python 3.11 or later is required. Before publication, install from a local checkout:

uv sync --locked

Or build and install the wheel with a standard Python installer:

uv build
python -m pip install dist/chile_open_data_sdk-0.2.0-py3-none-any.whl

After v0.2.0 is published, installation will be:

python -m pip install chile-open-data-sdk==0.2.0

The distribution is chile-open-data-sdk; the import is chile_open_data_sdk.

Quick start

from chile_open_data_sdk import ChileOpenDataClient

with ChileOpenDataClient() as client:
    result = client.datasets.search("transport", rows=5)
    for dataset in result.results:
        print(dataset.title)

The default endpoint is https://datos.gob.cl/api/3/action. Typed catalog calls return Pydantic models, while client.actions.call returns the unwrapped JSON result. Both preserve additional server fields. Availability and metadata quality depend on the upstream portal.

Another CKAN site

from chile_open_data_sdk import CKANClient

with CKANClient(site_url="https://demo.ckan.org") as client:
    print(client.actions.call("package_list", {"limit": 5}))

Authentication and errors

Credentials are explicit and are sent only in the Authorization header. The constructor does not read environment credentials. Your application can do so:

import os

from chile_open_data_sdk import ChileOpenDataClient
from chile_open_data_sdk.errors import CKANError

try:
    with ChileOpenDataClient(api_token=os.environ.get("CHILE_OPEN_DATA_API_TOKEN")) as client:
        result = client.actions.call("package_list", {"limit": 5})
except CKANError as error:
    print(error.action, error.status_code, error.error_type)

Generic calls use JSON POST and never retry automatically, including read operations. They can execute writes: the caller chooses the action and the server enforces permissions. Redirects are not followed. Configuration and SDK error representations exclude the configured token; do not log raw payloads or credentials.

Documentation

Build the documentation locally with uv run --group docs mkdocs build --strict, or preview with uv run --group docs mkdocs serve. No hosted documentation URL is claimed until deployment is configured.

Development

uv sync --locked --group docs
uv run ruff check .
uv run ruff format --check .
uv run mypy src
uv run basedpyright
uv run pytest
uv run --group docs mkdocs build --strict
uv build
uv run python scripts/check_artifacts.py

Normal tests use mocked HTTP; live portal tests are opt-in. See Contributing and Security.

Existing CKAN clients such as ckanapi serve the community already. This project's direction is Chile-first defaults, modern Python typing, and progressively richer sync/async workflows.

License

MIT. Portal datasets may have their own licenses; the SDK's license does not determine permission to use upstream data.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chile_open_data_sdk-0.2.0.tar.gz (150.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chile_open_data_sdk-0.2.0-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file chile_open_data_sdk-0.2.0.tar.gz.

File metadata

  • Download URL: chile_open_data_sdk-0.2.0.tar.gz
  • Upload date:
  • Size: 150.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for chile_open_data_sdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 107107822990bb264ecfc2e216e90b8afd594f69bf27bb58d509fc85038461cb
MD5 2fea37c1a69eecc9a4b67810458fee03
BLAKE2b-256 078849cec23a95551c7c4d53091c33a4edb5724a331f6a1ecfd1c2274e77a909

See more details on using hashes here.

Provenance

The following attestation bundles were made for chile_open_data_sdk-0.2.0.tar.gz:

Publisher: publish.yml on ezer-mackenzie/chile-open-data-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file chile_open_data_sdk-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for chile_open_data_sdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 546153e23a9588fa50738f9d569ba1ea1f21da29b5fcd02bd41bb1a78243f7f1
MD5 286acaa30166ef647d6e2bc705e585fe
BLAKE2b-256 674def35015819e66dcb44bd4f9e268ce152e0218fee34c56e9ac5fe5049bb78

See more details on using hashes here.

Provenance

The following attestation bundles were made for chile_open_data_sdk-0.2.0-py3-none-any.whl:

Publisher: publish.yml on ezer-mackenzie/chile-open-data-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page