Hello community, here is the log from the commit of package python-repoze.lru for openSUSE:Factory checked in at 2012-09-11 09:18:17 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-repoze.lru (Old) and /work/SRC/openSUSE:Factory/.python-repoze.lru.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-repoze.lru", Maintainer is "[email protected]" Changes: -------- --- /work/SRC/openSUSE:Factory/python-repoze.lru/python-repoze.lru.changes 2012-04-19 08:50:59.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.python-repoze.lru.new/python-repoze.lru.changes 2012-09-11 09:18:21.000000000 +0200 @@ -1,0 +2,19 @@ +Sat Sep 8 20:51:44 UTC 2012 - [email protected] + +- Update to 0.6: + * Added a 'CacheMaker' helper class: a maker keeps references (by name) + to the caches it creates, to permit them to be cleared. + * Added statistics to each cache, tracking lookups, hits, misses, and + evictions. + * Automated building Sphinx docs and testing example snippets under ``tox``. + * Added Sphinx documentation. + * Dropped support for Python 2.5. + * Added support for PyPy. + * Added ``setup.py docs`` alias (installs ``Sphinx`` and dependencies). + * Added ``setup.py dev`` alias (runs ``develop`` plus installs ``nose`` + and ``coverage``). + * Added support for CI under supported Pythons using ``tox``. + * Bug: Remove potential race condition on lock in face of interrupts + (Issue #10). + +------------------------------------------------------------------- Old: ---- repoze.lru-0.5.tar.gz New: ---- repoze.lru-0.6.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-repoze.lru.spec ++++++ --- /var/tmp/diff_new_pack.HOFCJL/_old 2012-09-11 09:18:28.000000000 +0200 +++ /var/tmp/diff_new_pack.HOFCJL/_new 2012-09-11 09:18:29.000000000 +0200 @@ -13,15 +13,16 @@ # published by the Open Source Initiative. # Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Name: python-repoze.lru -Version: 0.5 +Version: 0.6 Release: 0 -License: SUSE-Repoze Summary: A tiny LRU cache implementation and decorator -Url: http://www.repoze.org +License: SUSE-Repoze Group: Development/Languages/Python +Url: http://www.repoze.org Source: http://pypi.python.org/packages/source/r/repoze.lru/repoze.lru-%{version}.tar.gz BuildRequires: python-devel BuildRequires: python-distribute ++++++ repoze.lru-0.5.tar.gz -> repoze.lru-0.6.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/repoze.lru-0.5/.gitignore new/repoze.lru-0.6/.gitignore --- old/repoze.lru-0.5/.gitignore 2012-03-24 18:38:58.000000000 +0100 +++ new/repoze.lru-0.6/.gitignore 2012-06-11 23:02:58.000000000 +0200 @@ -10,3 +10,4 @@ nosetests.xml coverage.xml repoze/lru/coverage.xml +docs/_build/* diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/repoze.lru-0.5/CHANGES.txt new/repoze.lru-0.6/CHANGES.txt --- old/repoze.lru-0.5/CHANGES.txt 2012-03-24 19:03:12.000000000 +0100 +++ new/repoze.lru-0.6/CHANGES.txt 2012-07-12 20:45:06.000000000 +0200 @@ -1,8 +1,29 @@ Changelog ========= -After 0.5 ---------- +0.6 (2012-07-12) +---------------- + +- Added a 'CacheMaker' helper class: a maker keeps references (by name) + to the caches it creates, to permit them to be cleared. + +- Added statistics to each cache, tracking lookups, hits, misses, and + evictions. + +- Automated building Sphinx docs and testing example snippets under ``tox``. + +- Added Sphinx documentation. + +- Dropped support for Python 2.5. + +- Added support for PyPy. + +- Added ``setup.py docs`` alias (installs ``Sphinx`` and dependencies). + +- Added ``setup.py dev`` alias (runs ``develop`` plus installs ``nose`` + and ``coverage``). + +- Added support for CI under supported Pythons using ``tox``. - Bug: Remove potential race condition on lock in face of interrupts (Issue #10). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/repoze.lru-0.5/CONTRIBUTORS.txt new/repoze.lru-0.6/CONTRIBUTORS.txt --- old/repoze.lru-0.5/CONTRIBUTORS.txt 2012-03-23 21:57:18.000000000 +0100 +++ new/repoze.lru-0.6/CONTRIBUTORS.txt 2012-07-05 15:36:30.000000000 +0200 @@ -105,3 +105,4 @@ - Tres Seaver, 2011/02/22 - Joel Bohman, 2011/08/16 +- Julien Tayon, 2012/07/04 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/repoze.lru-0.5/PKG-INFO new/repoze.lru-0.6/PKG-INFO --- old/repoze.lru-0.5/PKG-INFO 2012-03-24 19:12:34.000000000 +0100 +++ new/repoze.lru-0.6/PKG-INFO 2012-07-12 20:48:37.000000000 +0200 @@ -1,6 +1,6 @@ -Metadata-Version: 1.0 +Metadata-Version: 1.1 Name: repoze.lru -Version: 0.5 +Version: 0.6 Summary: A tiny LRU cache implementation and decorator Home-page: http://www.repoze.org Author: Agendaless Consulting @@ -14,49 +14,35 @@ than keys and values that are used frequently. It works under Python 2.5, Python 2.6, Python 2.7, and Python 3.2. - API - --- + Please see ``docs/index.rst`` for detailed documentation. - Creating an LRUCache object:: - from repoze.lru import LRUCache - cache = LRUCache(100) # 100 max length - - Retrieving from an LRUCache object:: - - cache.get('nonexisting', 'foo') # will return 'foo' - cache.get('nonexisting') # will return None - cache.get('existing') # will return the value for existing - - Adding to an LRUCache object:: - - cache.put('key', 'value') # will add the key 'key' with the value 'value' + Changelog + ========= - Clearing an LRUCache:: + 0.6 (2012-07-12) + ---------------- - cache.clear() + - Added a 'CacheMaker' helper class: a maker keeps references (by name) + to the caches it creates, to permit them to be cleared. - Decorator - --------- + - Added statistics to each cache, tracking lookups, hits, misses, and + evictions. - A ``lru_cache`` decorator exists. All values passed to the decorated - function must be hashable. It does not support keyword arguments:: + - Automated building Sphinx docs and testing example snippets under ``tox``. - from repoze.lru import lru_cache + - Added Sphinx documentation. - @lru_cache(500) - def expensive_function(*arg): - pass + - Dropped support for Python 2.5. - Each function decorated with the lru_cache decorator uses its own - cache related to that function. + - Added support for PyPy. + - Added ``setup.py docs`` alias (installs ``Sphinx`` and dependencies). - Changelog - ========= + - Added ``setup.py dev`` alias (runs ``develop`` plus installs ``nose`` + and ``coverage``). - After 0.5 - --------- + - Added support for CI under supported Pythons using ``tox``. - Bug: Remove potential race condition on lock in face of interrupts (Issue #10). @@ -108,7 +94,6 @@ Platform: UNKNOWN Classifier: Intended Audience :: Developers Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 2.5 Classifier: Programming Language :: Python :: 2.6 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/repoze.lru-0.5/README.txt new/repoze.lru-0.6/README.txt --- old/repoze.lru-0.5/README.txt 2012-03-23 21:57:18.000000000 +0100 +++ new/repoze.lru-0.6/README.txt 2012-06-11 23:14:39.000000000 +0200 @@ -6,39 +6,4 @@ than keys and values that are used frequently. It works under Python 2.5, Python 2.6, Python 2.7, and Python 3.2. -API ---- - -Creating an LRUCache object:: - - from repoze.lru import LRUCache - cache = LRUCache(100) # 100 max length - -Retrieving from an LRUCache object:: - - cache.get('nonexisting', 'foo') # will return 'foo' - cache.get('nonexisting') # will return None - cache.get('existing') # will return the value for existing - -Adding to an LRUCache object:: - - cache.put('key', 'value') # will add the key 'key' with the value 'value' - -Clearing an LRUCache:: - - cache.clear() - -Decorator ---------- - -A ``lru_cache`` decorator exists. All values passed to the decorated -function must be hashable. It does not support keyword arguments:: - - from repoze.lru import lru_cache - - @lru_cache(500) - def expensive_function(*arg): - pass - -Each function decorated with the lru_cache decorator uses its own -cache related to that function. +Please see ``docs/index.rst`` for detailed documentation. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/repoze.lru-0.5/docs/Makefile new/repoze.lru-0.6/docs/Makefile --- old/repoze.lru-0.5/docs/Makefile 1970-01-01 01:00:00.000000000 +0100 +++ new/repoze.lru-0.6/docs/Makefile 2012-06-11 22:50:52.000000000 +0200 @@ -0,0 +1,153 @@ +# Makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +PAPER = +BUILDDIR = _build + +# Internal variables. +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . +# the i18n builder cannot share the environment and doctrees with the others +I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . + +.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext + +help: + @echo "Please use \`make <target>' where <target> is one of" + @echo " html to make standalone HTML files" + @echo " dirhtml to make HTML files named index.html in directories" + @echo " singlehtml to make a single large HTML file" + @echo " pickle to make pickle files" + @echo " json to make JSON files" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " qthelp to make HTML files and a qthelp project" + @echo " devhelp to make HTML files and a Devhelp project" + @echo " epub to make an epub" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " latexpdf to make LaTeX files and run them through pdflatex" + @echo " text to make text files" + @echo " man to make manual pages" + @echo " texinfo to make Texinfo files" + @echo " info to make Texinfo files and run them through makeinfo" + @echo " gettext to make PO message catalogs" + @echo " changes to make an overview of all changed/added/deprecated items" + @echo " linkcheck to check all external links for integrity" + @echo " doctest to run all doctests embedded in the documentation (if enabled)" + +clean: + -rm -rf $(BUILDDIR)/* + +html: + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." + +dirhtml: + $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." + +singlehtml: + $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml + @echo + @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." + +pickle: + $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle + @echo + @echo "Build finished; now you can process the pickle files." + +json: + $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json + @echo + @echo "Build finished; now you can process the JSON files." + +htmlhelp: + $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp + @echo + @echo "Build finished; now you can run HTML Help Workshop with the" \ + ".hhp project file in $(BUILDDIR)/htmlhelp." + +qthelp: + $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp + @echo + @echo "Build finished; now you can run "qcollectiongenerator" with the" \ + ".qhcp project file in $(BUILDDIR)/qthelp, like this:" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/repozelru.qhcp" + @echo "To view the help file:" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/repozelru.qhc" + +devhelp: + $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp + @echo + @echo "Build finished." + @echo "To view the help file:" + @echo "# mkdir -p $$HOME/.local/share/devhelp/repozelru" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/repozelru" + @echo "# devhelp" + +epub: + $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub + @echo + @echo "Build finished. The epub file is in $(BUILDDIR)/epub." + +latex: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo + @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." + @echo "Run \`make' in that directory to run these through (pdf)latex" \ + "(use \`make latexpdf' here to do that automatically)." + +latexpdf: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through pdflatex..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +text: + $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text + @echo + @echo "Build finished. The text files are in $(BUILDDIR)/text." + +man: + $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man + @echo + @echo "Build finished. The manual pages are in $(BUILDDIR)/man." + +texinfo: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo + @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." + @echo "Run \`make' in that directory to run these through makeinfo" \ + "(use \`make info' here to do that automatically)." + +info: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo "Running Texinfo files through makeinfo..." + make -C $(BUILDDIR)/texinfo info + @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." + +gettext: + $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale + @echo + @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." + +changes: + $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes + @echo + @echo "The overview file is in $(BUILDDIR)/changes." + +linkcheck: + $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck + @echo + @echo "Link check complete; look for any errors in the above output " \ + "or in $(BUILDDIR)/linkcheck/output.txt." + +doctest: + $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest + @echo "Testing of doctests in the sources finished, look at the " \ + "results in $(BUILDDIR)/doctest/output.txt." diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/repoze.lru-0.5/docs/api.rst new/repoze.lru-0.6/docs/api.rst --- old/repoze.lru-0.5/docs/api.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/repoze.lru-0.6/docs/api.rst 2012-07-05 15:36:30.000000000 +0200 @@ -0,0 +1,23 @@ +:mod:`repoze.lru` API +===================== + +Module: :mod:`repoze.lru` +-------------------------- + +.. automodule:: repoze.lru + + .. autoclass:: LRUCache + :members: + :member-order: bysource + + .. autoclass:: ExpiringLRUCache + :members: + :member-order: bysource + + .. autoclass:: lru_cache + :members: + :member-order: bysource + + .. autoclass:: CacheMaker + :members: + :member-order: bysource diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/repoze.lru-0.5/docs/conf.py new/repoze.lru-0.6/docs/conf.py --- old/repoze.lru-0.5/docs/conf.py 1970-01-01 01:00:00.000000000 +0100 +++ new/repoze.lru-0.6/docs/conf.py 2012-06-11 22:50:52.000000000 +0200 @@ -0,0 +1,242 @@ +# -*- coding: utf-8 -*- +# +# repoze.lru documentation build configuration file, created by +# sphinx-quickstart on Mon Jun 11 16:50:52 2012. +# +# This file is execfile()d with the current directory set to its containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +import sys, os + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +#sys.path.insert(0, os.path.abspath('.')) + +# -- General configuration ----------------------------------------------------- + +# If your documentation needs a minimal Sphinx version, state it here. +#needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be extensions +# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. +extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.todo', 'sphinx.ext.ifconfig', 'sphinx.ext.viewcode'] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix of source filenames. +source_suffix = '.rst' + +# The encoding of source files. +#source_encoding = 'utf-8-sig' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'repoze.lru' +copyright = u'2012, Repoze contributors' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = '0.6' +# The full version, including alpha/beta/rc tags. +release = '0.6' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +#language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +#today = '' +# Else, today_fmt is used as the format for a strftime call. +#today_fmt = '%B %d, %Y' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +exclude_patterns = ['_build'] + +# The reST default role (used for this markup: `text`) to use for all documents. +#default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +#add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +#add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +#show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# A list of ignored prefixes for module index sorting. +#modindex_common_prefix = [] + + +# -- Options for HTML output --------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +html_theme = 'default' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +#html_theme_options = {} + +# Add any paths that contain custom themes here, relative to this directory. +#html_theme_path = [] + +# The name for this set of Sphinx documents. If None, it defaults to +# "<project> v<release> documentation". +#html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +#html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +#html_logo = None + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +#html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +#html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +#html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +#html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +#html_additional_pages = {} + +# If false, no module index is generated. +#html_domain_indices = True + +# If false, no index is generated. +#html_use_index = True + +# If true, the index is split into individual pages for each letter. +#html_split_index = False + +# If true, links to the reST sources are added to the pages. +#html_show_sourcelink = True + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +#html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +#html_show_copyright = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a <link> tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +#html_use_opensearch = '' + +# This is the file name suffix for HTML files (e.g. ".xhtml"). +#html_file_suffix = None + +# Output file base name for HTML help builder. +htmlhelp_basename = 'repozelrudoc' + + +# -- Options for LaTeX output -------------------------------------------------- + +latex_elements = { +# The paper size ('letterpaper' or 'a4paper'). +#'papersize': 'letterpaper', + +# The font size ('10pt', '11pt' or '12pt'). +#'pointsize': '10pt', + +# Additional stuff for the LaTeX preamble. +#'preamble': '', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, author, documentclass [howto/manual]). +latex_documents = [ + ('index', 'repozelru.tex', u'repoze.lru Documentation', + u'Repoze contributors', 'manual'), +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +#latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +#latex_use_parts = False + +# If true, show page references after internal links. +#latex_show_pagerefs = False + +# If true, show URL addresses after external links. +#latex_show_urls = False + +# Documents to append as an appendix to all manuals. +#latex_appendices = [] + +# If false, no module index is generated. +#latex_domain_indices = True + + +# -- Options for manual page output -------------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + ('index', 'repozelru', u'repoze.lru Documentation', + [u'Repoze contributors'], 1) +] + +# If true, show URL addresses after external links. +#man_show_urls = False + + +# -- Options for Texinfo output ------------------------------------------------ + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + ('index', 'repozelru', u'repoze.lru Documentation', + u'Repoze contributors', 'repozelru', 'One line description of project.', + 'Miscellaneous'), +] + +# Documents to append as an appendix to all manuals. +#texinfo_appendices = [] + +# If false, no module index is generated. +#texinfo_domain_indices = True + +# How to display URL addresses: 'footnote', 'no', or 'inline'. +#texinfo_show_urls = 'footnote' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/repoze.lru-0.5/docs/index.rst new/repoze.lru-0.6/docs/index.rst --- old/repoze.lru-0.5/docs/index.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/repoze.lru-0.6/docs/index.rst 2012-06-11 22:52:01.000000000 +0200 @@ -0,0 +1,19 @@ +:mod:`repoze.lru` +================= + +Contents: + +.. toctree:: + :maxdepth: 2 + + narr + api + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/repoze.lru-0.5/docs/make.bat new/repoze.lru-0.6/docs/make.bat --- old/repoze.lru-0.5/docs/make.bat 1970-01-01 01:00:00.000000000 +0100 +++ new/repoze.lru-0.6/docs/make.bat 2012-06-11 22:50:52.000000000 +0200 @@ -0,0 +1,190 @@ +@ECHO OFF + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set BUILDDIR=_build +set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . +set I18NSPHINXOPTS=%SPHINXOPTS% . +if NOT "%PAPER%" == "" ( + set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% + set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% +) + +if "%1" == "" goto help + +if "%1" == "help" ( + :help + echo.Please use `make ^<target^>` where ^<target^> is one of + echo. html to make standalone HTML files + echo. dirhtml to make HTML files named index.html in directories + echo. singlehtml to make a single large HTML file + echo. pickle to make pickle files + echo. json to make JSON files + echo. htmlhelp to make HTML files and a HTML help project + echo. qthelp to make HTML files and a qthelp project + echo. devhelp to make HTML files and a Devhelp project + echo. epub to make an epub + echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter + echo. text to make text files + echo. man to make manual pages + echo. texinfo to make Texinfo files + echo. gettext to make PO message catalogs + echo. changes to make an overview over all changed/added/deprecated items + echo. linkcheck to check all external links for integrity + echo. doctest to run all doctests embedded in the documentation if enabled + goto end +) + +if "%1" == "clean" ( + for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i + del /q /s %BUILDDIR%\* + goto end +) + +if "%1" == "html" ( + %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The HTML pages are in %BUILDDIR%/html. + goto end +) + +if "%1" == "dirhtml" ( + %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. + goto end +) + +if "%1" == "singlehtml" ( + %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. + goto end +) + +if "%1" == "pickle" ( + %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can process the pickle files. + goto end +) + +if "%1" == "json" ( + %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can process the JSON files. + goto end +) + +if "%1" == "htmlhelp" ( + %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can run HTML Help Workshop with the ^ +.hhp project file in %BUILDDIR%/htmlhelp. + goto end +) + +if "%1" == "qthelp" ( + %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can run "qcollectiongenerator" with the ^ +.qhcp project file in %BUILDDIR%/qthelp, like this: + echo.^> qcollectiongenerator %BUILDDIR%\qthelp\repozelru.qhcp + echo.To view the help file: + echo.^> assistant -collectionFile %BUILDDIR%\qthelp\repozelru.ghc + goto end +) + +if "%1" == "devhelp" ( + %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. + goto end +) + +if "%1" == "epub" ( + %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The epub file is in %BUILDDIR%/epub. + goto end +) + +if "%1" == "latex" ( + %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. + goto end +) + +if "%1" == "text" ( + %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The text files are in %BUILDDIR%/text. + goto end +) + +if "%1" == "man" ( + %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The manual pages are in %BUILDDIR%/man. + goto end +) + +if "%1" == "texinfo" ( + %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo. + goto end +) + +if "%1" == "gettext" ( + %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The message catalogs are in %BUILDDIR%/locale. + goto end +) + +if "%1" == "changes" ( + %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes + if errorlevel 1 exit /b 1 + echo. + echo.The overview file is in %BUILDDIR%/changes. + goto end +) + +if "%1" == "linkcheck" ( + %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck + if errorlevel 1 exit /b 1 + echo. + echo.Link check complete; look for any errors in the above output ^ +or in %BUILDDIR%/linkcheck/output.txt. + goto end +) + +if "%1" == "doctest" ( + %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest + if errorlevel 1 exit /b 1 + echo. + echo.Testing of doctests in the sources finished, look at the ^ +results in %BUILDDIR%/doctest/output.txt. + goto end +) + +:end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/repoze.lru-0.5/docs/narr.rst new/repoze.lru-0.6/docs/narr.rst --- old/repoze.lru-0.5/docs/narr.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/repoze.lru-0.6/docs/narr.rst 2012-07-05 15:36:30.000000000 +0200 @@ -0,0 +1,95 @@ +Using :mod:`repoze.lru` +====================== + +``repoze.lru`` is a LRU (least recently used) cache implementation. Keys and +values that are not used frequently will be evicted from the cache faster +than keys and values that are used frequently. It works under Python 2.5, +Python 2.6, Python 2.7, and Python 3.2. + +Using the API programmatically +------------------------------ + +Creating an LRUCache object: + +.. doctest:: + + >>> from repoze.lru import LRUCache + >>> cache = LRUCache(100) # 100 max length + +Retrieving from an LRUCache object: + +.. doctest:: + + >>> cache.get('nonexisting', 'foo') # return 'foo' + 'foo' + >>> cache.get('nonexisting') is None + True + +Adding to an LRUCache object: + +.. doctest:: + + >>> cache.put('existing', 'value') # add the key 'key' with the value 'value' + >>> cache.get('existing') # return the value for existing + 'value' + +Clearing an LRUCache: + +.. doctest:: + + >>> cache.clear() + +Each LRU cache tracks some basic statistics via attributes: + + cache.lookups # number of calls to the get method + cache.hits # number of times a call to get found an object + cache.misses # number of times a call to get did not find an object + cahce.evictions # number of times a object was evicted from cache + + +Decorating an "expensive" function call +--------------------------------------- + +:mod:`repoze.lru` provides a class :class:`~repoze.lru.lru_cache`, which +wrapps another callable, caching the results. All values passed to the +decorated function must be hashable. It does not support keyword arguments: + +.. doctest:: + + >>> from repoze.lru import lru_cache + >>> @lru_cache(500) + ... def expensive_function(*arg): #* + ... pass + +Each function decorated with the lru_cache decorator uses its own +cache related to that function. + +Cleaning cache of decorated function +------------------------------------ + +:mod:`repoze.lru` provides a :class:`~repoze.lru.CacheMaker`, which generates +decorators. This way, you can later clear your cache if needed. + +.. doctest:: + + >>> from repoze.lru import CacheMaker + >>> cache_maker=CacheMaker() + >>> @cache_maker.lrucache(maxsize=300, name="adder") + ... def yet_another_exepensive_function(*arg):#* + ... pass + + >>> @cache_maker.expiring_lrucache(maxsize=300,timeout=30) + ... def another_exepensive_function(*arg):#* + ... pass + +This way, when you need it you can choose to either clear all cache: + +.. doctest:: + + >>> cache_maker.clear() + +or clear a specific cache + +.. doctest:: + + >>> cache_maker.clear("adder") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/repoze.lru-0.5/repoze/lru/__init__.py new/repoze.lru-0.6/repoze/lru/__init__.py --- old/repoze.lru-0.5/repoze/lru/__init__.py 2012-03-24 18:59:29.000000000 +0100 +++ new/repoze.lru-0.6/repoze/lru/__init__.py 2012-07-05 15:36:30.000000000 +0200 @@ -3,17 +3,15 @@ import threading import time +import uuid -try: - range = xrange -except NameError: # pragma: no cover - pass _MARKER = object() # By default, expire items after 2**60 seconds. This fits into 64 bit # integers and is close enough to "never" for practical purposes. _DEFAULT_TIMEOUT = 2 ** 60 + class LRUCache(object): """ Implements a pseudo-LRU algorithm (CLOCK) @@ -31,6 +29,10 @@ self.clock_keys = None self.clock_refs = None self.data = None + self.evictions = 0 + self.hits = 0 + self.misses = 0 + self.lookups = 0 self.clear() def clear(self): @@ -47,12 +49,19 @@ self.clock_keys = [_MARKER] * size self.clock_refs = [False] * size self.hand = 0 + self.evictions = 0 + self.hits = 0 + self.misses = 0 + self.lookups = 0 def get(self, key, default=None): """Return value for key. If not in cache, return default""" + self.lookups += 1 try: pos, val = self.data[key] + self.hits += 1 except KeyError: + self.misses += 1 return default self.clock_refs[pos] = True return val @@ -98,7 +107,9 @@ # Maybe oldkey was not in self.data to begin with. If it # was, self.invalidate() in another thread might have # already removed it. del() would raise KeyError, so pop(). - data.pop(oldkey, None) + oldentry = data.pop(oldkey, _MARKER) + if oldentry is not _MARKER: + self.evictions += 1 clock_keys[hand] = key clock_refs[hand] = True data[key] = (hand, val) @@ -137,6 +148,10 @@ self.clock_keys = None self.clock_refs = None self.data = None + self.evictions = 0 + self.hits = 0 + self.misses = 0 + self.lookups = 0 self.clear() def clear(self): @@ -154,20 +169,28 @@ self.clock_keys = [_MARKER] * size self.clock_refs = [False] * size self.hand = 0 + self.evictions = 0 + self.hits = 0 + self.misses = 0 + self.lookups = 0 def get(self, key, default=None): """Return value for key. If not in cache or expired, return default""" + self.lookups += 1 try: pos, val, expires = self.data[key] except KeyError: + self.misses += 1 return default if expires > time.time(): # cache entry still valid + self.hits += 1 self.clock_refs[pos] = True return val else: # cache entry has expired. Make sure the space in the cache can # be recycled soon. + self.misses += 1 self.clock_refs[pos] = False return default @@ -218,7 +241,9 @@ # Maybe oldkey was not in self.data to begin with. If it # was, self.invalidate() in another thread might have # already removed it. del() would raise KeyError, so pop(). - data.pop(oldkey, None) + oldentry = data.pop(oldkey, _MARKER) + if oldentry is not _MARKER: + self.evictions += 1 clock_keys[hand] = key clock_refs[hand] = True data[key] = (hand, val, time.time() + timeout) @@ -238,6 +263,7 @@ self.clock_refs[entry[0]] = False # else: key was not in cache. Nothing to do. + class lru_cache(object): """ Decorator for LRU-cached function @@ -265,3 +291,78 @@ lru_cached.__name__ = f.__name__ lru_cached.__doc__ = f.__doc__ return lru_cached + + +class CacheMaker(object): + """Generates decorators that can be cleared later + """ + def __init__(self, maxsize=None, timeout=_DEFAULT_TIMEOUT): + """Create cache decorator factory. + + - maxsize : the default size for created caches. + + - timeout : the defaut expiraiton time for created caches. + """ + self._maxsize = maxsize + self._timeout = timeout + self._cache = {} + + def _resolve_setting(self, name=None, maxsize=None, timeout=None): + if name is None: + while True: + name = str(uuid.uuid4()) + ## the probability of collision is so low .... + if name not in self._cache: + break + + if name in self._cache: + raise KeyError("cache %s already in use" % name) + + if maxsize is None: + maxsize = self._maxsize + + if maxsize is None: + raise ValueError("Cache must have a maxsize set") + + if timeout is None: + timeout = self._timeout + + return name, maxsize, timeout + + def lrucache(self, name=None, maxsize=None): + """Named arguments: + + - name (optional) is a string, and should be unique amongst all caches + + - maxsize (optional) is an int, overriding any default value set by + the constructor + """ + name, maxsize, _ = self._resolve_setting(name, maxsize) + cache = self._cache[name] = LRUCache(maxsize) + return lru_cache(maxsize, cache) + + def expiring_lrucache(self, name=None, maxsize=None, timeout=None): + """Named arguments: + + - name (optional) is a string, and should be unique amongst all caches + + - maxsize (optional) is an int, overriding any default value set by + the constructor + + - timeout (optional) is an int, overriding any default value set by + the constructor or the default value (%d seconds) + """ % _DEFAULT_TIMEOUT + name, maxsize, timeout = self._resolve_setting(name, maxsize, timeout) + cache = self._cache[name] = ExpiringLRUCache(maxsize, timeout) + return lru_cache(maxsize, cache, timeout) + + def clear(self, *names): + """Clear the given cache(s). + + If no 'names' are passed, clear all caches. + """ + if len(names) == 0: + names = self._cache.keys() + + for name in names: + self._cache[name].clear() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/repoze.lru-0.5/repoze/lru/tests.py new/repoze.lru-0.6/repoze/lru/tests.py --- old/repoze.lru-0.5/repoze/lru/tests.py 2012-03-24 18:38:58.000000000 +0100 +++ new/repoze.lru-0.6/repoze/lru/tests.py 2012-07-05 15:36:30.000000000 +0200 @@ -1,14 +1,15 @@ -#!/usr/bin/python -tt import random import time import unittest try: range = xrange -except NameError: # pragma: no cover +except NameError: # pragma: NO COVER (Python3) pass + class LRUCacheTests(unittest.TestCase): + def _getTargetClass(self): from repoze.lru import LRUCache return LRUCache @@ -23,7 +24,7 @@ # lengths of data structures self.assertEqual(len(cache.clock_keys), len(cache.clock_refs)) - self.assertTrue(len(cache.data) <=len(cache.clock_refs)) + self.assertTrue(len(cache.data) <= len(cache.clock_refs)) # For each item in cache.data # 1. pos must be a valid index @@ -181,6 +182,9 @@ else: cache.put(item, "item%s" % item) + self.assertEqual(cache.misses, 0) + self.assertEqual(cache.evictions, 0) + self.check_cache_is_consistent(cache) def test_imperfect_hitrate(self): @@ -214,8 +218,36 @@ self.assertTrue(hit_ratio > 45) self.assertTrue(hit_ratio < 55) + # The internal cache counters should have the same information + internal_hit_ratio = 100 * cache.hits / cache.lookups + self.assertTrue(internal_hit_ratio > 45) + self.assertTrue(internal_hit_ratio < 55) + + # The internal miss counters should also be around 50% + internal_miss_ratio = 100 * cache.misses / cache.lookups + self.assertTrue(internal_miss_ratio > 45) + self.assertTrue(internal_miss_ratio < 55) + self.check_cache_is_consistent(cache) + def test_eviction_counter(self): + cache = self._makeOne(2) + cache.put(1, 1) + cache.put(2, 1) + self.assertEqual(cache.evictions, 0) + + cache.put(3, 1) + cache.put(4, 1) + self.assertEqual(cache.evictions, 2) + + cache.put(3, 1) + cache.put(4, 1) + self.assertEqual(cache.evictions, 2) + + cache.clear() + self.assertEqual(cache.evictions, 0) + + def test_it(self): cache = self._makeOne(3) self.assertEqual(cache.get('a'), None) @@ -271,6 +303,7 @@ class ExpiringLRUCacheTests(LRUCacheTests): + def _getTargetClass(self): from repoze.lru import ExpiringLRUCache return ExpiringLRUCache @@ -316,6 +349,7 @@ # All clock_refs must be True or False, nothing else. for clock_ref in cache.clock_refs: self.assertTrue(clock_ref is True or clock_ref is False) + def test_it(self): """Test a sequence of operations @@ -455,7 +489,9 @@ self.assertEqual(cache.get("foo3"), "bar3") self.check_cache_is_consistent(cache) + class DecoratorTests(unittest.TestCase): + def _getTargetClass(self): from repoze.lru import lru_cache return lru_cache @@ -526,6 +562,111 @@ self.assertEqual(result3, 2 * "hello") self.assertTrue(stop - start > 0.1) + class DummyLRUCache(dict): + def put(self, k, v): return self.__setitem__(k, v) + + +class CacherMaker(unittest.TestCase): + + def _getTargetClass(self): + from repoze.lru import CacheMaker + return CacheMaker + + def _makeOne(self, *args, **kw): + return self._getTargetClass()(*args, **kw) + + def test_named_cache(self): + maker = self._makeOne() + size = 10 + name = "name" + decorated = maker.lrucache(maxsize=size, name=name)(_adder) + self.assertEqual(list(maker._cache.keys()), [name]) + self.assertEqual(maker._cache[name].size, size) + decorated(10) + decorated(11) + self.assertEqual(len(maker._cache[name].data),2) + + def test_exception(self): + maker = self._makeOne() + size = 10 + name = "name" + decorated = maker.lrucache(maxsize=size, name=name)(_adder) + self.assertRaises(KeyError, maker.lrucache, maxsize=size, name=name) + self.assertRaises(ValueError, maker.lrucache) + + def test_defaultvalue_and_clear(self): + size = 10 + maker = self._makeOne(maxsize=size) + for i in range(100): + decorated = maker.lrucache()(_adder) + decorated(10) + + self.assertEqual(len(maker._cache) , 100) + for _cache in maker._cache.values(): + self.assertEqual( _cache.size,size) + self.assertEqual(len(_cache.data),1) + ## and test clear cache + maker.clear() + for _cache in maker._cache.values(): + self.assertEqual( _cache.size,size) + self.assertEqual(len(_cache.data),0) + + def test_clear_with_single_name(self): + maker = self._makeOne(maxsize=10) + one = maker.lrucache(name='one')(_adder) + two = maker.lrucache(name='two')(_adder) + for i in range(100): + _ = one(i) + _ = two(i) + self.assertEqual(len(maker._cache['one'].data), 10) + self.assertEqual(len(maker._cache['two'].data), 10) + maker.clear('one') + self.assertEqual(len(maker._cache['one'].data), 0) + self.assertEqual(len(maker._cache['two'].data), 10) + + def test_clear_with_multiple_names(self): + maker = self._makeOne(maxsize=10) + one = maker.lrucache(name='one')(_adder) + two = maker.lrucache(name='two')(_adder) + three = maker.lrucache(name='three')(_adder) + for i in range(100): + _ = one(i) + _ = two(i) + _ = three(i) + self.assertEqual(len(maker._cache['one'].data), 10) + self.assertEqual(len(maker._cache['two'].data), 10) + self.assertEqual(len(maker._cache['three'].data), 10) + maker.clear('one', 'three') + self.assertEqual(len(maker._cache['one'].data), 0) + self.assertEqual(len(maker._cache['two'].data), 10) + self.assertEqual(len(maker._cache['three'].data), 0) + + def test_expiring(self): + size = 10 + timeout = 10 + name = "name" + cache = self._makeOne(maxsize=size, timeout=timeout) + for i in range(100): + if not i: + decorated = cache.expiring_lrucache(name=name)(_adder) + self.assertEqual( cache._cache[name].size,size) + else: + decorated = cache.expiring_lrucache()(_adder) + decorated(10) + + self.assertEqual( len(cache._cache) , 100) + for _cache in cache._cache.values(): + self.assertEqual( _cache.size,size) + self.assertEqual( _cache.default_timeout,timeout) + self.assertEqual(len(_cache.data),1) + ## and test clear cache + cache.clear() + for _cache in cache._cache.values(): + self.assertEqual( _cache.size,size) + self.assertEqual(len(_cache.data),0) + +def _adder(x): + return x + 10 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/repoze.lru-0.5/repoze.lru.egg-info/PKG-INFO new/repoze.lru-0.6/repoze.lru.egg-info/PKG-INFO --- old/repoze.lru-0.5/repoze.lru.egg-info/PKG-INFO 2012-03-24 19:12:34.000000000 +0100 +++ new/repoze.lru-0.6/repoze.lru.egg-info/PKG-INFO 2012-07-12 20:48:37.000000000 +0200 @@ -1,6 +1,6 @@ -Metadata-Version: 1.0 +Metadata-Version: 1.1 Name: repoze.lru -Version: 0.5 +Version: 0.6 Summary: A tiny LRU cache implementation and decorator Home-page: http://www.repoze.org Author: Agendaless Consulting @@ -14,49 +14,35 @@ than keys and values that are used frequently. It works under Python 2.5, Python 2.6, Python 2.7, and Python 3.2. - API - --- + Please see ``docs/index.rst`` for detailed documentation. - Creating an LRUCache object:: - from repoze.lru import LRUCache - cache = LRUCache(100) # 100 max length - - Retrieving from an LRUCache object:: - - cache.get('nonexisting', 'foo') # will return 'foo' - cache.get('nonexisting') # will return None - cache.get('existing') # will return the value for existing - - Adding to an LRUCache object:: - - cache.put('key', 'value') # will add the key 'key' with the value 'value' + Changelog + ========= - Clearing an LRUCache:: + 0.6 (2012-07-12) + ---------------- - cache.clear() + - Added a 'CacheMaker' helper class: a maker keeps references (by name) + to the caches it creates, to permit them to be cleared. - Decorator - --------- + - Added statistics to each cache, tracking lookups, hits, misses, and + evictions. - A ``lru_cache`` decorator exists. All values passed to the decorated - function must be hashable. It does not support keyword arguments:: + - Automated building Sphinx docs and testing example snippets under ``tox``. - from repoze.lru import lru_cache + - Added Sphinx documentation. - @lru_cache(500) - def expensive_function(*arg): - pass + - Dropped support for Python 2.5. - Each function decorated with the lru_cache decorator uses its own - cache related to that function. + - Added support for PyPy. + - Added ``setup.py docs`` alias (installs ``Sphinx`` and dependencies). - Changelog - ========= + - Added ``setup.py dev`` alias (runs ``develop`` plus installs ``nose`` + and ``coverage``). - After 0.5 - --------- + - Added support for CI under supported Pythons using ``tox``. - Bug: Remove potential race condition on lock in face of interrupts (Issue #10). @@ -108,7 +94,6 @@ Platform: UNKNOWN Classifier: Intended Audience :: Developers Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 2.5 Classifier: Programming Language :: Python :: 2.6 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/repoze.lru-0.5/repoze.lru.egg-info/SOURCES.txt new/repoze.lru-0.6/repoze.lru.egg-info/SOURCES.txt --- old/repoze.lru-0.5/repoze.lru.egg-info/SOURCES.txt 2012-03-24 19:12:34.000000000 +0100 +++ new/repoze.lru-0.6/repoze.lru.egg-info/SOURCES.txt 2012-07-12 20:48:37.000000000 +0200 @@ -7,6 +7,14 @@ setup.cfg setup.py tox.ini +docs/Makefile +docs/api.rst +docs/conf.py +docs/index.rst +docs/make.bat +docs/narr.rst +docs/_static/placeholder.txt +docs/_templates/placeholder.txt repoze/__init__.py repoze.lru.egg-info/PKG-INFO repoze.lru.egg-info/SOURCES.txt @@ -14,6 +22,7 @@ repoze.lru.egg-info/entry_points.txt repoze.lru.egg-info/namespace_packages.txt repoze.lru.egg-info/not-zip-safe +repoze.lru.egg-info/requires.txt repoze.lru.egg-info/top_level.txt repoze/lru/__init__.py repoze/lru/tests.py \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/repoze.lru-0.5/repoze.lru.egg-info/requires.txt new/repoze.lru-0.6/repoze.lru.egg-info/requires.txt --- old/repoze.lru-0.5/repoze.lru.egg-info/requires.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/repoze.lru-0.6/repoze.lru.egg-info/requires.txt 2012-07-12 20:48:37.000000000 +0200 @@ -0,0 +1,8 @@ + + +[docs] +Sphinx + +[testing] +nose +coverage \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/repoze.lru-0.5/setup.cfg new/repoze.lru-0.6/setup.cfg --- old/repoze.lru-0.5/setup.cfg 2012-03-24 19:12:34.000000000 +0100 +++ new/repoze.lru-0.6/setup.cfg 2012-07-12 20:48:37.000000000 +0200 @@ -8,6 +8,10 @@ cover-package = repoze.lru cover-erase = 1 +[aliases] +dev = develop easy_install repoze.lru[testing] +docs = develop easy_install repoze.lru[docs] + [egg_info] tag_build = tag_date = 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/repoze.lru-0.5/setup.py new/repoze.lru-0.6/setup.py --- old/repoze.lru-0.5/setup.py 2012-03-24 18:39:33.000000000 +0100 +++ new/repoze.lru-0.6/setup.py 2012-07-12 20:45:17.000000000 +0200 @@ -24,14 +24,15 @@ README = '' CHANGES = '' +testing_extras = ['nose', 'coverage'] + setup(name='repoze.lru', - version='0.5', + version='0.6', description='A tiny LRU cache implementation and decorator', long_description=README + '\n\n' + CHANGES, classifiers=[ "Intended Audience :: Developers", "Programming Language :: Python", - "Programming Language :: Python :: 2.5", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", @@ -54,5 +55,9 @@ test_suite="repoze.lru", entry_points = """\ """, - ) + extras_require = { + 'testing': testing_extras, + 'docs': ['Sphinx',], + } +) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/repoze.lru-0.5/tox.ini new/repoze.lru-0.6/tox.ini --- old/repoze.lru-0.5/tox.ini 2012-03-24 18:38:58.000000000 +0100 +++ new/repoze.lru-0.6/tox.ini 2012-06-11 23:09:27.000000000 +0200 @@ -1,47 +1,35 @@ [tox] envlist = - py25,py26,py27,py32,pypy + py26,py27,py32,pypy,cover,docs [testenv] commands = python setup.py test -q - -# timing race conditions in tests cause a test under Jython 2.5 to fail: - -#.F....................... -#====================================================================== -#FAIL: When timeout is given, decorator must eventually forget entries -#---------------------------------------------------------------------- -#Traceback (most recent call last): -# File "/home/chrism/projects/repoze.lru/.tox/jython/Lib/site-packages/repoze/l#ru/tests.py", line 512, in test_expiry -# self.assertTrue(stop - start > 0.1) -#AssertionError - -#[testenv:jython] -#commands = -# jython setup.py test -q - -# coverage reporting broken with namespace packages and pip/nose apparently. -# It's not a tox thing or is it related to setuptools vs. distribute; once -# tox creates the virtualenv with either setuptools or distribute, this -# command finds no tests to run -# -# .tox/cover/bin/python setup.py nosetests -# -# which means it's something to do with nose probably - -# [testenv:cover] -# basepython = -# python2.7 -# commands = -# python setup.py nosetests --with-xunit --with-xcoverage -# deps = -# nose -# coverage==3.4 -# nosexcover -# distribute = False +deps = + setuptools-git + virtualenv + +[testenv:cover] +basepython = + python2.6 +commands = + nosetests --with-xunit --with-xcoverage +deps = + setuptools-git + virtualenv + nose + coverage + nosexcover # we separate coverage into its own testenv because a) "last run wins" wrt # cobertura jenkins reporting and b) pypy and jython can't handle any # combination of versions of coverage and nosexcover that i can find. +[testenv:docs] +basepython = + python2.6 +commands = + sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html + sphinx-build -b doctest -d docs/_build/doctrees docs docs/_build/doctest +deps = + Sphinx -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
