Metadata-Version: 2.4
Name: scitex-types
Version: 0.1.3
Summary: Scientific type definitions (ArrayLike, ColorLike) and validation
Project-URL: Homepage, https://github.com/ywatanabe1989/scitex-types
Project-URL: Repository, https://github.com/ywatanabe1989/scitex-types
Project-URL: Issues, https://github.com/ywatanabe1989/scitex-types/issues
Author: Yusuke Watanabe
License-Expression: AGPL-3.0-only
License-File: LICENSE
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
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: Typing :: Typed
Requires-Python: >=3.10
Provides-Extra: all
Requires-Dist: numpy; extra == 'all'
Requires-Dist: pandas; extra == 'all'
Requires-Dist: torch; extra == 'all'
Requires-Dist: xarray; extra == 'all'
Provides-Extra: dev
Requires-Dist: numpy; extra == 'dev'
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: pytest-cov; extra == 'dev'
Requires-Dist: scitex-dev; extra == 'dev'
Provides-Extra: docs
Requires-Dist: myst-parser>=2.0; extra == 'docs'
Requires-Dist: sphinx-autodoc-typehints>=1.25; extra == 'docs'
Requires-Dist: sphinx-copybutton>=0.5; extra == 'docs'
Requires-Dist: sphinx-rtd-theme>=2.0; extra == 'docs'
Requires-Dist: sphinx>=7.0; extra == 'docs'
Provides-Extra: numpy
Requires-Dist: numpy; extra == 'numpy'
Provides-Extra: pandas
Requires-Dist: pandas; extra == 'pandas'
Provides-Extra: torch
Requires-Dist: torch; extra == 'torch'
Provides-Extra: xarray
Requires-Dist: xarray; extra == 'xarray'
Description-Content-Type: text/markdown

# scitex-types

<!-- scitex-badges:start -->
[![PyPI](https://img.shields.io/pypi/v/scitex-types.svg)](https://pypi.org/project/scitex-types/)
[![Python](https://img.shields.io/pypi/pyversions/scitex-types.svg)](https://pypi.org/project/scitex-types/)
[![Tests](https://github.com/ywatanabe1989/scitex-types/actions/workflows/test.yml/badge.svg)](https://github.com/ywatanabe1989/scitex-types/actions/workflows/test.yml)
[![Install Test](https://github.com/ywatanabe1989/scitex-types/actions/workflows/install-test.yml/badge.svg)](https://github.com/ywatanabe1989/scitex-types/actions/workflows/install-test.yml)
[![Coverage](https://codecov.io/gh/ywatanabe1989/scitex-types/graph/badge.svg)](https://codecov.io/gh/ywatanabe1989/scitex-types)
[![Docs](https://readthedocs.org/projects/scitex-types/badge/?version=latest)](https://scitex-types.readthedocs.io/en/latest/)
[![License: AGPL v3](https://img.shields.io/badge/license-AGPL_v3-blue.svg)](https://www.gnu.org/licenses/agpl-3.0)
<!-- scitex-badges:end -->


Scientific type definitions (ArrayLike, ColorLike) and validation utilities.

> **Interfaces:** Python ⭐⭐⭐ (primary) · CLI — · MCP — · Skills ⭐ · Hook — · HTTP —

## Problem and Solution


| # | Problem | Solution |
|---|---------|----------|
| 1 | **`numpy.typing.ArrayLike` covers only NumPy** -- functions that also accept Torch/DataFrame/Series need a hand-rolled `Union` | **`ArrayLike`, `ColorLike`** -- stable aliases spanning `list/tuple/np.ndarray/pd.DataFrame/pd.Series/xr.DataArray/torch.Tensor` + matplotlib color inputs |
| 2 | **Runtime "is this a list of floats?" is a 3-line comprehension** | **`is_array_like()`, `is_list_of_type(lst, float)`** -- clear predicates, no isinstance chain |

## Installation

```bash
pip install scitex-types
```

With optional dependencies:

```bash
pip install scitex-types[numpy,pandas]
pip install scitex-types[all]
```

## Usage

```python
from scitex_types import ArrayLike, ColorLike, is_array_like, is_list_of_type

# Type annotations
def process(data: ArrayLike) -> None: ...
def set_color(c: ColorLike) -> None: ...

# Runtime checks
is_array_like([1, 2, 3])           # True
is_list_of_type([1, 2, 3], int)    # True
```
