• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.github/H22-Mar-2021-21

ci/H03-May-2022-362305

docs/H03-May-2022-10177

src/H22-Mar-2021-2,6221,800

tests/H22-Mar-2021-3,7712,485

.appveyor.ymlH A D18-Mar-20214.9 KiB151149

.bumpversion.cfgH A D22-Mar-2021547 2216

.cookiecutterrcH A D17-Mar-20211.6 KiB5452

.coveragercH A D17-Mar-2021149 1512

.editorconfigH A D17-Mar-2021353 2116

.gitignoreH A D17-Mar-2021715 7865

.pre-commit-config.yamlH A D17-Mar-2021554 2120

.readthedocs.ymlH A D17-Mar-2021231 1110

.travis.ymlH A D18-Mar-20214 KiB166165

AUTHORS.rstH A D17-Mar-2021278 118

CHANGELOG.rstH A D22-Mar-20213 KiB10370

CONTRIBUTING.rstH A D17-Mar-20212.7 KiB9258

LICENSEH A D17-Mar-20211.3 KiB2216

PKG-INFOH A D22-Mar-20217 KiB194137

README.rstH A D22-Mar-20213.9 KiB12083

conftest.pyH A D18-Mar-2021203 116

pyproject.tomlH A D18-Mar-2021103 76

setup.cfgH A D03-May-2022821 4943

setup.pyH A D22-Mar-20214.8 KiB139110

tox.iniH A D18-Mar-20212.4 KiB115105

README.rst

1========
2Overview
3========
4
5.. start-badges
6
7.. list-table::
8    :stub-columns: 1
9
10    * - docs
11      - |docs|
12    * - tests
13      - | |travis| |appveyor| |requires|
14        | |coveralls| |codecov|
15    * - package
16      - | |version| |wheel| |supported-versions| |supported-implementations|
17        | |commits-since|
18.. |docs| image:: https://readthedocs.org/projects/python-lazy-object-proxy/badge/?style=flat
19    :target: https://readthedocs.org/projects/python-lazy-object-proxy
20    :alt: Documentation Status
21
22.. |travis| image:: https://api.travis-ci.com/ionelmc/python-lazy-object-proxy.svg?branch=master
23    :alt: Travis-CI Build Status
24    :target: https://travis-ci.com/github/ionelmc/python-lazy-object-proxy
25
26.. |appveyor| image:: https://ci.appveyor.com/api/projects/status/github/ionelmc/python-lazy-object-proxy?branch=master&svg=true
27    :alt: AppVeyor Build Status
28    :target: https://ci.appveyor.com/project/ionelmc/python-lazy-object-proxy
29
30.. |requires| image:: https://requires.io/github/ionelmc/python-lazy-object-proxy/requirements.svg?branch=master
31    :alt: Requirements Status
32    :target: https://requires.io/github/ionelmc/python-lazy-object-proxy/requirements/?branch=master
33
34.. |coveralls| image:: https://coveralls.io/repos/ionelmc/python-lazy-object-proxy/badge.svg?branch=master&service=github
35    :alt: Coverage Status
36    :target: https://coveralls.io/r/ionelmc/python-lazy-object-proxy
37
38.. |codecov| image:: https://codecov.io/gh/ionelmc/python-lazy-object-proxy/branch/master/graphs/badge.svg?branch=master
39    :alt: Coverage Status
40    :target: https://codecov.io/github/ionelmc/python-lazy-object-proxy
41
42.. |version| image:: https://img.shields.io/pypi/v/lazy-object-proxy.svg
43    :alt: PyPI Package latest release
44    :target: https://pypi.org/project/lazy-object-proxy
45
46.. |wheel| image:: https://img.shields.io/pypi/wheel/lazy-object-proxy.svg
47    :alt: PyPI Wheel
48    :target: https://pypi.org/project/lazy-object-proxy
49
50.. |supported-versions| image:: https://img.shields.io/pypi/pyversions/lazy-object-proxy.svg
51    :alt: Supported versions
52    :target: https://pypi.org/project/lazy-object-proxy
53
54.. |supported-implementations| image:: https://img.shields.io/pypi/implementation/lazy-object-proxy.svg
55    :alt: Supported implementations
56    :target: https://pypi.org/project/lazy-object-proxy
57
58.. |commits-since| image:: https://img.shields.io/github/commits-since/ionelmc/python-lazy-object-proxy/v1.6.0.svg
59    :alt: Commits since latest release
60    :target: https://github.com/ionelmc/python-lazy-object-proxy/compare/v1.5.2...master
61
62
63
64.. end-badges
65
66A fast and thorough lazy object proxy.
67
68* Free software: BSD 2-Clause License
69
70Note that this is based on `wrapt`_'s ObjectProxy with one big change: it calls a function the first time the proxy object is
71used, while `wrapt.ObjectProxy` just forwards the method calls to the target object.
72
73In other words, you use `lazy-object-proxy` when you only have the object way later and you use `wrapt.ObjectProxy` when you
74want to override few methods (by subclassing) and forward everything else to the target object.
75
76Example::
77
78    import lazy_object_proxy
79
80    def expensive_func():
81        from time import sleep
82        print('starting calculation')
83        # just as example for a very slow computation
84        sleep(2)
85        print('finished calculation')
86        # return the result of the calculation
87        return 10
88
89    obj = lazy_object_proxy.Proxy(expensive_func)
90    # function is called only when object is actually used
91    print(obj)  # now expensive_func is called
92
93    print(obj)  # the result without calling the expensive_func
94
95Installation
96============
97
98::
99
100    pip install lazy-object-proxy
101
102Documentation
103=============
104
105https://python-lazy-object-proxy.readthedocs.io/
106
107Development
108===========
109
110To run all the tests run::
111
112    tox
113
114Acknowledgements
115================
116
117This project is based on some code from `wrapt`_ as you can see in the git history.
118
119.. _wrapt: https://github.com/GrahamDumpleton/wrapt
120