Skip to main content

Decorator library: numpy_fn/torch_fn/pandas_fn/xarray_fn/signal_fn type converters, caching, batching, deprecation — standalone module from the SciTeX ecosystem

Project description

scitex-decorators

PyPI Python Tests Install Test Coverage Docs License: AGPL v3

Decorator library extracted from the SciTeX ecosystem as a standalone package.

Install

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

API

import scitex_decorators as dec

# Type-conversion decorators (cast args before calling, restore after)
@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

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

# Auto-ordering machinery (advanced)
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) ; dec.is_nested_decorator(...)

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.

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.

License

AGPL-3.0-only (see LICENSE).

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_decorators-0.1.5.tar.gz (32.4 kB view details)

Uploaded Source

Built Distribution

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

scitex_decorators-0.1.5-py3-none-any.whl (40.0 kB view details)

Uploaded Python 3

File details

Details for the file scitex_decorators-0.1.5.tar.gz.

File metadata

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

File hashes

Hashes for scitex_decorators-0.1.5.tar.gz
Algorithm Hash digest
SHA256 e0ad60823c95462728c298d99c1d070880eeeebf65443ff1fb6e1cb8ac8a2a38
MD5 e4ec05bc2ded02080dce28a58d209bce
BLAKE2b-256 5bbc9890555da727a525412d09ba05afc8f5d1345a71d9c79acebd7d6a4c1a9b

See more details on using hashes here.

Provenance

The following attestation bundles were made for scitex_decorators-0.1.5.tar.gz:

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

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_decorators-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for scitex_decorators-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 8c6d15833f2c57096c9981128e900e1bd3488a4cd5d365b754ee7b3781dfa46b
MD5 d9d4cd75ca9bbbde1d27621b05b23ff3
BLAKE2b-256 d0338fb3f92a5d0aadab6c5d23270e0e255b69739cffc69c57205b84e0a1b36c

See more details on using hashes here.

Provenance

The following attestation bundles were made for scitex_decorators-0.1.5-py3-none-any.whl:

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

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