Skip to main content

sdmxlib-rest

A generic SDMX-REST HTTP surface over a sdmxlib LocalRegistry.

It owns the parts of an SDMX-REST service that are the same everywhere — URL grammar, content negotiation, localisation, streaming, response assembly — and leaves everything catalog-specific to the consumer, behind explicit seams.

from sdmxlib_rest.app import RestSettings, create_app, library_routers
from sdmxlib_rest.runtime import CatalogRuntime

runtime = CatalogRuntime(MyCatalogProvider())
app = create_app(
    runtime,
    RestSettings(title="my-sdmx-api", version="1.0.0"),
    routers=list(library_routers()),
)

That serves the structure, metadata and availability planes. Serving data is the consumer's job — see Why there is no data route below.

What you supply

Everything catalog-shaped is a Protocol on CatalogRuntime, each with a no-op default. A bare consumer implements only the first one.

Seam Purpose Default
CatalogProvider how the registry is opened required
SpliceRegistry post-serialise JSON transforms empty
StructureCache cache rendered structure responses never caches
AvailabilityValues precomputed availability values, for unfiltered requests always scans
MetadataStore reference-metadata lookups returns nothing
ComponentFilterShaper rewrite a parsed filter before SQL identity
MessageAnnotator pre-serialise message annotation no-op

The defaults are all inert, not broken: a consumer that installs none of them gets a correct service, just one that recomputes more than it needs to.

What create_app gives you

Routes are the easy part. The assembly is what's worth not rewriting:

  • The middleware stack, in the one order that works. The chain has real adjacency constraints — the ETag has to hash uncompressed bytes, so it runs inside compression; ?lang= has to rewrite the header before the ETag layer reads it; CORS has to be outermost or preflights fall through to a 404 that browsers report as a CORS failure. Each constraint is documented at _install_middleware.
  • Runtime sharing across mounts, so a service exposing several surfaces (a canonical one plus compatibility variants) opens the registry once.
  • A multi-spec docs page, which has to be hand-rolled because FastAPI's helper emits a single-spec page and Swagger UI renders nothing when given both url and urls.

Why there is no data route

The library owns data-plane helpers — key and query-parameter parsing, projection, paging headers, binding-driven SQL fragments, and the arrow→CSV/parquet encoders, all under sdmxlib_rest.data. It does not own the /data route itself.

That is deliberate. Orchestration is where response caching, partition pushdown and vendor extensions live, and every catalog shapes those differently — one catalog's hierarchy descent and partition-pruning tricks are noise to the next. A second consumer gets the hard, fiddly parts and writes its own handler around them.

Status

Extracted from a production SDMX-REST service and versioned independently from 0.1.0. The seam set is settled; the create_app signature may still move before 1.0.

Licence

Apache-2.0.

Metadata

Release files for sdmxlib-rest 0.5.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 sdmxlib-rest 0.5.0
File Size Uploaded
sdmxlib_rest-0.5.0.tar.gz 87.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sdmxlib-rest 0.5.0
File Interpreter ABI Platform
sdmxlib_rest-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 196.8 kB

Release files / sdmxlib_rest-0.5.0.tar.gz

Download URL sdmxlib_rest-0.5.0.tar.gz
Size 87.7 kB
Tags Source
SHA-256 checksum
How to use checksums
df5568f5e0aac97209674b90bc984a1b5a8b98b1bdfe4074110e03ca4695703d
BLAKE2b-256 checksum
How to use checksums
8117b238faca7ce06df7c51ca6cd3dd435c74bb775ed4b7787bf5fc5466d596c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / sdmxlib_rest-0.5.0-py3-none-any.whl

Download URL sdmxlib_rest-0.5.0-py3-none-any.whl
Size 109.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8c54ccb320e306597057f64009c9634df7314b35f82081f544330cfd64b945cd
BLAKE2b-256 checksum
How to use checksums
f24ad07d86c17697e057b29a9ac6fc9dad54a9c795cbd18ab2d2e39b83adee4a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.1

2 release files

This release

0.5.0 This release

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.2.1

2 release files

0.1.0

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