Registry / testing / undecorated

undecorated

JSON →
library0.3.0pypypi✓ verified 82d ago

A library to undecorate Python functions, methods, or classes, returning the original callable before any decorators were applied. Version 0.3.0 is the latest; the project is in maintenance mode with no recent releases.

pip install undecorated
INSTALL
IMPORT
SIG · UNDECORATED
U
undecorated
testingpythonv0.3.0
Install
1.5s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.3.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.5s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

undecorated
from undecorated import undecorated
from undecorated import undecorate

Basic usage: undecorate a decorated function to get the original.

from undecorated import undecorate def decorator(func): def wrapper(*args, **kwargs): return func(*args, **kwargs) return wrapper @decorator def foo(): return 'foo' print(foo()) # calls wrapper print(undecorate(foo)) # returns original function print(undecorate(foo)()) # 'foo'
Debug
Known issues
gotchaundecorate() works by inspecting closure cells, which may fail for complex decorators (e.g., functools.lru_cache, class-based decorators, or decorators that return a different type).
fix
Check the result; if the original function isn't found, consider alternative approaches like storing the original manually.
affects: >=0.1.0
gotchaApplying undecorate to an already undecorated function returns the same function; it does not error. This can mask misuses.
fix
Verify the function is actually decorated before undecorating to avoid logic errors.
affects: >=0.1.0
gotchaDoes not support Python 3.12+ if decorators use new closure behavior or PEP 695 (type parameter syntax) changes. The package has not been updated for recent CPython internals.
fix
Test on your Python version; if it fails, consider forking or using an alternative library.
affects: >=0.3.0
Upgrade
Version history
0.3.0latest on PyPI · released Mar 18, 2017
Audit
Dependencies

No dependency data recorded yet.

Agent activity
9 hits · last 30 days
node
8
Resources
undecorated — pip install undecorated · libregistry