Metadata-Version: 1.1
Name: lazy
Version: 1.4.dev0
Summary: Lazy attributes for Python objects
Home-page: https://github.com/stefanholek/lazy
Author: Stefan H. Holek
Author-email: stefan@epy.co.at
License: BSD-2-Clause
Description: ====
        lazy
        ====
        ----------------------------------
        Lazy attributes for Python objects
        ----------------------------------
        
        Package Contents
        ================
        
        @lazy
            A decorator to create lazy attributes.
        
        Overview
        ========
        
        *Lazy attributes* are computed attributes that are evaluated only
        once, the first time they are used.  Subsequent uses return the
        results of the first call. They come handy when code should run
        
        - *late*, i.e. just before it is needed, and
        - *once*, i.e. not twice, in the lifetime of an object.
        
        You can think of it as *deferred initialization*.
        The possibilities are endless.
        
        Examples
        ========
        
        The class below creates its ``store`` resource lazily::
        
            from lazy import lazy
        
            class FileUploadTmpStore(object):
        
                @lazy
                def store(self):
                    location = settings.get('fs.filestore')
                    return FileSystemStore(location)
        
                def put(self, uid, fp):
                    self.store.put(uid, fp)
                    fp.seek(0)
        
                def get(self, uid, default=None):
                    return self.store.get(uid, default)
        
        Another application area is caching::
        
            class PersonView(View):
        
                @lazy
                def person_id(self):
                    return self.request.get('person_id', -1)
        
                @lazy
                def person_data(self):
                    return self.session.query(Person).get(self.person_id)
        
        Documentation
        =============
        
        For further details please refer to the `API Documentation`_.
        
        .. _`API Documentation`: https://lazy.readthedocs.io/en/stable/
        
        Credits
        =======
        
        I first encountered this type of descriptor in the
        ``zope.cachedescriptors`` package, which is part of the
        `Zope Toolkit`_.
        
        .. _`Zope Toolkit`: https://zopetoolkit.readthedocs.io
        
        
        Changelog
        =========
        
        1.4 - 2019-01-28
        ----------------
        
        - Add MANIFEST.in.
          [stefan]
        
        - Release as universal wheel.
          [stefan]
        
        1.3 - 2017-02-05
        ----------------
        
        - Support Python 2.6-3.6 without 2to3.
          [stefan]
        
        - Add a LICENSE file.
          [stefan]
        
        1.2 - 2014-04-19
        ----------------
        
        - Remove setuptools from install_requires because it isn't.
          [stefan]
        
        1.1 - 2012-10-12
        ----------------
        
        - Use ``functools.wraps()`` properly; the list of attributes changes with
          every version of Python 3.
          [stefan]
        
        1.0 - 2011-03-24
        ----------------
        
        - Initial release.
        
Keywords: decorator lazy attribute property
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 3
