A fast and thorough lazy object proxy.
* Free software: BSD 2-Clause License
Note that this is based on `wrapt`_'s ObjectProxy with one big change: it
calls a function the first time the proxy object is
used, while `wrapt.ObjectProxy` just forwards the method calls to the
In other words, you use `lazy-object-proxy` when you only have the object
way later and you use `wrapt.ObjectProxy` when you
want to override few methods (by subclassing) and forward everything else
to the target object.
from time import sleep
# just as example for a very slow computation
# return the result of the calculation
obj = lazy_object_proxy.Proxy(expensive_func)
# function is called only when object is actually used
print(obj) # now expensive_func is called
print(obj) # the result without calling the expensive_func
pip install lazy-object-proxy
To run all the tests run::
This project is based on some code from `wrapt`_ as you can see in the git
.. _wrapt: https://github.com/GrahamDumpleton/wrapt
* Removed most of the Python 2 support code and fixed python_requires to
require at least Python 3.6.
Note that 1.7.0 has been yanked because it could not install on Python
Installing lazy-object-proxy on Python 2.7 should automatically fall back
to the 1.6.0 release now.
* Switched CI to GitHub Actions, this has a couple consequences:
* Support for Python 2.7 is dropped. You can still install it there but
it's not tested anymore and
Python 2 specific handling will be removed at some point.
* Linux wheels are now provided in `musllinux` and `manylinux2014`
* Fixed __index__ to fallback to int if the wrapped object doesn't have an
This prevents situations where code using a proxy would otherwise likely
just call int had the object
not have an __index__ method.
* Added support for async special methods (__aiter__, __anext__,
__await__, __aenter__, __aexit__).
Configuration Switches (platform-specific settings discarded)
PY310 OFF Build using Python 3.10
PY39 ON Build using Python 3.9
Package Dependencies by Type
Distribution File Information
d609c75b986def706743cdebe5e47553f4a5a1da9c5ff66d76013ef396b5a8a4 41995 lazy-object-proxy-1.7.1.tar.gz
Ports that require python-lazy-object-proxy:py39