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.

Metadata

Release files for chile-open-data-sdk 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for chile-open-data-sdk 0.2.0
File Size Uploaded Provenance Actions
chile_open_data_sdk-0.2.0.tar.gz 150.4 kB With provenance Details for chile_open_data_sdk-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for chile-open-data-sdk 0.2.0
File Interpreter ABI Platform Actions
chile_open_data_sdk-0.2.0-py3-none-any.whl Python 3 none any Details for chile_open_data_sdk-0.2.0-py3-none-any.whl

Total release size: 167.1 kB

Release files / chile_open_data_sdk-0.2.0.tar.gz

Download URL chile_open_data_sdk-0.2.0.tar.gz
Size 150.4 kB
Tags Source
SHA-256 checksum
How to use checksums
107107822990bb264ecfc2e216e90b8afd594f69bf27bb58d509fc85038461cb
BLAKE2b-256 checksum
How to use checksums
078849cec23a95551c7c4d53091c33a4edb5724a331f6a1ecfd1c2274e77a909
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.

Transparency log

Release files / chile_open_data_sdk-0.2.0-py3-none-any.whl

Download URL chile_open_data_sdk-0.2.0-py3-none-any.whl
Size 16.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
546153e23a9588fa50738f9d569ba1ea1f21da29b5fcd02bd41bb1a78243f7f1
BLAKE2b-256 checksum
How to use checksums
674def35015819e66dcb44bd4f9e268ce152e0218fee34c56e9ac5fe5049bb78
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.

Transparency log

Security for chile-open-data-sdk 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for chile_open_data_sdk-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

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