Skip to main content

Scientific type definitions (ArrayLike, ColorLike) and validation

Project description

scitex-types

PyPI Python Tests Install Test Coverage Docs License: AGPL v3

SciTeX

Scientific type aliases (ArrayLike, ColorLike) + runtime validation predicates.

Full Documentation · pip install scitex-types


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

pip install scitex-types
# Optional extras:
pip install scitex-types[numpy,pandas]
pip install scitex-types[all]

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

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.

Four Freedoms for Research

  1. The freedom to run your research anywhere — your machine, your terms.
  2. The freedom to study how every step works — from raw data to final manuscript.
  3. The freedom to redistribute your workflows, not just your papers.
  4. 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).


SciTeX

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scitex_types-0.1.4.tar.gz (394.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scitex_types-0.1.4-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

File details

Details for the file scitex_types-0.1.4.tar.gz.

File metadata

  • Download URL: scitex_types-0.1.4.tar.gz
  • Upload date:
  • Size: 394.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for scitex_types-0.1.4.tar.gz
Algorithm Hash digest
SHA256 d5a4556f78a5ef8422b79fe4c4c699a3885aa7a7984a789fae1bd86e1b3d78fb
MD5 c30d9a12abba71098b390c4b7b51fd3b
BLAKE2b-256 b350e3772d72c211002e839f2ad764c199ddbcf9e28d787648faee836e38b0f4

See more details on using hashes here.

Provenance

The following attestation bundles were made for scitex_types-0.1.4.tar.gz:

Publisher: publish-pypi.yml on ywatanabe1989/scitex-types

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file scitex_types-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: scitex_types-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 20.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for scitex_types-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a9c466a3b838a73cefcccddb006813f30aee54b42da488fb11537afcd87c78d8
MD5 bef8b669a8abd38300a381c11714ac1b
BLAKE2b-256 b98c5940e4d6e7efbbb6df65dbfd1eba572867a415d5c72299cf7a2df00f5d38

See more details on using hashes here.

Provenance

The following attestation bundles were made for scitex_types-0.1.4-py3-none-any.whl:

Publisher: publish-pypi.yml on ywatanabe1989/scitex-types

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page