Python Function Signatures (funcsigs)

1.0.2 · maintenance · verified Thu Apr 09

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.

Warnings

Install

Imports

Quickstart

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}")

view raw JSON →