Skip to main content

sdgdata

sdgdata is an unofficial Python client for SDG data from the UNSD SDG API.

It provides a simple client to retrieve Sustainable Development Goal metadata and data from Python, with models derived from the UNSD SDG API schema.

Features

  • Fetch SDG goals, targets, indicators, and series metadata.
  • Look up geographic areas and M49 area codes.
  • Retrieve paginated SDG series observations with simple Python calls.
  • Validate structured API responses with Pydantic models.
  • Load observation data into analysis tools such as pandas or Polars.

Installation

Install from PyPI:

uv add sdgdata

or:

pip install sdgdata

Quick Start

from sdgdata import SDGClient
from sdgdata.client import is_single_time_series

client = SDGClient()

# Find available geographic areas and SDG targets.
areas = client.get_geo_areas()
targets = client.get_targets()

# Find latest-release series codes for a target.
series = client.get_series_codes(target_code="3.8")
series_code = series[-1].code
area_code = areas[0].geoAreaCode

# Inspect available disaggregation dimensions for a series.
dimensions = client.get_series_dimensions(series_code)

# Fetch the coarsest available disaggregation by default.
data = client.get_series_data(
    series_codes=[series_code],
    area_code=area_code,
    start_period="2015",
    end_period="2026",
)

assert is_single_time_series(data)

# To fetch every disaggregation, opt into the unfiltered API response.
all_disaggregations = client.get_series_data(
    series_codes=[series_code],
    area_code=area_code,
    start_period="2015",
    end_period="2026",
    dimensions="all",
)

# Or request a specific disaggregation slice.
custom_slice = client.get_series_data(
    series_codes=[series_code],
    area_code=area_code,
    dimensions={"Reporting Type": "G"},
)

get_series_data() returns a list of dictionaries, making it straightforward to create a dataframe for analysis. It normalizes singleton goal, target, and indicator arrays to strings, and integral timePeriodStart values to integers. By default, it filters to the coarsest available disaggregation, such as all ages, both sexes, and total groups when those dimension values exist. For the upstream observation field descriptions, see the UNSD SDG API Swagger documentation.

Documentation

  • Development: setup, tests, fixture refreshes, builds, and CI behavior.
  • Model generation: generated models, stale checks, and OpenAPI source data.

Metadata

Release files for sdgdata 0.1.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 sdgdata 0.1.0
File Size Uploaded
sdgdata-0.1.0.tar.gz 11.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sdgdata 0.1.0
File Interpreter ABI Platform
sdgdata-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 22.9 kB

Release files / sdgdata-0.1.0.tar.gz

Download URL sdgdata-0.1.0.tar.gz
Size 11.8 kB
Tags Source
SHA-256 checksum
How to use checksums
afb46c94c7012a179f73b3e7579987f976b7efeead265f73bd08bd3323db20e0
BLAKE2b-256 checksum
How to use checksums
fd1a5744317bdf59eead9cea5118d82836c1e61533b54d08ffc26b7517877f92
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jun 6, 2026.

Transparency log

Release files / sdgdata-0.1.0-py3-none-any.whl

Download URL sdgdata-0.1.0-py3-none-any.whl
Size 11.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
efb6b58018260ab7765b0475b36c20362346884cb9fcbca783c8fd26ff93df4c
BLAKE2b-256 checksum
How to use checksums
f9d5ec824d9cb0765158c76d3f78be0409e0554d77755e2eede55fb9bb08c742
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jun 6, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release 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