zope.proxy
Generic Transparent Proxies
What it is and what it does
zope.proxy is a generic proxy wrapper library that lets you wrap Python objects to intercept and control their behavior. It's implemented primarily as a C extension, which allows it to do things difficult or impossible in pure Python—like lie about an object's __class__ and proxy all internal slots (__int__, __str__, __add__, etc.). The package also includes a pure-Python fallback for environments like PyPy where the C extension cannot be built.
The main use case is implementing policies like access checking, location brokering, or other cross-cutting concerns by wrapping objects transparently. When code accesses the wrapped object, the proxy intercepts the operation and applies the policy before delegating to the real object. The wrapper is designed to be mostly invisible to the caller—it proxies nearly all operations and attributes of the wrapped object, making it suitable for frameworks like Zope that need fine-grained control over object access without rewriting application code.
Use it for:
- Implementing role-based access control by wrapping objects and checking permissions on attribute access.
- Building location-aware object hierarchies where proxies track the container context of wrapped objects.
- Creating security layers in web frameworks that need to restrict what code can access on sensitive objects.
- Wrapping third-party objects to add logging, caching, or other cross-cutting behavior without modifying the original class.
- Enforcing immutability or read-only views of objects by proxying and blocking write operations.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
zope.proxy provides transparent wrapper objects that intercept and control access to wrapped objects, implemented as a C extension for performance and to support advanced features like lying about __class__.
Yes, if you need transparent object wrapping with full attribute and method proxying. The C extension provides performance and capabilities (like __class__ manipulation) that pure Python cannot match. Install friction is moderate due to compilation, but prebuilt wheels cover most platforms. No known vulnerabilities, actively maintained, and ZPL-2.1 license is permissive. Best suited for framework or library developers; less relevant for typical application code unless you specifically need proxy-based access control.
Install
zope-proxy on PyPI
pip
pip install zope-proxyuv
uv add zope-proxypoetry
poetry add zope-proxyInstalling zope.proxy
Before you install
Medium install friction due to C extension compilation, but prebuilt wheels are available for common platforms (macOS, Linux, Windows on x86_64 and ARM64). Package is actively maintained with recent release on 2026-04-30.
License in practice
Licensed under ZPL-2.1 (Zope Public License 2.1), which is a permissive open-source license similar to the Apache License. No notable restrictions for typical use.
Quickstart
pip install zope.proxy
from zope.proxy import ProxyBase
from zope.interface import Interface, implementer
class MyClass:
def method(self):
return "original"
obj = MyClass()
proxied = ProxyBase(obj)
print(proxied.method())
Requires Python 3.10 or later; C extension requires a C compiler and development headers unless prebuilt wheels are used.
Verify before relying
- Whether the C extension provides measurable performance benefits over pure Python for typical use cases.
- What specific access-control policies are commonly implemented with zope.proxy in production systems.
Package facts
| License | ZPL-2.1 (unclear) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 1 — zope.interface |
| Maintenance | actively maintained — 106 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 396,081/month — #6,975 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: zope_proxy-7.2-cp310-cp310-macosx_10_9_x86_64.whl; zope_proxy-7.2-cp310-cp310-macosx_11_0_arm64.whl; zope_proxy-7.2-cp310-cp310-manylinux1_i686.manylinux2014_i686.manylinux_2_17_i686.manylinux_2_5_i686.whl; zope_proxy-7.2-cp310-cp310-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl; zope_proxy-7.2-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; zope_proxy-7.2-cp310-cp310-win_amd64.whl; zope_proxy-7.2-cp311-cp311-macosx_10_9_x86_64.whl; zope_proxy-7.2-cp311-cp311-macosx_11_0_arm64.whl; zope_proxy-7.2-cp311-cp311-manylinux1_i686.manylinux2014_i686.manylinux_2_17_i686.manylinux_2_5_i686.whl; zope_proxy-7.2-cp311-cp311-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl; zope_proxy-7.2-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; zope_proxy-7.2-cp311-cp311-win_amd64.whl; zope_proxy-7.2-cp311-cp311-win_arm64.whl; zope_proxy-7.2-cp312-cp312-macosx_10_9_x86_64.whl; zope_proxy-7.2-cp312-cp312-macosx_11_0_arm64.whl; zope_proxy-7.2-cp312-cp312-manylinux1_i686.manylinux2014_i686.manylinux_2_17_i686.manylinux_2_5_i686.whl; zope_proxy-7.2-cp312-cp312-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl; zope_proxy-7.2-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; zope_proxy-7.2-cp312-cp312-win_amd64.whl; zope_proxy-7.2-cp312-cp312-win_arm64.whl
Keywords: zope, proxy, generic, transparent
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
AccessControlAccessControl provides a security framework for…
unclear · top 15,000 on PyPI
proxyprovidersProvides a unified Python interface for…
permissive · top 15,000 on PyPI
zope.securityProvides a generic security framework for…
unclear · top 15,000 on PyPI
zope.containerProvides container interfaces and…
unclear · top 15,000 on PyPI
zope.globalrequestProvides a function to retrieve the currently…
unclear · top 15,000 on PyPI
zope.componentImplements the core Zope Component Architecture…
unclear · top 5,000 on PyPI
MultiMappingMultiMapping provides special mapping objects…
unclear · top 15,000 on PyPI
zope.interfaceProvides a Python implementation of object…
unclear · top 1,000 on PyPI
zope.exceptionsProvides general-purpose exception classes and…
unclear · top 15,000 on PyPI
zope.locationProvides a structural location system for Zope…
unclear · top 15,000 on PyPI