cachetools 6.2.2__tar.gz → 6.2.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. {cachetools-6.2.2 → cachetools-6.2.4}/CHANGELOG.rst +20 -0
  2. {cachetools-6.2.2/src/cachetools.egg-info → cachetools-6.2.4}/PKG-INFO +6 -7
  3. {cachetools-6.2.2 → cachetools-6.2.4}/docs/index.rst +6 -0
  4. cachetools-6.2.4/pyproject.toml +52 -0
  5. cachetools-6.2.4/setup.cfg +4 -0
  6. {cachetools-6.2.2 → cachetools-6.2.4}/src/cachetools/__init__.py +5 -4
  7. {cachetools-6.2.2 → cachetools-6.2.4}/src/cachetools/_cached.py +4 -1
  8. {cachetools-6.2.2 → cachetools-6.2.4}/src/cachetools/keys.py +2 -1
  9. {cachetools-6.2.2 → cachetools-6.2.4/src/cachetools.egg-info}/PKG-INFO +6 -7
  10. {cachetools-6.2.2 → cachetools-6.2.4}/src/cachetools.egg-info/SOURCES.txt +0 -2
  11. {cachetools-6.2.2 → cachetools-6.2.4}/tox.ini +1 -0
  12. cachetools-6.2.2/pyproject.toml +0 -3
  13. cachetools-6.2.2/setup.cfg +0 -50
  14. cachetools-6.2.2/setup.py +0 -3
  15. {cachetools-6.2.2 → cachetools-6.2.4}/LICENSE +0 -0
  16. {cachetools-6.2.2 → cachetools-6.2.4}/MANIFEST.in +0 -0
  17. {cachetools-6.2.2 → cachetools-6.2.4}/README.rst +0 -0
  18. {cachetools-6.2.2 → cachetools-6.2.4}/docs/conf.py +0 -0
  19. {cachetools-6.2.2 → cachetools-6.2.4}/src/cachetools/_cachedmethod.py +0 -0
  20. {cachetools-6.2.2 → cachetools-6.2.4}/src/cachetools/func.py +0 -0
  21. {cachetools-6.2.2 → cachetools-6.2.4}/src/cachetools.egg-info/dependency_links.txt +0 -0
  22. {cachetools-6.2.2 → cachetools-6.2.4}/src/cachetools.egg-info/top_level.txt +0 -0
  23. {cachetools-6.2.2 → cachetools-6.2.4}/tests/__init__.py +0 -0
  24. {cachetools-6.2.2 → cachetools-6.2.4}/tests/test_cache.py +0 -0
  25. {cachetools-6.2.2 → cachetools-6.2.4}/tests/test_cached.py +0 -0
  26. {cachetools-6.2.2 → cachetools-6.2.4}/tests/test_cachedmethod.py +0 -0
  27. {cachetools-6.2.2 → cachetools-6.2.4}/tests/test_fifo.py +0 -0
  28. {cachetools-6.2.2 → cachetools-6.2.4}/tests/test_func.py +0 -0
  29. {cachetools-6.2.2 → cachetools-6.2.4}/tests/test_keys.py +0 -0
  30. {cachetools-6.2.2 → cachetools-6.2.4}/tests/test_lfu.py +0 -0
  31. {cachetools-6.2.2 → cachetools-6.2.4}/tests/test_lru.py +0 -0
  32. {cachetools-6.2.2 → cachetools-6.2.4}/tests/test_rr.py +0 -0
  33. {cachetools-6.2.2 → cachetools-6.2.4}/tests/test_tlru.py +0 -0
  34. {cachetools-6.2.2 → cachetools-6.2.4}/tests/test_ttl.py +0 -0
@@ -1,3 +1,23 @@
1
+ v6.2.4 (2025-12-15)
2
+ ===================
3
+
4
+ - Fix license information displayed on PyPI be using an updated
5
+ version of ``twine`` for uploading.
6
+
7
+
8
+ v6.2.3 (2025-12-12)
9
+ ===================
10
+
11
+ - Improve documentation regarding ``@cachedmethod`` with ``condition``
12
+ parameter.
13
+
14
+ - Minor style and readability improvements.
15
+
16
+ - Modernize build environment.
17
+
18
+ - Update CI environment.
19
+
20
+
1
21
  v6.2.2 (2025-11-13)
2
22
  ===================
3
23
 
@@ -1,15 +1,13 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cachetools
3
- Version: 6.2.2
3
+ Version: 6.2.4
4
4
  Summary: Extensible memoizing collections and decorators
5
- Home-page: https://github.com/tkem/cachetools/
6
- Author: Thomas Kemmer
7
- Author-email: tkemmer@computer.org
8
- License: MIT
5
+ Author-email: Thomas Kemmer <tkemmer@computer.org>
6
+ Maintainer-email: Thomas Kemmer <tkemmer@computer.org>
7
+ License-Expression: MIT
8
+ Project-URL: Homepage, https://github.com/tkem/cachetools/
9
9
  Classifier: Development Status :: 5 - Production/Stable
