skillfed

zope.proxy

Generic Transparent Proxies

zope-proxy v7.2 396.1K downloads/30d#6,975 on PyPI6
License unclear ZPL-2.1 Active released

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-proxy

uv

uv add zope-proxy

poetry

poetry add zope-proxy

Installing 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

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

Tags

transparent object wrapperproxy pattern implementationaccess control via proxiesobject interception layergeneric proxy objectszope proxy wrapperattribute access control
proxy-patternaccess-controlzope-ecosystem

More Software Development packages