Skip to main content

Python SDK for the UN Comtrade (UNSD) trade statistics API

Project description

un-comtrade-sdk

PyPI Python License: MIT

Production-ready Python SDK for the UN Comtrade (UNSD) trade statistics API. Typed. Documented. Tested. Validated on every push to main.

Status

The latest stable release is published on PyPI. The same source builds cleanly on every push; CI is the gate. Releases are driven by git tags (v*.*.*) on main.

Quality gate What it proves Last run on main
Quality ruff, mypy, automated test suite passing
Documentation mkdocs build --strict passing
Package python -m build (wheel + sdist), twine check passing
Security TruffleHog secret scan, pip-audit across Python 3.11–3.13 passing
Release tag-driven PyPI publication (TestPyPI + production) passing

Install

pip install un-comtrade-sdk

Check the import:

>>> import un_comtrade

If the import succeeds, the install worked. The package version is exposed via un_comtrade.__version__ and is also reported by the un-comtrade --version console script.

Quick start

from un_comtrade import ComtradeClient

# Reads UN_COMTRADE_KEY from the environment by default.
client = ComtradeClient()

# Reference metadata.
countries = client.metadata.get_countries()
classifications = client.metadata.get_classifications()

# Trade flows.
exports = client.trade.get_exports(reporter_code=699, period="2022")
imports  = client.trade.get_imports(reporter_code=699, period="2022")

The single public entry point is un_comtrade.client.ComtradeClient. Endpoints are grouped by domain: metadata, trade, etl, analytics, storage. See the SDK specification for the full surface.

A minimal CLI is shipped as the un-comtrade console script:

un-comtrade --version     # prints the installed version
un-comtrade metadata countries

Documentation

  • API reference + cookbook — built with mkdocs from website/. Local preview:

    cd website && python -m mkdocs serve
    
  • Design documents — docs/: specification, architecture, ADRs, ETL / storage / packaging / testing standards.

  • Release notes — historical record of changes shipped in the v1.x series.

  • Engineering change log — every CHG entry since project start.

Project metadata

Field Value
Distribution name un-comtrade-sdk
License MIT
Python >= 3.11
Classifier Development Status :: 5 - Production/Stable
Latest release GitHub Releases
Homepage https://github.com/Horizon-Labs-Building-AI-Systems/un-comtrade-sdk
Repository https://github.com/Horizon-Labs-Building-AI-Systems/un-comtrade-sdk
Issues https://github.com/Horizon-Labs-Building-AI-Systems/un-comtrade-sdk/issues
Changelog https://github.com/Horizon-Labs-Building-AI-Systems/un-comtrade-sdk/blob/main/docs/CHANGELOG.md
Release notes (v1.x series) https://github.com/Horizon-Labs-Building-AI-Systems/un-comtrade-sdk/blob/main/docs/032_v1_RELEASE_NOTES.md
PyPI index https://pypi.org/project/un-comtrade-sdk/
Documentation site https://horizon-labs-building-ai-systems.github.io/un-comtrade-sdk/

License

MIT.

Project details


Download files

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

Source Distribution

un_comtrade_sdk-1.0.3.tar.gz (509.3 kB view details)

Uploaded Source

Built Distribution

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

un_comtrade_sdk-1.0.3-py3-none-any.whl (259.2 kB view details)

Uploaded Python 3

File details

Details for the file un_comtrade_sdk-1.0.3.tar.gz.

File metadata

  • Download URL: un_comtrade_sdk-1.0.3.tar.gz
  • Upload date:
  • Size: 509.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for un_comtrade_sdk-1.0.3.tar.gz
Algorithm Hash digest
SHA256 1b69c692deca1ea1d89db89baa09f4bc33121565f394c4d0bdb69960657fa8bb
MD5 0fb9c33ce3556a9d5726c7360cf43cca
BLAKE2b-256 a7c736f6af2fa7c64585b766f9f9ce430730f89e206a8ffb36b88457f3b63967

See more details on using hashes here.

File details

Details for the file un_comtrade_sdk-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: un_comtrade_sdk-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 259.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for un_comtrade_sdk-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 23812f7d654d62ba6f88d7db33c0ccd7138caddfa05b0b38fda1ab601e78130e
MD5 fafa3b7e772c13f02946a37ecb9a8e22
BLAKE2b-256 def3bcf3ab6b4adb1cffaca040a2342193fb909e17ffa84e70a709995c76d043

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page