skillfed

makefun

Small library to dynamically create python functions.

makefun v1.16.0 17.9M downloads/30d#1,101 on PyPI135
Permissive license BSD 3-Clause AGING released

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 makefun

uv

uv add makefun

poetry

poetry add makefun

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python Modules

Tags

dynamic function generationcreate functions at runtimeprogrammatic function signaturesdecorator wrapper generationfunction factory library
metaprogrammingfunction-generationdecorator-tools

More Python Modules packages