10
- Classifier: Environment :: Other Environment
11
10
  Classifier: Intended Audience :: Developers
12
- Classifier: License :: OSI Approved :: MIT License
13
11
  Classifier: Operating System :: OS Independent
14
12
  Classifier: Programming Language :: Python
15
13
  Classifier: Programming Language :: Python :: 3
@@ -21,6 +19,7 @@ Classifier: Programming Language :: Python :: 3.13
21
19
  Classifier: Programming Language :: Python :: 3.14
22
20
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
21
  Requires-Python: >=3.9
22
+ Description-Content-Type: text/x-rst
24
23
  License-File: LICENSE
25
24
  Dynamic: license-file
26
25
 
@@ -555,6 +555,12 @@ often called with the same arguments:
555
555
  function, :func:`cachetools.keys.methodkey`, ignores its first
556
556
  argument, i.e. :const:`self`. This has mostly historical reasons,
557
557
  but also ensures that :const:`self` does not have to be hashable.
558
+
559
+ .. note::
560
+
561
+ Using :func:`cachedmethod` with a `condition` currently *does*
562
+ require :const:`self` be hashable, though.
563
+
558
564
  You may provide a different `key` function,
559
565
  e.g. :func:`cachetools.keys.hashkey`, if you need :const:`self` to
560
566
  be part of the cache key.
