Skip to main content
Change of provenance

The repository or configuration that created this release differ from a previous release. View details.

scitex-decorators

SciTeX

Decorator library — type conversion (numpy/torch/pandas/xarray), caching, batching, lifecycle.

Full Documentation · uv pip install scitex-decorators[all]

pypi python docs

tests install-check quality cov


Problem and Solution

# Problem Solution
1 Array-type plumbing — functions that should accept numpy / torch / pandas / xarray end up reimplementing isinstance dispatch + back-conversion every time. @numpy_fn, @torch_fn, @pandas_fn, @xarray_fn, @signal_fn convert inputs to the named type, run the wrapped function, and restore the caller's original type on the way out.
2 Expensive recomputations dominate dev cycles; ad-hoc pickle caches drift in invalidation and disk layout. @cache_disk (joblib) / @cache_disk_async / @cache_mem give SciTeX-aware disk + memory caching with a documented cache-dir resolution order (scitex.config → $SCITEX_CACHE_DIR → XDG → ~/.cache).
3 GPU / memory limits force researchers to hand-batch tensors, often re-deriving the loop per project. @batch_fn + @batch_numpy_fn / @batch_torch_fn / @batch_pandas_fn chunk inputs through the wrapped function and reassemble outputs; compose cleanly with the @*_fn converters.

Installation

pip install scitex-decorators              # core (numpy only)
pip install "scitex-decorators[caching]"   # + joblib for cache_disk
pip install "scitex-decorators[torch]"     # + torch_fn / batch_torch_fn
pip install "scitex-decorators[all]"       # everything

Architecture

flowchart LR
    AO["@auto_order"] --> CV["@*_fn converters"]
    CV --> NP["@numpy_fn"]
    CV --> PD["@pandas_fn"]
    CV --> XR["@xarray_fn"]
    CV --> TR["@torch_fn"]
    CV --> SG["@signal_fn"]
    BF["@batch_fn"] --> CV
    CD["@cache_disk<br/>(joblib)"] -.-> NP & PD & TR
    PD2["@preserve_doc"] -.-> NP & PD & TR & XR & SG
    DEP["@deprecated"] -.-> NP & PD & TR
    TO["@timeout"] -.-> CV
    NI["@not_implemented"] -.-> CV
    CO["@combined<br/>(stack of @*_fn)"] --> NP & PD & TR

Each @<type>_fn decorator converts inputs to the named type, calls the wrapped function, then converts back to the caller's original type. The diagram above shows how _combined.py, _auto_order.py, and the caching/timeout decorators compose around the converter family.

Quick Start

import scitex_decorators as dec

@dec.numpy_fn
def kernel(x):
    return x ** 2     # x is numpy inside; return matches caller's type

@dec.cache_disk
def expensive(x): ...

1 Interfaces

Python API
import scitex_decorators as dec

# Type-conversion decorators
@dec.numpy_fn  ; @dec.torch_fn  ; @dec.pandas_fn  ; @dec.xarray_fn
@dec.signal_fn

# Caching (joblib for disk, dict for mem)
@dec.cache_disk        ; @dec.cache_disk_async    ; @dec.cache_mem

# Batching
@dec.batch_fn          ; @dec.batch_numpy_fn / batch_torch_fn / batch_pandas_fn

# Lifecycle
@dec.deprecated(reason="…")
@dec.not_implemented
@dec.preserve_doc
@dec.timeout(seconds=10)
@dec.wrap

# Auto-ordering machinery
dec.enable_auto_order() ; dec.disable_auto_order()

# Conversion helpers
dec.to_numpy(x) ; dec.to_torch(x)
dec.is_torch(x) ; dec.is_cuda(x)

Cache directory resolution

cache_disk / cache_disk_async resolve the cache dir in this order:

  1. scitex.config.get_paths().function_cache (only if scitex is installed)
  2. ${SCITEX_CACHE_DIR}/function_cache
  3. ${XDG_CACHE_HOME}/scitex-decorators/function_cache
  4. ~/.cache/scitex-decorators/function_cache

So the package works without the umbrella scitex installed.

Demo

flowchart LR
    C["caller passes pandas.DataFrame"] --> D["@numpy_fn"]
    D --> N["function body sees numpy.ndarray"]
    N --> R["function returns numpy.ndarray"]
    R --> O["caller receives pandas.DataFrame<br/>(original type restored)"]

Status

Standalone fork of scitex.decorators. Zero scitex.* runtime deps. The umbrella package's scitex.decorators import path is preserved via a sys.modules-alias bridge.

Part of SciTeX

scitex-decorators is part of SciTeX. Install via the umbrella with pip install scitex[decorators] to use as scitex.decorators (Python) or scitex decorators ... (CLI).

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

Metadata

Release files for scitex-decorators 0.1.12

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Change of provenance

The repository or configuration that created these release files differ from that of a previous release.

We recommend inspecting the repository and configuration before proceeding. View details.

Source distribution (sdist)

Source distribution for scitex-decorators 0.1.12
File Size Uploaded Provenance
scitex_decorators-0.1.12.tar.gz 36.7 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for scitex-decorators 0.1.12
File Interpreter ABI Platform
scitex_decorators-0.1.12-py3-none-any.whl Python 3 none any Details

Total release size: 81.3 kB

Release files / scitex_decorators-0.1.12.tar.gz

Change of provenance

This file belongs to a release with changed provenance: the repository or configuration that created the release files differ from that of a previous release.

We recommend inspecting the repository and configuration before proceeding. View details.

Download URL scitex_decorators-0.1.12.tar.gz
Size 36.7 kB
Tags Source
SHA-256 checksum
How to use checksums
dd1632b55f1e2ae6da163ac0ab935a6b80192e04268e1a73b8b899f93ed1387e
BLAKE2b-256 checksum
How to use checksums
05c4d84d7179931916cc1969f361a2b460f9894fbc955d57a894a013ced05ed4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 25, 2026.

Transparency log

Release files / scitex_decorators-0.1.12-py3-none-any.whl

Change of provenance

This file belongs to a release with changed provenance: the repository or configuration that created the release files differ from that of a previous release.

We recommend inspecting the repository and configuration before proceeding. View details.

Download URL scitex_decorators-0.1.12-py3-none-any.whl
Size 44.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1f1b0f5308eb3605a9b663124de2576e922fb33312123dd1d11c6de0a2d030e2
BLAKE2b-256 checksum
How to use checksums
6579b1caf5bb16e169491458931da7bc5f05987b36a18ecfcf60f0e030a58899
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 25, 2026.

Transparency log

Security for scitex-decorators 0.1.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Change of provenance

The configuration that created this release differs from a previous release.

While this could reflect a routine change by the project maintainers, it may also indicate that the release files have been compromised.

Configuration

  • Removed 0.1.10 publish-pypi.yml
  • Added 0.1.12 pypi-publish-and-github-release-on-tag.yml
Select from 2 files

Attestation for scitex_decorators-0.1.12.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page