Registry / http-networking / zope-proxy

zope-proxy

JSON →
library7.2pypypiunverified

zope.proxy is a Python library providing generic, transparent proxies. It allows you to wrap an object with a proxy that delegates most operations to the underlying object, while still allowing for custom behavior or interception. The current version is 7.1, with releases typically tied to Python version support and bug fixes.

pip install zope-proxy
INSTALL
IMPORT
SIG · ZOPE-PROXY
Z
zope-proxy
http-networkingpythonv7.2
Install
1.9s avg
Import
Disk
18MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v7.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 20MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 1.9s · import 0.000s · 21MB
18MB installed
● package 18MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Proxy
from zope.proxy import Proxy
from zope.proxy import Proxy

This quickstart demonstrates how to create a transparent proxy for an object using `zope.proxy.Proxy`, interact with it, and retrieve the original object using `zope.proxy.getProxiedObject`. It also shows how `isinstance` works transparently.

from zope.proxy import Proxy, getProxiedObject class MyObject: def __init__(self, value): self.value = value def get_value(self): return self.value def __repr__(self): return f"<MyObject value={self.value}>" # Create an instance of MyObject obj = MyObject(42) print(f"Original object: {obj}") # Wrap it with a Proxy proxied_obj = Proxy(obj) print(f"Proxied object: {proxied_obj}") # Interact with the proxy - it behaves like the original object print(f"Value via proxy: {proxied_obj.value}") print(f"Method call via proxy: {proxied_obj.get_value()}") # Check if it's a proxy from zope.proxy import isproxy print(f"Is proxied_obj a proxy? {isproxy(proxied_obj)}") # Get the original object back from the proxy original_from_proxy = getProxiedObject(proxied_obj) print(f"Original object retrieved from proxy: {original_from_proxy}") assert original_from_proxy is obj # Demonstrate transparency for isinstance print(f"isinstance(proxied_obj, MyObject)? {isinstance(proxied_obj, MyObject)}")
Debug
Known issues
breakingMajor versions (5.x, 6.x, 7.x) of zope.proxy have progressively dropped support for older Python versions. Version 7.x (including 7.1) requires Python 3.10 or newer. Attempting to install or use it on older Python versions will fail.
fix
Ensure your project's Python environment is 3.10 or newer. For older Python versions, you may need to pin to an earlier zope.proxy version (e.g., 6.x for Python 3.7-3.9, 5.x for Python 3.6).
affects: 5.0.0, 6.0.0, 7.0.0 onwards
breakingStarting with version 5.0.0, the `zope.interface` dependency and its integration (like `zope.proxy.non_proxied` and automatic interface implementation) were removed. If your application relied on proxies automatically adapting to or implementing `zope.interface` definitions, this will break.
fix
Manually implement `zope.interface` concerns on your proxied objects or manage interface registration directly. Review code that assumed `zope.proxy` handled `zope.interface` aspects implicitly.
affects: 5.0.0 onwards
gotchaWhile `zope.proxy` aims for transparency, `type(proxied_object)` will return `<class 'zope.proxy.Proxy'>`, not the type of the underlying proxied object. Code that strictly checks `type()` for identity will not see the original object's type.
fix
Prefer `isinstance(proxied_object, OriginalClass)` for type checks, as `zope.proxy` typically handles this transparently. If you need the exact type of the original object, retrieve it first using `getProxiedObject(proxied_object)` and then call `type()` on the result.
affects: All versions
Upgrade
Version history
7.2latest on PyPI · released Apr 30, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
50 hits · last 30 days
node
39
OpenAI (training)
1
Resources
zope-proxy — pip install zope-proxy · libregistry