@@ -0,0 +1,52 @@
1
+ [build-system]
2
+ requires = ["setuptools >= 61.0.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "cachetools"
7
+ dynamic = ["version"]
8
+ description = "Extensible memoizing collections and decorators"
9
+ authors = [
10
+ {name = "Thomas Kemmer", email = "tkemmer@computer.org"}
11
+ ]
12
+ maintainers = [
13
+ {name = "Thomas Kemmer", email = "tkemmer@computer.org"}
14
+ ]
15
+ readme = "README.rst"
16
+ license = "MIT"
17
+ license-files = ["LICENSE"]
18
+ requires-python = ">= 3.9"
19
+ classifiers = [
20
+ "Development Status :: 5 - Production/Stable",
21
+ "Intended Audience :: Developers",
22
+ "Operating System :: OS Independent",
23
+ "Programming Language :: Python",
24
+ "Programming Language :: Python :: 3",
25
+ "Programming Language :: Python :: 3.9",
26
+ "Programming Language :: Python :: 3.10",
27
+ "Programming Language :: Python :: 3.11",
28
+ "Programming Language :: Python :: 3.12",
29
+ "Programming Language :: Python :: 3.13",
30
+ "Programming Language :: Python :: 3.14",
31
+ "Topic :: Software Development :: Libraries :: Python Modules",
32
+ ]
33
+
34
+ [project.urls]
35
+ Homepage = "https://github.com/tkem/cachetools/"
36
+
37
+ [tool.setuptools]
38
+ package-dir = {"" = "src"}
39
+
40
+ [tool.setuptools.packages.find]
41
+ where = ["src"]
42
+
43
+ [tool.setuptools.dynamic]
44
+ version = {attr = "cachetools.__version__"}
45
+
46
+ [tool.flake8]
47
+ max-line-length = 80
48
+ exclude = [".git", ".tox", "build"]
49
+ select = ["C", "E", "F", "W", "B", "B950", "I", "N"]
50
+ # F401: imported but unused (submodule shims)
51
+ # E501: line too long (black)
52
+ ignore = ["F401", "E501"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -12,7 +12,7 @@ __all__ = (
12
12
  "cachedmethod",
13
13
  )
14
14
 
15
- __version__ = "6.2.2"
15
+ __version__ = "6.2.4"
16
16
 
17
17
  import collections
18
18
  import collections.abc
@@ -154,9 +154,9 @@ class FIFOCache(Cache):
154
154
 
155
155
  def __setitem__(self, key, value, cache_setitem=Cache.__setitem__):
156
156
  cache_setitem(self, key, value)
157
- try:
157
+ if key in self.__order:
158
158
  self.__order.move_to_end(key)
159
- except KeyError:
159
+ else:
160
160
  self.__order[key] = None
161
161
 
162
162
  def __delitem__(self, key, cache_delitem=Cache.__delitem__):
@@ -204,7 +204,8 @@ class LFUCache(Cache):
204
204
  def __setitem__(self, key, value, cache_setitem=Cache.__setitem__):
205
205
  cache_setitem(self, key, value)
206
206
  if key in self.__links:
207
- return self.__touch(key)
207
+ self.__touch(key)
208
+ return
208
209
  root = self.__root
209
210
  link = root.next
210
211
  if link.count != 1:
@@ -109,8 +109,11 @@ def _unlocked_info(func, cache, key, info):
109
109
  cache.clear()
110
110
  hits = misses = 0
111
111
 
112
+ def cache_info():
113
+ return info(hits, misses)
114
+
112
115
  wrapper.cache_clear = cache_clear
113
- wrapper.cache_info = lambda: info(hits, misses)
116
+ wrapper.cache_info = cache_info
114
117
  return wrapper
115
118
 
116
119
 
@@ -38,7 +38,7 @@ def hashkey(*args, **kwargs):
38
38
  """Return a cache key for the specified hashable arguments."""
39
39
 
40
40
  if kwargs:
41
- return _HashedTuple(args + sum(sorted(kwargs.items()), _kwmark))
41
+ return _HashedTuple(args + _kwmark + tuple(sorted(kwargs.items())))
42
42
  else:
43
43
  return _HashedTuple(args)
44
44
 
@@ -53,6 +53,7 @@ def typedkey(*args, **kwargs):
53
53
 
54
54
  key = hashkey(*args, **kwargs)
55
55
  key += tuple(type(v) for v in args)
56
+ # TODO: avoid iterating twice over kwargs
56
57
  key += tuple(type(v) for _, v in sorted(kwargs.items()))
57
58
  return key
58
59
 
@@ -1,15 +1,13 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cachetools
3
- Version: 6.2.2
3
+ Version: 6.2.4
4
4
  Summary: Extensible memoizing collections and decorators
5
- Home-page: https://github.com/tkem/cachetools/
6
- Author: Thomas Kemmer
7
- Author-email: tkemmer@computer.org
8
- License: MIT
5
+ Author-email: Thomas Kemmer <tkemmer@computer.org>
6
+ Maintainer-email: Thomas Kemmer <tkemmer@computer.org>
7
+ License-Expression: MIT
8
+ Project-URL: Homepage, https://github.com/tkem/cachetools/
9
9
  Classifier: Development Status :: 5 - Production/Stable
10
- Classifier: Environment :: Other Environment
11
10
  Classifier: Intended Audience :: Developers
12
- Classifier: License :: OSI Approved :: MIT License
13
11
  Classifier: Operating System :: OS Independent
14
12
  Classifier: Programming Language :: Python
15
13
  Classifier: Programming Language :: Python :: 3
@@ -21,6 +19,7 @@ Classifier: Programming Language :: Python :: 3.13
21
19
  Classifier: Programming Language :: Python :: 3.14
22
20
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
21
  Requires-Python: >=3.9
22
+ Description-Content-Type: text/x-rst
24
23
  License-File: LICENSE
25
24
  Dynamic: license-file
26
25
 
@@ -3,8 +3,6 @@ LICENSE
3
3
  MANIFEST.in
4
4
  README.rst
5
5
  pyproject.toml
6
- setup.cfg
7
- setup.py
8
6
  tox.ini
9
7
  docs/conf.py
10
8
  docs/index.rst
@@ -33,6 +33,7 @@ deps =
33
33
  flake8-black
34
34
  flake8-bugbear
35
35
  flake8-import-order
36
+ flake8-pyproject
36
37
  commands =
37
38
  flake8
38
39
  skip_install = true
@@ -1,3 +0,0 @@
1
- [build-system]
2
- requires = ["setuptools >= 46.4.0", "wheel"]
3
- build-backend = "setuptools.build_meta"
@@ -1,50 +0,0 @@
1
- [metadata]
2
- name = cachetools
3
- version = attr: cachetools.__version__
4
- url = https://github.com/tkem/cachetools/
5
- author = Thomas Kemmer
6
- author_email = tkemmer@computer.org
7
- license = MIT
8
- license_files = LICENSE
9
- description = Extensible memoizing collections and decorators
10
- long_description = file: README.rst
11
- classifiers =
12
- Development Status :: 5 - Production/Stable
13
- Environment :: Other Environment
14
- Intended Audience :: Developers
15
- License :: OSI Approved :: MIT License
16
- Operating System :: OS Independent
17
- Programming Language :: Python
18
- Programming Language :: Python :: 3
19
- Programming Language :: Python :: 3.9
20
- Programming Language :: Python :: 3.10
21
- Programming Language :: Python :: 3.11
22
- Programming Language :: Python :: 3.12
23
- Programming Language :: Python :: 3.13
24
- Programming Language :: Python :: 3.14
25
- Topic :: Software Development :: Libraries :: Python Modules
26
-
27
- [options]
28
- package_dir =
29
- = src
30
- packages = find:
31
- python_requires = >= 3.9
32
-
33
- [options.packages.find]
34
- where = src
35
-
36
- [flake8]
37
- max-line-length = 80
38
- exclude = .git, .tox, build
39
- select = C, E, F, W, B, B950, I, N
40
- ignore = F401, E501
41
-
42
- [build_sphinx]
43
- source-dir = docs/
44
- build-dir = docs/_build
45
- all_files = 1
46
-
47
- [egg_info]
48
- tag_build =
49
- tag_date = 0
50
-
cachetools-6.2.2/setup.py DELETED
@@ -1,3 +0,0 @@
1
- from setuptools import setup
2
-
3
- setup()
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes