Skip to main content

A lightweight and modular Python decorator library

Reason this release was yanked:

Upload bug

Project description

pydeco ๐Ÿงฉ

A lightweight and modular Python decorator library that helps you write cleaner and more expressive code.

๐Ÿš€ Features

  • ๐Ÿง  @cache: Simple in-memory caching with optional TTL and size limit
  • ๐Ÿ” @retry: Automatically retry failed operations with exponential backoff
  • ๐Ÿ›‘ @suppress: Suppress exceptions and optionally log them
  • โฑ๏ธ @timeit: Time execution of functions
  • ๐Ÿงช @validate_args: Enforce argument types using runtime validation

๐Ÿ“ฆ Installation

pip install pydeco

๐Ÿง‘โ€๐Ÿ’ป Usage

from pydeco import cache, retry

@cache(ttl=60)
def slow_func(x):
    return x * x

@retry(times=3, delay=1)
def flaky_api_call():
    ...

๐Ÿ“ Project Structure

pydeco-main/
โ”œโ”€โ”€ pydeco/
โ”‚ โ”œโ”€โ”€ init.py
โ”‚ โ””โ”€โ”€ decorators/
โ”‚ โ”œโ”€โ”€ cache.py
โ”‚ โ”œโ”€โ”€ retry.py
โ”‚ โ”œโ”€โ”€ suppress.py
โ”‚ โ”œโ”€โ”€ timeit.py
โ”‚ โ””โ”€โ”€ validate_args.py
โ”œโ”€โ”€ tests/
โ”‚ โ”œโ”€โ”€ test_cache.py
โ”‚ โ”œโ”€โ”€ test_retry.py
โ”‚ โ”œโ”€โ”€ test_suppress.py
โ”‚ โ”œโ”€โ”€ test_timeit.py
โ”‚ โ””โ”€โ”€ test_validate_args.py
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ LICENSE
โ”œโ”€โ”€ setup.py
โ””โ”€โ”€ pyproject.toml

๐Ÿงช Running Tests

pytest pydeco/tests

๐Ÿค Contributing

Pull requests and ideas welcome! Please open an issue or fork and PR.

๐Ÿ“„ License

MIT โ€” 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

pydecora-1.0.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

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

pydecora-1.0.0-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file pydecora-1.0.0.tar.gz.

File metadata

  • Download URL: pydecora-1.0.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for pydecora-1.0.0.tar.gz
Algorithm Hash digest
SHA256 7959eed54c893a0cb14046e572c418cd6142e86fcd9fb05e13cf92d2631a042d
MD5 8b9731be859a5db17ed75fbb8af8f6ab
BLAKE2b-256 6de503d44ceffde36b3b6e08f9e807dc07741802741e6722c02ea1dad8045930

See more details on using hashes here.

File details

Details for the file pydecora-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pydecora-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for pydecora-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1a36f35a5d5e8ad53010258e201f33a56700f493e64cd4bb05d1acdf0fd10958
MD5 09461a38e9a8a905bf51ca85e8e3ca3e
BLAKE2b-256 fb1a30bfffb9a066c280d175db54f7ea7cd08db9c166369f4d1ee4236d9b471f

See more details on using hashes here.

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