ml4t-specs
Shared schema and artifact contracts for the ML4T library ecosystem.
The stable support matrix is CPython 3.12 through 3.14 on Linux, macOS, and Windows. CPython 3.15 prereleases are tested on all three operating systems but are not advertised as stable until Python 3.15 is final.
What This Package Does
ml4t-specs provides the small set of shared types that multiple ML4T libraries use to
describe:
- market data column mappings and feed semantics
- artifact metadata and storage conventions
- lightweight YAML/JSON spec payloads
It exists so the higher-level libraries can exchange consistent contracts without re-defining the same dataclasses in multiple repos.
Today it is used by:
ml4t-backtestforFeedSpecand market-data execution semanticsml4t-engineerfor artifact metadataml4t-diagnosticfor artifact and backtest-result integrationml4t-modelsas an optional integration bridge whenml4t-specsis installed
Installation
pip install ml4t-specs
Main Types
FeedSpec
FeedSpec defines how downstream libraries should interpret a tradable price table:
- timestamp column
- entity column
- price / OHLCV columns
- quote columns
- calendar and timezone
- data frequency and timestamp semantics
from ml4t.specs import FeedSpec
feed = FeedSpec(
timestamp_col="date",
entity_col="ticker",
close_col="settle",
price_col="settle",
calendar="NYSE",
timezone="America/New_York",
data_frequency="daily",
)
MarketDataSpec
MarketDataSpec bundles schema, semantics, and artifact metadata into one serializable object.
from ml4t.specs import ArtifactStorage, MarketDataSchema, MarketDataSemantics, MarketDataSpec
spec = MarketDataSpec(
artifact_id="us_equities_daily",
schema=MarketDataSchema(timestamp_col="date", entity_col="ticker", close_col="close"),
semantics=MarketDataSemantics(calendar="NYSE", data_frequency="daily"),
storage=ArtifactStorage(path="data/us_equities_daily.parquet"),
)
Artifact Contracts
The base artifact layer gives ML4T libraries a shared way to talk about persisted outputs:
ArtifactKindArtifactStorageArtifactProvenanceArtifactSpec
Read And Write Spec Payloads
from ml4t.specs import read_spec_payload, write_spec_payload
write_spec_payload(spec, "market_data.yaml")
loaded = read_spec_payload("market_data.yaml")
Why This Exists
The public ML4T libraries share a few contract types at their boundaries. Keeping them here:
- reduces duplication
- keeps cross-library serialization consistent
- gives backtest, modeling, engineering, and diagnostics code one shared contract vocabulary
This package is intentionally small. It is a support layer, not a full end-user workflow library.
Development
git clone https://github.com/ml4t/specs.git
cd ml4t-specs
uv sync --dev
uv run ruff check src/ tests/
uv run ty check
uv run pytest tests/ -q
uv build
License
MIT
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 ml4t_specs-0.1.0.tar.gz.
File metadata
- Download URL: ml4t_specs-0.1.0.tar.gz
- Upload date:
- Size: 11.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a283030dceb30039acaf3188b508e8058075ed62fc38ef9e2fa51181f92b3d36
|
|
| MD5 |
54e502914e81d58d9cc50f1b8762e63e
|
|
| BLAKE2b-256 |
443d9551605c4bf3a89d107eb7ccd2fca977ee516edfd14937c40791c6cd946b
|
Provenance
The following attestation bundles were made for ml4t_specs-0.1.0.tar.gz:
Publisher:
release.yml on ml4t/specs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ml4t_specs-0.1.0.tar.gz -
Subject digest:
a283030dceb30039acaf3188b508e8058075ed62fc38ef9e2fa51181f92b3d36 - Sigstore transparency entry: 2369889180
- Sigstore integration time:
-
Permalink:
ml4t/specs@0f7535dd4bf2e0bc80403fbaa70c22a97acc2a32 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ml4t
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0f7535dd4bf2e0bc80403fbaa70c22a97acc2a32 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ml4t_specs-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ml4t_specs-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a6e7f253a6c501d946cfdfd3d8729e94e09180012f9bec1a4f1ef9afa86d4560
|
|
| MD5 |
84d3a71056571aa1cb61f0320d38c79d
|
|
| BLAKE2b-256 |
f85ae808b7bfa4896211f116f2714b7cd81848865dff14621ea245c7722f907b
|
Provenance
The following attestation bundles were made for ml4t_specs-0.1.0-py3-none-any.whl:
Publisher:
release.yml on ml4t/specs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ml4t_specs-0.1.0-py3-none-any.whl -
Subject digest:
a6e7f253a6c501d946cfdfd3d8729e94e09180012f9bec1a4f1ef9afa86d4560 - Sigstore transparency entry: 2369889307
- Sigstore integration time:
-
Permalink:
ml4t/specs@0f7535dd4bf2e0bc80403fbaa70c22a97acc2a32 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ml4t
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0f7535dd4bf2e0bc80403fbaa70c22a97acc2a32 -
Trigger Event:
push
-
Statement type: