Registry / serialization / inspect2

inspect2

JSON →
library0.1.2pypypi✓ verified 84d ago

Backport of Python 3.6's inspect module to Python 2.7–3.5. Provides the signature() function and other inspection features missing in older Python versions. Current version 0.1.2, low activity.

pip install inspect2
INSTALL
IMPORT
SIG · INSPECT2
I
inspect2
serializationpythonv0.1.2
Install
1.5s avg
Import
21ms
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.1.2 · 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.022s · 18MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.5s · import 0.020s · 18MB
16MB installed
● package 16MB
Code
Verified usage

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

signature
from inspect2 import signature
from inspect import signature
Python <3.4 has no inspect.signature; use inspect2 for backport.

Use inspect2.signature to get callable signatures on Python 2.7–3.5.

from inspect2 import signature def foo(a, b=1): return a + b sig = signature(foo) print(sig.parameters['a'].default is None) print(sig.parameters['b'].default)
Debug
Known issues
deprecatedinspect2 is only needed for Python 2.7–3.5. Python 3.6+ natively includes inspect.signature; using inspect2 on Python 3.6+ may cause import conflicts.
fix
Use standard library 'inspect' on Python 3.6+.
affects: >=3.6
gotchainspect2 does not override the built-in inspect module. You must explicitly import from inspect2.
fix
Use 'from inspect2 import ...' instead of relying on inspect being patched.
affects: all
Errors
Common errors & fixes
ImportError: cannot import name 'signature' from 'inspect'
Python <3.4 has no inspect.signature, or Python 2.7's inspect does not have signature.
fix
Install inspect2 and use 'from inspect2 import signature'.
TypeError: signature() got an unexpected keyword argument 'follow_wrapped'
inspect2 version 0.1.2 does not support follow_wrapped parameter (Python 3.5+).
fix
Omit follow_wrapped or upgrade to Python 3.6+ to use inspect.signature.
Upgrade
Version history
0.1.2latest on PyPI · released Aug 10, 2019
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
inspect2 — pip install inspect2 · libregistry