Python SDK for the UN Comtrade (UNSD) trade statistics API
Project description
un-comtrade-sdk
Production-ready Python SDK for the UN Comtrade (UNSD) trade statistics API.
Typed. Documented. Tested. Validated on every push to main.
Status
The latest development release is published on TestPyPI. The same source builds cleanly on every push; CI is the gate. Production PyPI mirrors the release once a stable cut is tagged.
| 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 TestPyPI publication | passing |
Install
pip install \
--index-url https://test.pypi.org/simple \
--extra-index-url https://pypi.org/simple \
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 |
| TestPyPI index | https://test.pypi.org/project/un-comtrade-sdk/ |
| Documentation site | https://horizon-labs-building-ai-systems.github.io/un-comtrade-sdk/ |
License
MIT.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file un_comtrade_sdk-1.0.2.tar.gz.
File metadata
- Download URL: un_comtrade_sdk-1.0.2.tar.gz
- Upload date:
- Size: 509.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4fecfcb8fd414c31a8d8c0cbd315df9010f2303b6a194845680bfc812827b79c
|
|
| MD5 |
1049cb0d1d0addab404a8371830194c2
|
|
| BLAKE2b-256 |
d4b375cc267c175682596104e7cdd33cbcfc51a869da1e117c90cdcae985c42a
|
File details
Details for the file un_comtrade_sdk-1.0.2-py3-none-any.whl.
File metadata
- Download URL: un_comtrade_sdk-1.0.2-py3-none-any.whl
- Upload date:
- Size: 259.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86e0631101240e8b445db811ff2dd536e2848db3719d2c8a632301aab35801a0
|
|
| MD5 |
64683be7014a0c9449a487114fc05f9d
|
|
| BLAKE2b-256 |
918a7f1e030b9097490159d02eb4801cf11d10cd2197acc80ca72d8e410c7016
|