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.1.0 scope

This first release provides a synchronous client, validated configuration, connection pooling, JSON action calls, token authentication, and structured errors. It is an alpha foundation with a deliberately small public API.

Typed dataset services, DataStore wrappers, pagination, async clients, downloads, and pandas/Polars integrations are planned for later milestones; they are not available in v0.1.0. Generic actions can already query catalog and DataStore endpoints when the server supports them.

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.1.0-py3-none-any.whl

After v0.1.0 is published, installation will be:

python -m pip install chile-open-data-sdk==0.1.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.actions.call("package_search", {"q": "transport", "rows": 5})
    datasets = result.get("results") if isinstance(result, dict) else None
    if isinstance(datasets, list):
        for dataset in datasets:
            if isinstance(dataset, dict):
                print(dataset.get("title"))

The default endpoint is https://datos.gob.cl/api/3/action. Calls return the unwrapped JSON result, preserving 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.1.0.tar.gz (134.2 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.1.0-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: chile_open_data_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 134.2 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.1.0.tar.gz
Algorithm Hash digest
SHA256 27d23581b6a5cc2edb74c58c6ec6275eff73280ca5357e0d9efd3b44a76e09b5
MD5 b93217beb9dba10dd7646a29cd0f7ff8
BLAKE2b-256 0ecdb438c94df73d4c26ee8d9cdbaa7318236b2fd3773b56463f971571584d03

See more details on using hashes here.

Provenance

The following attestation bundles were made for chile_open_data_sdk-0.1.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.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for chile_open_data_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 29422852ca3b7460e41fc1b34c26c44189ddcd84183fe4ef80b6c3077ef52f0a
MD5 e71146b01cb2a852abbc6491a4e4fd42
BLAKE2b-256 98359dfc2e4276d208b448e95e39acddf7f095d9e38775a49e443ace3dd5808b

See more details on using hashes here.

Provenance

The following attestation bundles were made for chile_open_data_sdk-0.1.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

0.2.0

2 files

This release

0.1.0 This release

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