--- id: zope-hookable version: "8.2" license: ZPL-2.1 license_treatment: unclear maintenance: active --- # zope.hookable — Zope hookable License: unclear · Maintenance: active · Downloads: 1.0M/mo ## What it is and what it does zope.hookable is a utility for creating callable objects that support dynamic replacement via a sethook method. When you decorate a function with @hookable or wrap it, all code that calls it—including code that imported it before the hook was set—will immediately see the replacement implementation. This pattern is useful in frameworks and plugin systems where you want to provide default behavior but allow later customization without requiring callers to be aware of the change. The package has no runtime dependencies and provides a thin, efficient layer over Python's callable protocol. It's part of the Zope ecosystem but can be used standalone. It supports Python 3.10 through 3.14 and both CPython and PyPy, with precompiled wheels available for common platforms. Use it for: - Framework authors providing default implementations that plugins can override without modifying call sites. - Testing scenarios where you need to inject mock or stub implementations into code that has already imported a function. - Loose coupling in event-driven systems where handlers can be swapped at runtime. - Configuration-driven behavior where the active implementation changes based on runtime state or settings. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. zope.hookable provides a mechanism to create callable objects that can be dynamically replaced at runtime, allowing all references to them to see the change immediately. Yes, if you need dynamic function replacement with global visibility. The package is stable, actively maintained, has no known vulnerabilities, and carries minimal overhead. The main caveat is verifying that ZPL-2.1 is compatible with your project's licensing model, and confirming that the license treatment uncertainty does not create compliance risk for your use case. ## Install pip install zope-hookable uv add zope-hookable poetry add zope-hookable ## Installing zope.hookable Before you install: Medium install friction due to compiled wheels for multiple Python versions and platforms. Package is actively maintained with recent releases and no known vulnerabilities. License in practice: Licensed under ZPL-2.1 (Zope Public License); license treatment is unclear, so review the actual license terms before use in proprietary or restricted contexts. Quickstart: from zope.hookable import hookable @hookable def my_function(): return "default" my_function.sethook(lambda: "replaced") print(my_function()) # prints "replaced" Requires Python 3.10 or later. Verify before relying: - Whether the ZPL-2.1 license is compatible with your project's licensing requirements. - Performance characteristics and overhead of the hookable mechanism compared to direct function calls. - Whether PyPy support is actively tested or only nominally declared. ## Package facts - License: ZPL-2.1 (unclear) - Python support: supports_current - Install friction: medium - Maintenance: active - Downloads: 1.0M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags dynamic function replacement, runtime hook mechanism, callable replacement pattern, loose coupling callbacks, zope hookable objects, plugin-pattern, runtime-replacement [View on SkillFed](https://skillfed.io/packages/zope-hookable) · [View on PyPI](https://pypi.org/project/zope-hookable/)