makefun
Small library to dynamically create python functions.
What it is and what it does
makefun is a small library for programmatically creating Python functions with custom signatures at runtime. It solves the problem of generating wrapper functions and decorators without writing repetitive boilerplate code—useful when you need to preserve or modify function signatures dynamically, such as in testing frameworks, metaprogramming, or API wrappers.
The package depends only on funcsigs and is classified as Production/Stable. It supports Python 3.9 through 3.13 and is positioned as a developer tool for building other libraries and frameworks that need to generate functions on the fly.
Use it for:
- Creating decorators that preserve the original function's signature for better introspection and documentation.
- Building test fixtures or mocks that need to match the exact signature of functions they replace.
- Generating wrapper functions programmatically in metaprogramming or code generation scenarios.
- Building API client libraries that dynamically create methods matching remote service signatures.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Dynamically creates Python functions at runtime with custom signatures, enabling programmatic generation of wrapper functions and decorators without manual boilerplate.
Yes. The package is stable, has low install friction, carries no known vulnerabilities, and solves a specific metaprogramming need cleanly. Its single dependency and permissive license make it safe to include. The aging maintenance status (462 days since release) is not a blocker for a mature, focused library, but verify it meets your Python version and use-case requirements before adopting.
Install
makefun on PyPI
pip
pip install makefunuv
uv add makefunpoetry
poetry add makefunInstalling makefun
Before you install
Low friction install with a single lightweight dependency (funcsigs). Last release was recent (2025-05-09) and the repository remains active with a commit as recent as 2025-05-14, though the package is aging relative to its first release in 2019.
License in practice
BSD 3-Clause is permissive; you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
Quickstart
pip install makefun
from makefun import wraps
@wraps(original_function)
def wrapper(*args, **kwargs):
return original_function(*args, **kwargs)
Verify before relying
- Whether the package's aging status (462 days since last release) affects stability or feature completeness for current Python versions.
- Specific use cases where dynamic function generation is preferable to alternatives like functools.wraps or inspect-based approaches.
Package facts
| License | BSD 3-Clause (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — funcsigs |
| Maintenance | aging — 462 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 17,855,731/month — #1,101 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: makefun-1.16.0-py2.py3-none-any.whl
Keywords: decorate, decorator, compile, make, dynamic, function, generate, generation, define, definition, signature, args, wrapper, wraps
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
decopatchDecopatch simplifies writing decorators in…
permissive · top 5,000 on PyPI
wraptwrapt provides a Python module for building…
permissive · top 100 on PyPI
decoratorProvides utilities for writing function…
permissive · top 1,000 on PyPI
parameter-decoratorsProvides decorators that automatically convert…
copyleft · top 15,000 on PyPI
sigtoolsSigtools provides utilities to inspect and…
permissive · top 5,000 on PyPI
logfuryLogfury adds automatic method-call tracing to…
permissive · top 15,000 on PyPI
fastapi-decoratorsConverts functions into FastAPI-compatible…
permissive · top 15,000 on PyPI
gin-configGin provides a lightweight configuration…
permissive · top 15,000 on PyPI
undecoratedStrips decorators from Python functions,…
permissive · top 15,000 on PyPI
singleton-decoratorProvides a decorator that enforces singleton…
copyleft · top 15,000 on PyPI