ovld
Overloading Python functions
What it is and what it does
Ovld is a multiple dispatch library that lets you write separate function implementations for different type signatures, selected automatically at runtime based on argument types. Instead of writing nested isinstance checks or using Python's built-in singledispatch (which only works on the first argument), you annotate each version of your function with its type signature and ovld routes calls to the right implementation.
The library handles single and multiple arguments, supports value-based dispatch through Literal types and custom dependent types, and works with methods via metaclasses or base classes. It also provides variants (specialized copies of a function) and medleys (composable mixin-like classes), making it useful for recursive data structure traversal, serialization, and other polymorphic patterns.
Use it for:
- Implement recursive tree traversal or data structure operations that behave differently for lists, integers, and nested combinations.
- Build serialization/deserialization logic that handles different types with type-specific code paths.
- Create mathematical or scientific functions that dispatch on tensor shape, dtype, or other value-dependent properties.
- Define class methods that behave differently depending on argument types, replacing verbose isinstance chains.
- Compose reusable function variants that inherit base dispatch logic but override specific type handlers.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Ovld provides fast multiple dispatch for Python functions, allowing you to define separate implementations for different type signatures using type annotations instead of isinstance chains.
Yes. Ovld has no dependencies, installs cleanly, is actively maintained, carries an MIT license with no restrictions, and solves a real problem—writing cleaner polymorphic code than isinstance chains. It's suitable for production use if you need multiple dispatch.
Install
ovld on PyPI
pip
pip install ovlduv
uv add ovldpoetry
poetry add ovldInstalling ovld
Before you install
Low friction: pure Python wheel with no runtime dependencies. Actively maintained with last commit 2026-05-14.
License in practice
MIT license is permissive; you can use, modify, and distribute this package with minimal restrictions.
Quickstart
from ovld import ovld
@ovld
def f(x: str):
return f"string: {x}"
@ovld
def f(x: int):
return f"number: {x}"
print(f("hello"))
print(f(3))
Requires Python 3.9 or later.
Verify before relying
- Actual performance comparison data against other multiple dispatch libraries
- Whether value-based dispatch and dependent types work reliably in production at scale
- Compatibility with type checkers like mypy or pyright for dispatched functions
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 92 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 586,966/month — #5,878 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: ovld-0.5.17-py3-none-any.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
overloadingProvides function and method overloading based…
permissive · top 15,000 on PyPI
runtypeRuntype provides runtime type validation,…
permissive · top 15,000 on PyPI
multimethodMultimethod provides a decorator for adding…
permissive · top 5,000 on PyPI
multipledispatchEnables functions to dispatch on the types of…
permissive · top 5,000 on PyPI
plum-dispatchPlum implements multiple dispatch in Python,…
permissive · top 5,000 on PyPI
singledispatchProvides single-dispatch generic functions—a…
permissive · top 5,000 on PyPI
methoddispatchAdds single-dispatch method support to Python…
permissive · top 15,000 on PyPI
fasttransformfasttransform provides a Transform class for…
permissive · top 15,000 on PyPI
makefunDynamically creates Python functions at runtime…
permissive · top 5,000 on PyPI
codefindCodefind locates code objects by filename and…
unclear · top 15,000 on PyPI