Skip to main content

wrappy

Decorators for common developer utilities in Python 3.6+.

Documentation

Documentation is built with Mkdocs and hosted here.

Quick Examples (see the docs for more detail)

from wrappy import probe, guard, todo, memoize

@probe()
def do_some_heavy_computation(a, b, c):
    return a * b + c

@probe(show_args=True, show_kwargs=True, show_returns=True)
def someone_elses_code():
    # code that does not explain itself
    #
    # show examples of args, kwargs, and return values at runtime to get some clue

@probe(show_caller=5)
def a_call_chain_would_be_nice():
    # find out with show_caller=<number_of_callers_along_the_chain>

@guard(fallback_retval=0)
def this_could_blow_up(a, b):
    return a / b

@todo('Not implemented')
def i_am_not_ready():
    # code is under construction, so throw an error when called prematurely

@guard()
@memoize()
def recursive_or_dynamic_programming_subroutine(n):
    assert isinstance(n, int) and n >= 0
    if n == 0:
        return 0
    return n + recursive_or_dynamic_programming_subroutine(n-1)

Examples by Comparison

This section is under construction!

Release Notes

Metadata

Release files for wrappy 0.2.7

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

Source distribution (sdist)

Source distribution for wrappy 0.2.7
File Size Uploaded
wrappy-0.2.7.tar.gz 5.6 kB Details

Built distribution (wheel)

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

Total release size: 11.4 kB

Release files / wrappy-0.2.7.tar.gz

Download URL wrappy-0.2.7.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
afba2a4c6fc59b19425dd83ec6285984f2fbe5db105a2634a2cf12216844d5a6
BLAKE2b-256 checksum
How to use checksums
92f2378dbc506e0a74dd27d13ae8833e1e6fc89bc65ddd4982e0400a0927466b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.15

Release files / wrappy-0.2.7-py3-none-any.whl

Download URL wrappy-0.2.7-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1ba7545c91a9f49df899b588fa45815357f1d8fc8a140d85235514c1320ab401
BLAKE2b-256 checksum
How to use checksums
5627665a9337328efc85c3a832962e8666ae0ff7aaca41b621737fe6d8ae8ead
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.15

Release history Release notifications | RSS feed

This release

0.2.7 This release

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

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