Metadata-Version: 2.4
Name: skeights
Version: 0.4.0
Summary: Serialize fitted scikit-learn models to safetensors + JSON
Project-URL: Repository, https://github.com/carbon-re/skeights
Project-URL: Changelog, https://github.com/carbon-re/skeights/releases
Author-email: Gigaton <engineering@gigaton.co>
License-Expression: MIT
License-File: LICENSE
Keywords: machine-learning,safetensors,scikit-learn,serialization
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.11
Requires-Dist: numpy
Requires-Dist: safetensors
Requires-Dist: scikit-learn>=1.5
Provides-Extra: all
Requires-Dist: lightgbm; extra == 'all'
Requires-Dist: xgboost; extra == 'all'
Provides-Extra: dev
Requires-Dist: lightgbm; extra == 'dev'
Requires-Dist: pandas; extra == 'dev'
Requires-Dist: pyright; extra == 'dev'
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Requires-Dist: xgboost; extra == 'dev'
Provides-Extra: docs
Requires-Dist: mkdocs-material; extra == 'docs'
Provides-Extra: lightgbm
Requires-Dist: lightgbm; extra == 'lightgbm'
Provides-Extra: xgboost
Requires-Dist: xgboost; extra == 'xgboost'
Description-Content-Type: text/markdown

<p align="center">
  <img src="https://raw.githubusercontent.com/carbon-re/skeights/main/logo.png" alt="skeights logo" width="200">
</p>

# skeights

Serialize fitted scikit-learn models to [safetensors](https://github.com/huggingface/safetensors) + JSON.

No pickle. No joblib. Just weights and config.

skeights saves a fitted model as two files: a `.json` file containing
hyperparameters and structural config, and a `.safetensors` file
containing the numeric arrays (coefficients, tree splits, leaf values).
The JSON is human-readable, so you can inspect, grep, and diff model
config without loading it. The safetensors format is compact, typed,
and memory-mappable. Neither file executes arbitrary code on load,
so loading untrusted models is safe.

## Install

```bash
pip install skeights
```

## Quick start

```python
import skeights
from sklearn.linear_model import Ridge
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler

pipe = Pipeline([
    ("scaler", StandardScaler()),
    ("model", Ridge(alpha=0.1)),
])
pipe.fit(X_train, y_train)

# Save
skeights.save(pipe, "model.safetensors", "model.json")

# Load and predict
loaded = skeights.load("model.safetensors", "model.json")
predictions = loaded.predict(X_test)
```

## Documentation

Full docs, API reference, and supported estimators: **[carbon-re.github.io/skeights](https://carbon-re.github.io/skeights)**

## License

MIT
