Metadata-Version: 2.4
Name: chemotools
Version: 0.3.0
Summary: chemotools: A Python Package that Integrates Chemometrics and scikit-learn
Author: Pau Cabaneros
License-Expression: MIT
License-File: LICENSE
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: >=3.10
Requires-Dist: numpy<3,>=2.0.0
Requires-Dist: scikit-learn<2,>=1.6.0
Requires-Dist: scipy<2,>=1.11.0
Provides-Extra: viz
Requires-Dist: matplotlib>=3.10.7; extra == 'viz'
Description-Content-Type: text/markdown

![chemotools](assets/images/banner_dark.png)

# chemotools


[![PyPI](https://img.shields.io/pypi/v/chemotools)](https://pypi.org/project/chemotools)
[![Python Versions](https://img.shields.io/pypi/pyversions/chemotools)](https://pypi.org/project/chemotools)
[![License](https://img.shields.io/pypi/l/chemotools)](https://github.com/paucablop/chemotools/blob/main/LICENSE)
[![Coverage](https://codecov.io/github/paucablop/chemotools/branch/main/graph/badge.svg?token=D7JUJM89LN)](https://codecov.io/github/paucablop/chemotools)
[![Downloads](https://static.pepy.tech/badge/chemotools)](https://pepy.tech/project/chemotools)
[![DOI](https://joss.theoj.org/papers/10.21105/joss.06802/status.svg)](https://doi.org/10.21105/joss.06802)
[![CodeFactor](https://www.codefactor.io/repository/github/paucablop/chemotools/badge/main)](https://www.codefactor.io/repository/github/paucablop/chemotools/overview/main)

---

`chemotools` is a Python library that brings **chemometric preprocessing tools** into the [`scikit-learn`](https://scikit-learn.org/) ecosystem.  

It provides modular transformers for spectral data, designed to plug seamlessly into your ML workflows.

## Features

- Preprocessing for spectral data (baseline correction, smoothing, scaling, derivatization, scatter correction).  
- Fully compatible with `scikit-learn` pipelines and transformers.  
- Simple, modular API for flexible workflows.  
- Open-source, actively maintained, and published on [PyPI](https://pypi.org/project/chemotools/) and [Conda](https://anaconda.org/conda-forge/chemotools).  

## Installation

Install from PyPI:

```bash
pip install chemotools
````

Install from Conda:

```bash
conda install -c conda-forge chemotools
```

## Usage

Example: preprocessing pipeline with scikit-learn:

```python
from sklearn.preprocessing import StandardScaler
from sklearn.pipeline import make_pipeline

from chemotools.baseline import AirPls
from chemotools.scatter import MultiplicativeScatterCorrection

preprocessing = make_pipeline(
    AirPls(),
    MultiplicativeScatterCorrection(),
    StandardScaler(with_std=False),
)

spectra_transformed = preprocessing.fit_transform(spectra)
```

➡️ See the [documentation](https://paucablop.github.io/chemotools/) for full details.

## Development

This project uses [uv](https://github.com/astral-sh/uv) for dependency management and [Task](https://taskfile.dev) to simplify common development workflows.
You can get started quickly by using the predefined [Taskfile](./Taskfile.yml), which provides handy shortcuts such as:

```bash
task install     # install all dependencies
task check       # run formatting, linting, typing, and tests
task test        # quick test run in the current environment
task test:matrix # run the nox compatibility matrix locally
task coverage    # run tests with coverage reporting
task build       # build the package for distribution
```

For compatibility testing across supported Python versions, use [`nox`](https://nox.thea.codes/):

```bash
uv run nox --list               # show available sessions
uv run nox -s tests-3.12       # run tests on a specific Python version
uv run nox -s tests-min-sklearn-3.10
uv run nox -s tests-min-sklearn-3.12
```

## Contributing

Contributions are welcome!
Check out the [contributing guide](CONTRIBUTING.md) and the [project board](https://github.com/users/paucablop/projects/4).

## License

Released under the [MIT License](LICENSE).

## Compliance and Software Supply Chain Management

This project embraces software supply chain transparency by generating an SBOM (Software Bill of Materials) for all dependencies. SBOMs help organizations, including those in regulated industries, track open-source components, ensure compliance, and manage security risks. 

The SBOM file is made public as an asset attached to every release. It is generated using [CycloneDX SBOM generator for Python](https://github.com/CycloneDX/cyclonedx-python), and can be vsualized in tools like [CycloneDX Sunshine](https://cyclonedx.github.io/Sunshine/).

