A fast and thorough lazy object proxy.
Project description
A fast and thorough lazy object proxy.
Free software: BSD 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 target object.
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.
Example:
import lazy_object_proxy
def expensive_func():
from time import sleep
print('starting calculation')
# just as example for a very slow computation
sleep(2)
print('finished calculation')
# return the result of the calculation
return 10
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
Installation
pip install lazy-object-proxy
Documentation
Development
To run the all tests run:
tox
Acknowledgements
This project is based on some code from wrapt as you can see in the git history.
Changelog
1.4.1 (2019-05-10)
Fixed wheels being built with -coverage cflags. No more issues about bogus cext.gcda files.
Removed useless C file from wheels.
Changed setup.py to use setuptools-scm.
1.4.0 (2019-05-05)
1.3.1 (2017-05-05)
Fix broken release (sdist had a broken MANIFEST.in).
1.3.0 (2017-05-02)
Speed up arithmetic operations involving cext.Proxy subclasses.
1.2.2 (2016-04-14)
Added manylinux wheels.
Minor cleanup in readme.
1.2.1 (2015-08-18)
Fix a memory leak (the wrapped object would get bogus references). Contributed by Astrum Kuo in #10.
1.2.0 (2015-07-06)
Don’t instantiate the object when __repr__ is called. This aids with debugging (allows one to see exactly in what state the proxy is).
1.1.0 (2015-07-05)
Added support for pickling. The pickled value is going to be the wrapped object without any Proxy container.
Fixed a memory management issue in the C extension (reference cycles weren’t garbage collected due to improper handling in the C extension). Contributed by Alvin Chow in #8.
1.0.2 (2015-04-11)
First release on PyPI.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lazy-object-proxy-1.4.2.tar.gz.
File metadata
- Download URL: lazy-object-proxy-1.4.2.tar.gz
- Upload date:
- Size: 34.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd135b8d35dfdcdb984828c84d695937e58cc5f49e1c854eb311c4d6aa03f4f1
|
|
| MD5 |
5890e9b922f9b76e85edf1f7239fdab5
|
|
| BLAKE2b-256 |
3639d9b7d05775c3d12fe49c1119f53e20adf81757bfd3840f30961a0d57e6d1
|
File details
Details for the file lazy_object_proxy-1.4.2-cp37-cp37m-win_amd64.whl.
File metadata
- Download URL: lazy_object_proxy-1.4.2-cp37-cp37m-win_amd64.whl
- Upload date:
- Size: 20.7 kB
- Tags: CPython 3.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
84742532d39f72df959d237912344d8a1764c2d03fe58beba96a87bfa11a76d8
|
|
| MD5 |
7da8f5b7f57ba96167c540e09ad31f43
|
|
| BLAKE2b-256 |
01b0467ad69cd8adfe2be737cf69b69c5809c7098a7aa337adda2542b7259bc0
|
File details
Details for the file lazy_object_proxy-1.4.2-cp37-cp37m-win32.whl.
File metadata
- Download URL: lazy_object_proxy-1.4.2-cp37-cp37m-win32.whl
- Upload date:
- Size: 18.4 kB
- Tags: CPython 3.7m, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4a2b782b8a8c5522ad35c93e04d60e2ba7f7dcb9271ec8e8c3e08239be6c7b4
|
|
| MD5 |
867c7fd9b075c47fb533d8e08439a5dc
|
|
| BLAKE2b-256 |
ecec88fbb82752c22d28e3437b4bbe4619949d900a813d3afd4da4e68cc6dc2e
|
File details
Details for the file lazy_object_proxy-1.4.2-cp37-cp37m-manylinux1_x86_64.whl.
File metadata
- Download URL: lazy_object_proxy-1.4.2-cp37-cp37m-manylinux1_x86_64.whl
- Upload date:
- Size: 49.8 kB
- Tags: CPython 3.7m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
874ebf3caaf55a020aeb08acead813baf5a305927a71ce88c9377970fe7ad3c2
|
|
| MD5 |
3775f0dae78ac7ef4c185b3fb6d7a8f3
|
|
| BLAKE2b-256 |
11a098687a75455408ce1b222b46ef66062b5af422c3f7451f080663ba68b5df
|
File details
Details for the file lazy_object_proxy-1.4.2-cp37-cp37m-macosx_10_13_x86_64.whl.
File metadata
- Download URL: lazy_object_proxy-1.4.2-cp37-cp37m-macosx_10_13_x86_64.whl
- Upload date:
- Size: 18.9 kB
- Tags: CPython 3.7m, macOS 10.13+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f5caf2c7436d44f3cec97c2fa7791f8a675170badbfa86e1992ca1b84c37009
|
|
| MD5 |
c2bfb964e197653dcf0e2eedeaa54231
|
|
| BLAKE2b-256 |
b01933c3546fd031d47086c6a66c36cf0d768c78f4428a77856780d57600d4c9
|
File details
Details for the file lazy_object_proxy-1.4.2-cp36-cp36m-win_amd64.whl.
File metadata
- Download URL: lazy_object_proxy-1.4.2-cp36-cp36m-win_amd64.whl
- Upload date:
- Size: 20.7 kB
- Tags: CPython 3.6m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18f9c401083a4ba6e162355873f906315332ea7035803d0fd8166051e3d402e3
|
|
| MD5 |
f564954b2794ba036a57c6e8bed1814d
|
|
| BLAKE2b-256 |
f027bac679deed17fe2114eeae614e0abb9e5c88b34d41ec0fbeb320997312fb
|
File details
Details for the file lazy_object_proxy-1.4.2-cp36-cp36m-win32.whl.
File metadata
- Download URL: lazy_object_proxy-1.4.2-cp36-cp36m-win32.whl
- Upload date:
- Size: 18.4 kB
- Tags: CPython 3.6m, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
77b454f03860b844f758c5d5c6e5f18d27de899a3db367f4af06bec2e6013a8e
|
|
| MD5 |
192c49f2d01392cb0864e63a29e341a1
|
|
| BLAKE2b-256 |
8196616cc34b7823e38739db67cfe2bdf170c08a5782d2dc02967aa4bd634567
|
File details
Details for the file lazy_object_proxy-1.4.2-cp36-cp36m-manylinux1_x86_64.whl.
File metadata
- Download URL: lazy_object_proxy-1.4.2-cp36-cp36m-manylinux1_x86_64.whl
- Upload date:
- Size: 49.8 kB
- Tags: CPython 3.6m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a0c8758d01fcdfe7ae8e4b4017b13552efa7f1197dd7358dc9da0576f9d0328a
|
|
| MD5 |
9f2592673de847090c92a90143d53e2e
|
|
| BLAKE2b-256 |
0e26534a6d32572a9dbca11619321535c0a7ab34688545d9d67c2c204b9e3a3d
|
File details
Details for the file lazy_object_proxy-1.4.2-cp35-cp35m-win_amd64.whl.
File metadata
- Download URL: lazy_object_proxy-1.4.2-cp35-cp35m-win_amd64.whl
- Upload date:
- Size: 20.7 kB
- Tags: CPython 3.5m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4def978d9d28cda2d960c279318d46b327632686d82b4917516c36d4c274512
|
|
| MD5 |
9b8fc2b35e3e22ba015c5fdb83a6d15c
|
|
| BLAKE2b-256 |
5de50898a1c288ecad4650dbd68f1fac1dda6ab4c8f70e437a8f08add75e1650
|
File details
Details for the file lazy_object_proxy-1.4.2-cp35-cp35m-win32.whl.
File metadata
- Download URL: lazy_object_proxy-1.4.2-cp35-cp35m-win32.whl
- Upload date:
- Size: 18.4 kB
- Tags: CPython 3.5m, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f06d97f0ca0f414f6b707c974aaf8829c2292c1c497642f63824119d770226f
|
|
| MD5 |
55db8120f13c5817c67d5e0b10e4abf0
|
|
| BLAKE2b-256 |
be8fa293db95afc7fc1d15e50994785ec6ffb44583c0d24718464756fd7a1301
|
File details
Details for the file lazy_object_proxy-1.4.2-cp35-cp35m-manylinux1_x86_64.whl.
File metadata
- Download URL: lazy_object_proxy-1.4.2-cp35-cp35m-manylinux1_x86_64.whl
- Upload date:
- Size: 49.7 kB
- Tags: CPython 3.5m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02b260c8deb80db09325b99edf62ae344ce9bc64d68b7a634410b8e9a568edbf
|
|
| MD5 |
40057f40eb140fbeb6b12755bddc9831
|
|
| BLAKE2b-256 |
ef3ba171ee9b58103169d26125a5cea1a09d77d20fc7afe1c08a2fa50e5e5042
|
File details
Details for the file lazy_object_proxy-1.4.2-cp34-cp34m-win_amd64.whl.
File metadata
- Download URL: lazy_object_proxy-1.4.2-cp34-cp34m-win_amd64.whl
- Upload date:
- Size: 18.5 kB
- Tags: CPython 3.4m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
83fe27ba321e4cfac466178606147d3c0aa18e8087507caec78ed5a966a64905
|
|
| MD5 |
39131a11918411a601617cc422f1a354
|
|
| BLAKE2b-256 |
b5df2d5fd021308ecf443e701acf9553cfef7504062a9ee752d99c632273304f
|
File details
Details for the file lazy_object_proxy-1.4.2-cp34-cp34m-win32.whl.
File metadata
- Download URL: lazy_object_proxy-1.4.2-cp34-cp34m-win32.whl
- Upload date:
- Size: 17.0 kB
- Tags: CPython 3.4m, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c462eb33f6abca3b34cdedbe84d761f31a60b814e173b98ede3c81bb48967c4f
|
|
| MD5 |
6e3a441c52ae2c7a046627a33add6454
|
|
| BLAKE2b-256 |
0c96e8449c406c845d54d6164daf545998744975aaf88228480851890ce597a4
|
File details
Details for the file lazy_object_proxy-1.4.2-cp34-cp34m-manylinux1_x86_64.whl.
File metadata
- Download URL: lazy_object_proxy-1.4.2-cp34-cp34m-manylinux1_x86_64.whl
- Upload date:
- Size: 49.6 kB
- Tags: CPython 3.4m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f2c6209a8917c525c1e2b55a716135ca4658a3042b5122d4e3413a4030c26ce
|
|
| MD5 |
b35c400a7df281c7e76e20bea4d63e5c
|
|
| BLAKE2b-256 |
914394b719a7a1a654cc0a8cb16390fe541e6cec0880e8de50bfaa3967bb2f5d
|
File details
Details for the file lazy_object_proxy-1.4.2-cp27-cp27mu-manylinux1_x86_64.whl.
File metadata
- Download URL: lazy_object_proxy-1.4.2-cp27-cp27mu-manylinux1_x86_64.whl
- Upload date:
- Size: 50.3 kB
- Tags: CPython 2.7mu
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
63b91e30ef47ef68a30f0c3c278fbfe9822319c15f34b7538a829515b84ca2a0
|
|
| MD5 |
24dcdaac40a00b9780a19c72cf69c7fd
|
|
| BLAKE2b-256 |
ede36cf40a286e444698b09cfe65d0a7e58716c2079bb9e9cd58873dbe4ca1a6
|
File details
Details for the file lazy_object_proxy-1.4.2-cp27-cp27m-win_amd64.whl.
File metadata
- Download URL: lazy_object_proxy-1.4.2-cp27-cp27m-win_amd64.whl
- Upload date:
- Size: 18.7 kB
- Tags: CPython 2.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad4f4be843dace866af5fc142509e9b9817ca0c59342fdb176ab6ad552c927f5
|
|
| MD5 |
8991ef8743c44399ac9bd83293f77c0b
|
|
| BLAKE2b-256 |
710f7b266ef296511461e0794e1ee0a6ddd6787f262038ff23ddcb0c451f2674
|
File details
Details for the file lazy_object_proxy-1.4.2-cp27-cp27m-win32.whl.
File metadata
- Download URL: lazy_object_proxy-1.4.2-cp27-cp27m-win32.whl
- Upload date:
- Size: 17.2 kB
- Tags: CPython 2.7m, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae33dd198f772f714420c5ab698ff05ff900150486c648d29951e9c70694338e
|
|
| MD5 |
5c5a91f6231218fc50261db8e8bd01fd
|
|
| BLAKE2b-256 |
55698af2084bbf790a03730a4e8d7089ca3e31c77f407d1224c3143ec4288d63
|
File details
Details for the file lazy_object_proxy-1.4.2-cp27-cp27m-macosx_10_13_x86_64.whl.
File metadata
- Download URL: lazy_object_proxy-1.4.2-cp27-cp27m-macosx_10_13_x86_64.whl
- Upload date:
- Size: 19.0 kB
- Tags: CPython 2.7m, macOS 10.13+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
616c94f8176808f4018b39f9638080ed86f96b55370b5a9463b2ee5c926f6c5f
|
|
| MD5 |
c97e1d741d92b59dabdb4466a4e96656
|
|
| BLAKE2b-256 |
4bb0101826c1259b932582ad5ac841458bcb717256a3b56ca8eb3586ce62f996
|