Skip to main content

shutilspy

Python utilities including DAG task framework, caching, rate limiting, RW locks, and parameter helpers.

Features

  • DAG Framework - Build and execute directed acyclic graph workflows with sync/async tasks, routing, streaming, and service tasks
  • Caching - TTL and LRU caches with persistent storage (lzma+pickle), auto-save by step/interval, and decorator support
  • Rate Limiting - Token-bucket, QPS, and concurrency limiters with sync/async support and decorator
  • RW Locks - Read-write locks for both sync (RWLock) and async (AsyncRWLock) code
  • Smart Lock - Adaptive lock (SmartLock, SmartRWLock) with automatic strategy selection based on operation duration
  • Parameter Helpers - Dataclass utilities for serialization (asdict, asjson), deserialization (dict_to_dataclass), and hidden fields (Hide/HIDE)
  • Image Size - Get image dimensions from binary headers without full decoding (GIF, PNG, JPEG, TIFF, SVG, WebP)

Installation

pip

# without DAG visualizer
pip install shutilspy

# with DAG visualizer
pip install shutilspy[visualizer]

conda

# without DAG visualizer
conda install shlllshlll::shutilspy
# with DAG visualizer
conda install shlllshlll::shutilspy-visualizer

Optional dependencies

pip install shutilspy[visualizer]  # Flask-based DAG visualization

Quick Examples

Singleton

from shutils import singleton

@singleton
class MyClass:
    pass

assert MyClass() is MyClass()

Caching

from shutils import cached

@cached(backend="ttl", ttl=300)
def expensive(x):
    return x * 2

DAG Pipeline

from shutils.dag import DAG, AsyncFunctionTask, Executor

dag = DAG()

async def step_a(ctx):
    ctx.context.sync_white_board["a"] = "done"
    return ctx

async def step_b(ctx):
    val = ctx.context.sync_white_board.get("a")
    ctx.context.sync_white_board["b"] = f"{val}_processed"
    return ctx

dag.add_task(AsyncFunctionTask(step_a, name="A"))
dag.add_task(AsyncFunctionTask(step_b, name="B"), [task_a])
dag.build()

results = await Executor(dag).run()

Rate Limiting

from shutils import limiter

@limiter(calls=10, period=1)
def api_call():
    return "response"

Documentation

Full documentation is available at the docs.

Development

pixi install
pixi run test      # Run tests with coverage
pixi run lint      # Run ruff linter
pixi run format    # Run ruff formatter
pixi run docs-serve  # Start docs server

License

MIT

Metadata

Release files for shutilspy 0.1.2

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

Built distribution (wheel)

Table of built distributions (wheels) for shutilspy 0.1.2
File Interpreter ABI Platform
shutilspy-0.1.2-py3-none-any.whl Python 3 none any Details

Release files / shutilspy-0.1.2-py3-none-any.whl

Download URL shutilspy-0.1.2-py3-none-any.whl
Size 66.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6b4aca265db1c05ff295c069f6a8bb13fc62dfa0452a4c8c0f60ab5ecf872237
BLAKE2b-256 checksum
How to use checksums
23425f020fd0dc60991b4eb60305fc58af1c0e9f63f81f068b0d8fd717eec0aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 13, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.2 This release

1 release file

0.1.1

1 release file

0.1.0

1 release file

0.0.11

2 release files

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