Install & Compatibility
Where this runs
tested against v1.0.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
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.9MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 1.6s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
signature
✓ from funcsigs import signature
✗ from inspect import signature
The inspect module in Python 2.x and Python < 3.3 does not have `signature`. This is the core reason to use funcsigs.
Signature
✓ from funcsigs import Signature
Parameter
✓ from funcsigs import Parameter
This example demonstrates how to obtain a Signature object for a function, inspect its parameters, and access type annotations (where applicable).
from funcsigs import signature
def foo(a, b=None, *args, **kwargs):
pass
sig = signature(foo)
print(f"Signature: {sig}")
print(f"Parameters: {sig.parameters}")
def bar(x: int, y: str = 'default') -> bool:
pass
sig_bar = signature(bar)
print(f"Signature (with annotations): {sig_bar}")
print(f"Return annotation: {sig_bar.return_annotation}")
Debug
Known issues
gotchaFor Python 3.3 and newer, the built-in `inspect.signature` should be used instead of `funcsigs.signature`. Relying on `funcsigs` in newer Python versions is unnecessary and can introduce compatibility issues if the native `inspect` module's behavior changes or if `funcsigs` is not installed.fixUse `from inspect import signature` instead of `from funcsigs import signature` when targeting Python 3.3 or newer. For projects needing broad compatibility, consider a conditional import: `try: from inspect import signature
except ImportError: from funcsigs import signature`.
affects: Python 3.3+
deprecatedThe `funcsigs` library is no longer actively maintained since its functionality has been integrated into the Python standard library's `inspect` module (from Python 3.3 onwards). While functional for its intended older Python versions, new development should prefer `inspect.signature`.fixMigrate to `inspect.signature` for Python 3.3+ projects. For projects requiring Python 2.x or 3.2 compatibility, `funcsigs` remains a valid option, but be aware of its unmaintained status.
affects: All versions of `funcsigs` (1.0.2 is the last release)
gotchaCompatibility quirks exist in specific environments: in Python 2.x, issues can arise when a function is assigned to a class's `__wrapped__` property after construction. Under PyPy, directly passing the `__call__` method of a builtin can also cause compatibility problems.fixBe aware of these specific edge cases when using `funcsigs` in Python 2.x or PyPy, and test thoroughly. Avoid directly manipulating `__wrapped__` on classes or passing `__call__` of builtins directly if issues are encountered.
affects: funcsigs 1.0.2 (and earlier) on Python 2.x and PyPy
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'funcsigs'
The 'funcsigs' library is not installed in the current Python environment or the Python version being used is too old for 'ModuleNotFoundError' and would raise 'ImportError'.
fixInstall the library using pip: `pip install funcsigs`
ImportError: No module named funcsigs
The 'funcsigs' library is not installed in the current Python environment, commonly encountered in Python 2.x or older Python 3.x installations.
fixInstall the library using pip: `pip install funcsigs`
ImportError: cannot import name signature
This error often occurs in Python 2.x environments when attempting to import 'signature' directly from the standard 'inspect' module, which did not include this function until Python 3.3. 'funcsigs' provides this functionality as a backport for older Python versions.
fixInstall the 'funcsigs' library (`pip install funcsigs`) and then import `signature` from it: `from funcsigs import signature`
Upgrade
Version history
1.0.2latest on PyPI · released Apr 25, 2016
Audit
Dependencies
No dependency data recorded yet.