Python CDM Models
Project description
cdm-lite
Python Pydantic models for the FINOS Common Domain Model (CDM).
cdm-lite provides a lightweight CLI to download, clean, and compile official FINOS CDM JSON
schemas into Pydantic v2 models. This enables strict validation, autocompletion, and robust
deserialization of CDM JSON payloads in Python codebases without heavy Java dependencies.
Status
Current Phase: Alpha
cdm-lite is currently in an alpha development stage. While the core functionality is operational, we are actively refining the cleaning and generation logic.
Feedback Welcome: We strongly encourage users to provide comments, recommendations, or report any issues found during usage. Your input is vital to reaching a stable 1.0 release.
Scope & Limitations
⚠️ Disclaimer: cdm-lite is intended primarily as a lightweight deserializer. The generated
Python models are derived directly from the published JSON Schemas. While they provide close
structural validation, we cannot guarantee that the generated models perfectly match the
behavioral constraints of the full Common Domain Model.
Pydantic classes inherently cannot capture the full extent of the CDM's functionality, such as complex cross-field cardinality checks, conditions, or rosetta-injected logic. For robust serialization and comprehensive domain validation, we strongly recommend using the official, full CDM project implementations (e.g., the Java distribution).
Installation
uv tool install cdm-lite
Workflow
Download and compile the CDM models for your required schema version:
# List available FINOS CDM versions from Maven Central
cdm-lite versions
# Download schemas and compile Pydantic models locally
cdm-lite install 6.19.0
# Activate the version (updates a local symlink)
cdm-lite use 6.19.0
Note: Models are compiled into a user-level cache directory (e.g., ~/.cache/cdm-lite/). Run cdm-lite status to view your specific path.
Project Integration
To use the compiled models in your application, point your environment to the active models directory.
Using uv (pyproject.toml):
[tool.uv.sources]
# Use the exact absolute path returned by `cdm-lite use`
cdm-models = { path = "/home/user/.cache/cdm-lite/current" }
[project]
dependencies = ["cdm-models"]
Using PYTHONPATH:
# Use the exact absolute path returned by `cdm-lite use`
export PYTHONPATH="/home/user/.cache/cdm-lite/current:$PYTHONPATH"
Deserializing JSON
Once the models are available in your path, use standard Pydantic APIs to parse, validate, and interact with incoming JSON objects:
from cdm-models.models.cdm_event_common_TradeState_schema import TradeState # Exact import paths depend on the CDM schema
payload = '{"trade": {"tradeDate": {"value": "2023-10-25"}}}'
# Deserialize and strictly validate the JSON string
trade_state = TradeState.model_validate_json(payload)
# Access typed and autocompleted attributes
print(trade_state.trade.trade_date.value)
Reference Commands
cdm-lite versions: View available versions on Maven Central.cdm-lite install <version>: Fetch schemas and compile models.cdm-lite use <version>: Set the active version for thecurrentsymlink.cdm-lite list: Show locally compiled versions.cdm-lite status: Print active version and system cache location.cdm-lite remove <version>: Delete a specific version from the local cache.cdm-lite clear: Remove all local schemas and generated models.
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 cdm_lite-0.3.2a1.tar.gz.
File metadata
- Download URL: cdm_lite-0.3.2a1.tar.gz
- Upload date:
- Size: 17.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d214648ec34177c5cd801f1949064608e19d061744f1e1d7ff54dad791b843fb
|
|
| MD5 |
55045535d1a5536dbbc5b9a297ef9820
|
|
| BLAKE2b-256 |
078bcfe97a3aa2ab739300740c8d04df4fc365e25eef27a8bf4c35e02328eb36
|
File details
Details for the file cdm_lite-0.3.2a1-py3-none-any.whl.
File metadata
- Download URL: cdm_lite-0.3.2a1-py3-none-any.whl
- Upload date:
- Size: 24.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56799ae8ff2408f5ee41f76f9974129039653897fd615d79ec417d4c02326c80
|
|
| MD5 |
ad0a839de408188350283d69b6fd3664
|
|
| BLAKE2b-256 |
50a801e34c5e85df2546e9616b32296fd88ec8406fa02cbe3b46e04b7e5c0e68
|