Installation
uv add mlschemaMLschema is a pure-Python package on PyPI. Any standard installer works:
pip install mlschemapoetry add mlschemaInside a Conda environment, activate it and use pip.
Requirements
Section titled “Requirements”| Dependency | Supported range |
|---|---|
| Python | >=3.14,<3.15 |
| pandas | >=3.0.3,<4.0.0 |
| pydantic | >=2.13.4,<3.0.0 |
pandas and pydantic are installed with the package. Install them explicitly only when your own code imports them, which it usually does for pandas.
Pin a version
Section titled “Pin a version”Inference rules and the field contract can change between minor versions while MLschema is pre-1.0. Pin the version you tested and upgrade deliberately after reading the changelog:
uv add "mlschema==0.3.0"pip install "mlschema==0.3.0"Verify the installation
Section titled “Verify the installation”from importlib.metadata import version
import pandas as pd
from mlschema import infer_schema
print(version("mlschema"))print(infer_schema(pd.DataFrame({"score": [98.5, 86.0]})))The second line prints a list with one field:
[{'label': 'score', 'required': True, 'mappedTo': 'score', 'kind': 'number', 'step': 0.1}]Troubleshooting
Section titled “Troubleshooting”| Symptom | Likely cause | Resolution |
|---|---|---|
No matching distribution found for mlschema |
Python is outside >=3.14,<3.15, or PyPI is unreachable. |
Check python --version and your package index. |
ModuleNotFoundError: No module named 'mlschema' |
The package is in a different environment. | Activate the intended environment and reinstall. |
Most fields come back as text |
Columns are stored as object, str, or a nullable extension dtype. |
Convert columns to the dtypes listed in Field kinds. |
EmptyDataFrameError |
The DataFrame has no rows or no columns. | Check the data before inference. |
pydantic.ValidationError |
An override, builder, or custom kind produced invalid constraints. | See Errors. |
Working on MLschema itself
Section titled “Working on MLschema itself”The library uses uv, Ruff, and Pyright:
uv syncuv run ruff check .uv run ruff format --check .uv run pyrightuv run pytestThis documentation is an Astro Starlight project under docs/, using Vite+ (vp) and the
repository’s pnpm workspace. Use Node.js 22.18+, 24.11+, or 26+:
vp install --frozen-lockfilevp run docs#devvp run docs#build