Skip to main content

pydecorx

A collection of production-ready Python decorators and generators

pydecorx provides a set of modular, reusable utilities to simplify common Python patterns like logging, retrying, caching, type validation, and file/data stream processing.


📦 Features

✅ Decorators

  • log_execution – Log function calls, arguments, return values, and execution time
  • retry_on_exception – Retry failed function calls with configurable delay
  • cache_result – In-memory caching with TTL support
  • time_execution – Log how long a function takes to run
  • once – Ensure a function runs only once
  • memoize – Simple caching without TTL
  • benchmark – Warn if a function exceeds an execution threshold
  • deprecated – Emit deprecation warnings
  • suppress_exceptions – Gracefully handle and suppress specified exceptions
  • rate_limiter – Limit how often a function can be called
  • validate_types – Enforce type hints at runtime
  • async_safe – Make sync functions awaitable in async code

🔁 Generators

  • fibonacci – Infinite Fibonacci number stream
  • file_chunker – Read large files in fixed-size chunks
  • tail_reader – Mimics tail -f for real-time file streaming
  • sliding_window – Yields fixed-size windows over iterables
  • paginated_api_reader – Read items from paginated APIs
  • batched_iterable – Yield batches of items from iterables
  • directory_watcher – Yield new filenames as they appear in a directory
  • csv_row_reader – Stream rows from large CSV files

🔧 Installation

pip install pydecorx

Or from source (editable):

git clone https://github.com/manas-shinde/python-decorators-generators.git
cd python-decorators-generators
pip install -e .

🚀 Usage Example

from decorators.retry_decorator import retry_on_exception

@retry_on_exception(retries=3, delay=1)
def fetch_data():
    # some flaky operation
    pass
from generators.batched_iterable import batched_iterable

for batch in batched_iterable(range(10), batch_size=3):
    print(batch)

🧪 Testing

Install test dependencies and run tests:

pip install -r requirements.txt
pytest tests/

📚 License

MIT License

Source: GitHub Repository

PyPI: https://pypi.org/project/pydecorx

Metadata

Release files for pydecorx 1.0.1

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

Source distribution (sdist)

Source distribution for pydecorx 1.0.1
File Size Uploaded Provenance Actions
pydecorx-1.0.1.tar.gz 11.1 kB Without provenance Details for pydecorx-1.0.1.tar.gz

Built distribution (wheel)

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

Total release size: 23.3 kB

Release files / pydecorx-1.0.1.tar.gz

Download URL pydecorx-1.0.1.tar.gz
Size 11.1 kB
Tags Source
SHA-256 checksum
How to use checksums
cde1344ab07edd9ced65a2d730d0b64225be333c7e1e3664392879995e2339d9
BLAKE2b-256 checksum
How to use checksums
3a2df0785e8cd1f303dde54d6c0b0fabe7db28555d234afa3eb84b482b1ee8e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release files / pydecorx-1.0.1-py3-none-any.whl

Download URL pydecorx-1.0.1-py3-none-any.whl
Size 12.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
954a4bfc0b8773866d80c2c45dc2a001dd1c9b092233b51f650ffbf462b858c0
BLAKE2b-256 checksum
How to use checksums
6f2bf61af4c524167ed5b84d4bb4c13a344650880092c0f2403f877bee5750f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Security for pydecorx 1.0.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files No provenance

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