pysdmx in a nutshell

What is pysdmx?

pysdmx is a pragmatic and opinionated SDMX library written in Python. It focuses on simplicity, providing a subset of SDMX functionalities without requiring advanced knowledge of SDMX.

For a quick overview of SDMX, read the “SDMX in 2 minutes” primer or refer to the SDMX documentation.

pysdmx is developed as part of the sdmx.io project under the BIS Open Tech initiative.

What does it do?

pysdmx aspires to be a versatile SDMX toolbox for Python, covering various use cases. Here are some highlights:

SDMX information model in Python

pysdmx offers Python classes representing a simplified subset of the SDMX information model, enabling a domain-driven development of SDMX processes in Python.

The model classes support serialization in formats like JSON, YAML, or MessagePack. This functionality relies on the msgspec library. Please refer to its documentation, to learn more about serialization and deserialization of domain classes.

Explore the SDMX information model classes in the API documentation. These classes are part of the core functionality and don’t require additional installations.

Metadata in action

SDMX metadata are very useful for documenting statistical processes. For example, we can define the structure we expect for a data collection process and share it with the organizations providing data so that they know what to send.

However, metadata can do so much more than that, i.e. they can be “active” and drive various types of statistical processes, such as:

pysdmx supports retrieving metadata from an SDMX Registry or any service compliant with the SDMX-REST 2.0.0 (or above) API.

These classes are part of the core functionality and don’t require additional installations.

Data discovery and data retrieval

This functionality is under development. Once ready, pysdmx will allow:

  • Listing public SDMX services.

  • Discovering data available in these services.

  • Retrieving data from these services.

Although this functionality is still under development, it is already possible to build SDMX-REST queries and execute them against a web service.

Reading and writing SDMX datasets

Head to the how-to guide to learn how to read and write SDMX datasets.

How can I get it?

pysdmx is published on PyPI and can be installed using your preferred method (pip, pipx, poetry, etc.).

For the core functionality, use:

pip install pysdmx

Some use cases require additional dependencies, which can be installed using extras. For example, to parse SDMX-ML messages, install the xml extra:

pip install pysdmx[xml]

To install all extras, use:

pip install pysdmx[all]

The following extras are available:

Available extras

Name

Purpose

xml

Read and Write SDMX-ML messages, on pysdmx.io.xml.

data

Handle SDMX datasets as Pandas data frames, it is required also for reading and writing SDMX-CSV files as of today.

dc

Only required to use the pysdmx.api.dc module when generating queries based on dates.

all

Install all extras.