--- id: ovld version: "0.5.17" license: MIT license_treatment: permissive maintenance: active --- # ovld — Overloading Python functions License: permissive · Maintenance: active · Downloads: 587.0K/mo ## 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 above — 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 pip install ovld uv add ovld poetry add ovld ## Installing 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_current - Install friction: low - Maintenance: active - Downloads: 587.0K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags multiple dispatch python, function overloading by type, type-based method selection, runtime type dispatch, polymorphic function calls, overload resolution, dispatch on argument types, polymorphism, type-dispatch, function-overloading [View on SkillFed](https://skillfed.io/packages/ovld) · [View on PyPI](https://pypi.org/project/ovld/)