Skip to main content

aiwonderland.functools

My main Python functools toolset.

Additional functools in the spirit of the standard library's functools.

pip install -e . to install from a checkout. Python 3.10+. No runtime dependencies.

aiwonderland.functools

Decorator / factory What it does
once(func) run func at most once, cache the result
silent(default) catch Exception, return default
pipe(*funcs) left-to-right composition
pass_param(func, validator, fb) short-circuit on a sentinel first argument
memoize(func) cache results keyed by arguments
tap(side_effect=print) log calls; return value unchanged
print_yielded(func) print every value a generator yields
run_sync(coro_func) call an async def synchronously

See each callable's docstring for parameters, return type, and examples.

from aiwonderland.functools import memoize, pipe, run_sync

@memoize
def fib(n):
    return n if n < 2 else fib(n - 1) + fib(n - 2)

@run_sync
async def fetch_status():
    return "ok"

print(fib(50), pipe(lambda x: x * 2, lambda x: x + 1)(3), fetch_status())

License

MIT. See LICENSE.

Metadata

Release files for aiwonderland.functools 1.0.0

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

Source distribution (sdist)

Source distribution for aiwonderland.functools 1.0.0
File Size Uploaded Provenance
aiwonderland_functools-1.0.0.tar.gz 9.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for aiwonderland.functools 1.0.0
File Interpreter ABI Platform
aiwonderland_functools-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 16.5 kB

Release files / aiwonderland_functools-1.0.0.tar.gz

Download URL aiwonderland_functools-1.0.0.tar.gz
Size 9.5 kB
Tags Source
SHA-256 checksum
How to use checksums
1ab2207e07d9059b7b717705843163bdb24e828071cd44a3af76604252f528b3
BLAKE2b-256 checksum
How to use checksums
dbf3ed7f672ff5f9cfc2d0dadb3df617f70ed05d2494deae42bdb7933ae83eb3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / aiwonderland_functools-1.0.0-py3-none-any.whl

Download URL aiwonderland_functools-1.0.0-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8749bcb917f830f25f4b32f5ae1d2ad48105d57626dc615b5fb63db7095e797a
BLAKE2b-256 checksum
How to use checksums
c6191f3cacca8d6532224e8a961dc1f0d915689265b817e3d9612d74a448ba83
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Security for aiwonderland.functools 1.0.0

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.0 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