zope.hookable
Zope hookable
Decision gist · record as of 2026-08-14
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.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later.
- 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 · maintenance · safety
ZPL-2.1 (unclear) — 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.
last release 2025-11-18 (269 days) · last repo commit 2026-08-14 · 3 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,008,039 downloads/mo, #4,520 on PyPI
Alternatives
Verify before relying
from zope.hookable import hookable
@hookable
def my_function():
return "default"
my_function.sethook(lambda: "replaced")
print(my_function()) # prints "replaced"- 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.
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 on this page. Verify before relying on it.
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
zope-hookable on PyPI
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.
Requires Python 3.10 or later.
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"
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 the current Python release >=3.10 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 269 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,008,039 / month, #4,520 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableFramework :: Zope :: 3Intended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPy |
Evidence: zope_hookable-8.2-cp310-cp310-macosx_10_9_x86_64.whl; zope_hookable-8.2-cp310-cp310-macosx_11_0_arm64.whl; zope_hookable-8.2-cp310-cp310-manylinux1_i686.manylinux2014_i686.manylinux_2_17_i686.manylinux_2_5_i686.whl; zope_hookable-8.2-cp310-cp310-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl; zope_hookable-8.2-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; zope_hookable-8.2-cp310-cp310-win_amd64.whl; zope_hookable-8.2-cp311-cp311-macosx_10_9_x86_64.whl; zope_hookable-8.2-cp311-cp311-macosx_11_0_arm64.whl; zope_hookable-8.2-cp311-cp311-manylinux1_i686.manylinux2014_i686.manylinux_2_17_i686.manylinux_2_5_i686.whl; zope_hookable-8.2-cp311-cp311-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl; zope_hookable-8.2-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; zope_hookable-8.2-cp311-cp311-win_amd64.whl; zope_hookable-8.2-cp312-cp312-macosx_10_9_x86_64.whl; zope_hookable-8.2-cp312-cp312-macosx_11_0_arm64.whl; zope_hookable-8.2-cp312-cp312-manylinux1_i686.manylinux2014_i686.manylinux_2_17_i686.manylinux_2_5_i686.whl; zope_hookable-8.2-cp312-cp312-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl; zope_hookable-8.2-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; zope_hookable-8.2-cp312-cp312-win_amd64.whl; zope_hookable-8.2-cp313-cp313-macosx_10_9_x86_64.whl; zope_hookable-8.2-cp313-cp313-macosx_11_0_arm64.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 › “dynamic function replacement”
- zope.hookablezope.hookable provides a mechanism to create callable objects that…
- codefindCodefind locates code objects by filename and qualified name,…
- patchyPatchy modifies Python functions at runtime by replacing their code…
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 zope.annotation · zope.lifecycleevent · xmod · zope.component · zope.viewlet · zope.security · zope.ptresource · zope.configuration · zope.globalrequest · DocumentTemplate