Registry / testing / funcsigs

funcsigs

JSON →
library1.0.2pypypi✓ verified 25d ago

funcsigs is a Python library that backports the function signature introspection features from Python 3.3's `inspect` module (PEP 362) to older Python versions. It allows developers to work with `Signature` and `Parameter` objects to understand callable arguments and return annotations, even in Python 2.6, 2.7, and 3.2+. Its latest version, 1.0.2, was released in April 2016, marking it as a mature and largely unmaintained project, as its core functionality has been integrated into Python's standard library for modern versions.

pip install funcsigs
INSTALL
IMPORT
SIG · FUNCSIGS
F
funcsigs
testingpythonv1.0.2
Install
1.6s 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 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
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.9MB
glibc
py 3.103.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.
fix
Use `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`.
fix
Migrate 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.
fix
Be 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'.
fix
Install 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.
fix
Install 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.
fix
Install 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.

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