{"id":2039,"library":"funcsigs","title":"Python Function Signatures (funcsigs)","description":"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.","status":"maintenance","version":"1.0.2","language":"en","source_language":"en","source_url":"https://github.com/aliles/funcsigs","tags":["function signatures","backport","inspect","python2 compatibility","python3 compatibility"],"install":[{"cmd":"pip install funcsigs","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"note":"The inspect module in Python 2.x and Python < 3.3 does not have `signature`. This is the core reason to use funcsigs.","wrong":"from inspect import signature","symbol":"signature","correct":"from funcsigs import signature"},{"symbol":"Signature","correct":"from funcsigs import Signature"},{"symbol":"Parameter","correct":"from funcsigs import Parameter"}],"quickstart":{"code":"from funcsigs import signature\n\ndef foo(a, b=None, *args, **kwargs):\n    pass\n\nsig = signature(foo)\nprint(f\"Signature: {sig}\")\nprint(f\"Parameters: {sig.parameters}\")\n\ndef bar(x: int, y: str = 'default') -> bool:\n    pass\n\nsig_bar = signature(bar)\nprint(f\"Signature (with annotations): {sig_bar}\")\nprint(f\"Return annotation: {sig_bar.return_annotation}\")","lang":"python","description":"This example demonstrates how to obtain a Signature object for a function, inspect its parameters, and access type annotations (where applicable)."},"warnings":[{"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\nexcept ImportError: from funcsigs import signature`.","message":"For 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.","severity":"gotcha","affected_versions":"Python 3.3+"},{"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.","message":"The `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`.","severity":"deprecated","affected_versions":"All versions of `funcsigs` (1.0.2 is the last release)"},{"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.","message":"Compatibility 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.","severity":"gotcha","affected_versions":"funcsigs 1.0.2 (and earlier) on Python 2.x and PyPy"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}