tightwrap
A typed `functools.wraps`.
Decision gist · record as of 2026-08-14
Yes. If you write decorators or function wrappers and use a static type checker, this is a straightforward win: it fixes a real gap in `functools.wraps` with zero complexity, no security issues, active maintenance, and a permissive license. If you don't use type checking or don't write wrappers, you don't need it.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low friction: pure Python wheel with only `typing-extensions` as a runtime dependency.
- Actively maintained with recent releases supporting Python 3.13 and 3.14.
License · maintenance · safety
Apache2 (permissive) — Apache 2.0 (permissive): you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
last release 2026-03-04 (163 days)
0 known vulnerabilities (OSV.dev, 2026-08-14) · 90,943 downloads/mo, #13,554 on PyPI
Alternatives
Verify before relying
pip install tightwrap
from tightwrap import wraps
def original(a: int) -> int:
return a + 1
@wraps(original)
def wrapper(*args, **kwargs) -> int:
return original(*args, **kwargs)- Whether the package is suitable for all decorator patterns (e.g., class decorators, async functions, partial application).
- Performance characteristics compared to `functools.wraps` for high-frequency wrapping scenarios.
What it is and what it does
tightwrap is a minimal library that solves a specific typing problem: when you use `functools.wraps` to decorate a function, static type checkers like mypy lose the original function's signature and see only `*args, **kwargs`. This breaks type safety—a caller can pass the wrong types and the checker won't catch it. tightwrap.wraps has the same runtime behavior as `functools.wraps` but preserves the wrapped function's type signature for static analysis, so type checkers correctly report signature mismatches.
The package is intentionally small and has only one runtime dependency (`typing-extensions`). It applies `functools.wraps` under the hood to maintain runtime introspection compatibility, and it handles cases where the wrapper has a different return type than the wrapped function. Recent versions add support for wrapping methods and modern Python versions (3.13, 3.14).
Use it for
- Wrapping functions in decorators while maintaining type safety for static analysis.
- Building decorator libraries where callers should see the original function's signature in their IDE and type checker.
- Ensuring runtime function metadata (name, docstring, annotations) stays accurate while preserving type hints.
- Wrapping methods in classes with correct typing for both static checkers and runtime introspection.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
If you write decorators or function wrappers and use a static type checker, this is a straightforward win: it fixes a real gap in `functools.wraps` with zero complexity, no security issues, active maintenance, and a permissive license. If you don't use type checking or don't write wrappers, you don't need it.
Install
tightwrap on PyPI
Before you install
Low friction: pure Python wheel with only `typing-extensions` as a runtime dependency. Actively maintained with recent releases supporting Python 3.13 and 3.14.
License in practice
Apache 2.0 (permissive): you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
Quickstart
pip install tightwrap
from tightwrap import wraps
def original(a: int) -> int:
return a + 1
@wraps(original)
def wrapper(*args, **kwargs) -> int:
return original(*args, **kwargs)
Verify before relying
- Whether the package is suitable for all decorator patterns (e.g., class decorators, async functions, partial application).
- Performance characteristics compared to `functools.wraps` for high-frequency wrapping scenarios.
Package facts
| License | Apache2 permissive |
| Python support | Supports the current Python release >=3.8 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagetyping-extensions |
| Maintenance | Actively maintained 163 days since the last release |
| First released | |
| Downloads | 90,943 / month, #13,554 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Intended Audience :: DevelopersProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPythonTyping :: Typed |
Evidence: tightwrap-26.1.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “typed function wrapper”
- tightwrapA drop-in replacement for `functools.wraps` that preserves static…
- argdanticBuilds typed command-line interfaces by combining argparse with…
- wrapsProvides type-safe wrapper types for representing values that may be…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.
See also wraps · wrapt · decopatch · singleton-decorator · django-types · undecorated · singledispatch · types-decorator · joblib-stubs · mo-kwargs