scitex-types
Scientific type aliases (ArrayLike, ColorLike) + runtime validation predicates.
Full Documentation · uv pip install scitex-types[all]
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 | Checking list of floats at runtime ("is this a list of floats?") takes a 3-line comprehension | is_array_like(), is_list_of_type(lst, float) — clear predicates, no isinstance chain |
Quick Start
from scitex_types import ArrayLike, is_array_like, is_list_of_type
def process(data: ArrayLike) -> None: ...
is_array_like([1, 2, 3]) # True
is_list_of_type([1, 2, 3], int) # True
Demo
from scitex_types import ArrayLike, is_array_like, is_list_of_type
def normalize(x: ArrayLike) -> ArrayLike:
assert is_array_like(x)
return x
normalize([1, 2, 3]) # OK
normalize("not array") # AssertionError
is_list_of_type([1, 2, 3], int) # True — uniform int list
is_list_of_type([1, "x"], int) # False — mixed
flowchart LR
Input[Function input] --> Pred{is_array_like?}
Pred -- yes --> Proceed[proceed]
Pred -- no --> Raise[raise / branch]
style Proceed fill:#27ae60,stroke:#2c3e50,color:#fff
style Raise fill:#e74c3c,stroke:#2c3e50,color:#fff
Figure 1. Demo. Use ArrayLike in annotations, is_array_like as a one-line guard.
Installation
uv pip install "scitex-types[all]"
Extras
| Extra | Enables |
|---|---|
all |
Every array-library match (numpy, pandas, torch, xarray) |
dev |
Maintainer tools (pytest, sphinx + theme/parser extensions) |
Architecture
scitex_types/
├── _aliases.py # ArrayLike, ColorLike unions
└── _predicates.py # is_array_like, is_list_of_type
flowchart LR
A[list / tuple] --> AL[ArrayLike]
B[np.ndarray] --> AL
C[pd.DataFrame / Series] --> AL
D[xr.DataArray] --> AL
E[torch.Tensor] --> AL
AL --> P[is_array_like]
F[mpl color string / RGB / RGBA] --> CL[ColorLike]
style AL fill:#4a90d9,stroke:#2c3e50,color:#fff
style CL fill:#8e44ad,stroke:#2c3e50,color:#fff
Figure 2. Type surface. Two aliases unify common scientific containers and matplotlib color inputs; predicates resolve membership at runtime.
1 Interfaces
Python API
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_array_like("not array") # False
is_list_of_type([1, 2, 3], int) # True
is_list_of_type([1, "x"], int) # False
Part of SciTeX
scitex-types is part of SciTeX. Install via
the umbrella with pip install scitex[types] to use as
scitex.types (Python) or scitex types ... (CLI).
Four Freedoms for Research
- The freedom to run your research anywhere — your machine, your terms.
- The freedom to study how every step works — from raw data to final manuscript.
- The freedom to redistribute your workflows, not just your papers.
- The freedom to modify any module and share improvements with the community.
AGPL-3.0 — because we believe research infrastructure deserves the same freedoms as the software it runs on.
License
AGPL-3.0-only (see LICENSE).
Metadata
Release files for scitex-types 0.1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| scitex_types-0.1.7.tar.gz | 8.6 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| scitex_types-0.1.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.8 MB
Release files / scitex_types-0.1.7.tar.gz
| Download URL | scitex_types-0.1.7.tar.gz |
|---|---|
| Size | 8.6 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2fffabd505b949ab483e781574cf2b4a6ad69e8fcc2ad77edc137e110b2f5ac5
|
|
BLAKE2b-256 checksum How to use checksums |
8051528497925c8362f14f338aaff1f1e22f1f71e120b93c583ac5afa32ddd54
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / scitex_types-0.1.7-py3-none-any.whl
| Download URL | scitex_types-0.1.7-py3-none-any.whl |
|---|---|
| Size | 8.2 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1bf4bc6eff3e42611addd7c3dbcfa4dba7fd581758e022910182815c066dde83
|
|
BLAKE2b-256 checksum How to use checksums |
01aaef272ee894d18cbcb42e9040fed53808c314668704d65b0fff0f4f1be910
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|