funkycache 1.0.0__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.
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2026 Alex Chan
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a
4
+ copy of this software and associated documentation files (the "Software"),
5
+ to deal in the Software without restriction, including without limitation
6
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
7
+ and/or sell copies of the Software, and to permit persons to whom the Software
8
+ is furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
17
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
18
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
19
+ OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,63 @@
1
+ Metadata-Version: 2.4
2
+ Name: funkycache
3
+ Version: 1.0.0
4
+ Summary: A SQLite-backed function cache that tracks file dependencies
5
+ Author-email: Alex Chan <alex@alexwlchan.net>
6
+ Maintainer-email: Alex Chan <alex@alexwlchan.net>
7
+ License-Expression: MIT
8
+ Project-URL: Homepage, https://alexwlchan.net/projects/funkycache/
9
+ Project-URL: Changelog, https://alexwlchan.net/projects/funkycache/releases/
10
+ Classifier: Development Status :: 5 - Production/Stable
11
+ Classifier: Programming Language :: Python :: 3.14
12
+ Requires-Python: >=3.14
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Requires-Dist: pydantic
16
+ Requires-Dist: xxhash
17
+ Dynamic: license-file
18
+
19
+ # funkycache
20
+
21
+ funkycache is a disk-backed cache for Python functions that tracks file dependencies.
22
+ I use it in my static site generator to cache the output of expensive functions.
23
+
24
+ Example:
25
+
26
+ ```python
27
+ from funkycache import FunkyCache
28
+
29
+ cache = FunkyCache(storage="sqlite")
30
+
31
+
32
+ @cache.register(files=["content/index.md", "templates/base.html"])
33
+ def render_index() -> str:
34
+ page = Path("content/index.md").read_text()
35
+ template = Path("templates/base.html").read_text()
36
+ return template.replace("{{ content }}", page)
37
+
38
+
39
+ print(render_index()) # runs the function
40
+ print(render_index()) # cache hit, even in a new process
41
+
42
+ cache.notify_path_change("content/index.md")
43
+
44
+ print(render_index()) # runs the function again
45
+ ```
46
+
47
+ When you register a function with funkycache, you can declare path or static values the function depends on.
48
+ If those dependent values change, the function's cache is invalidated, and the next call will rerun the function fresh.
49
+
50
+ **Note:** funkycache does not watch the filesystem.
51
+ It is your responsibility to notify it of changes to dependent files, or they will be noticed when the Python process restarts.
52
+
53
+ ## Installation
54
+
55
+ Install using pip:
56
+
57
+ ```console
58
+ $ pip install funkycache
59
+ ```
60
+
61
+ ## License
62
+
63
+ This project is shared under the [MIT license](./LICENSE).
@@ -0,0 +1,45 @@
1
+ # funkycache
2
+
3
+ funkycache is a disk-backed cache for Python functions that tracks file dependencies.
4
+ I use it in my static site generator to cache the output of expensive functions.
5
+
6
+ Example:
7
+
8
+ ```python
9
+ from funkycache import FunkyCache
10
+
11
+ cache = FunkyCache(storage="sqlite")
12
+
13
+
14
+ @cache.register(files=["content/index.md", "templates/base.html"])
15
+ def render_index() -> str:
16
+ page = Path("content/index.md").read_text()
17
+ template = Path("templates/base.html").read_text()
18
+ return template.replace("{{ content }}", page)
19
+
20
+
21
+ print(render_index()) # runs the function
22
+ print(render_index()) # cache hit, even in a new process
23
+
24
+ cache.notify_path_change("content/index.md")
25
+
26
+ print(render_index()) # runs the function again
27
+ ```
28
+
29
+ When you register a function with funkycache, you can declare path or static values the function depends on.
30
+ If those dependent values change, the function's cache is invalidated, and the next call will rerun the function fresh.
31
+
32
+ **Note:** funkycache does not watch the filesystem.
33
+ It is your responsibility to notify it of changes to dependent files, or they will be noticed when the Python process restarts.
34
+
35
+ ## Installation
36
+
37
+ Install using pip:
38
+
39
+ ```console
40
+ $ pip install funkycache
41
+ ```
42
+
43
+ ## License
44
+
45
+ This project is shared under the [MIT license](./LICENSE).
@@ -0,0 +1,63 @@
1
+ [build-system]
2
+ requires = [
3
+ "setuptools >= 65",
4
+ ]
5
+ build-backend = "setuptools.build_meta"
6
+
7
+ [project]
8
+ name = "funkycache"
9
+ description = "A SQLite-backed function cache that tracks file dependencies"
10
+ readme = "README.md"
11
+ authors = [
12
+ {name = "Alex Chan", email = "alex@alexwlchan.net"},
13
+ ]
14
+ maintainers = [
15
+ {name = "Alex Chan", email="alex@alexwlchan.net"},
16
+ ]
17
+ classifiers = [
18
+ "Development Status :: 5 - Production/Stable",
19
+ "Programming Language :: Python :: 3.14",
20
+ ]
21
+ requires-python = ">=3.14"
22
+ dependencies = ["pydantic", "xxhash"]
23
+ dynamic = ["version"]
24
+ license = "MIT"
25
+
26
+ [project.urls]
27
+ "Homepage" = "https://alexwlchan.net/projects/funkycache/"
28
+ "Changelog" = "https://alexwlchan.net/projects/funkycache/releases/"
29
+
30
+ [tool.setuptools.dynamic]
31
+ version = {attr = "funkycache.version.__version__"}
32
+
33
+ [tool.setuptools.packages.find]
34
+ where = ["src"]
35
+
36
+ [tool.setuptools.package-data]
37
+ nitrate = ["py.typed"]
38
+
39
+ [tool.coverage.run]
40
+ branch = true
41
+ source = ["funkycache", "tests"]
42
+ omit = [
43
+ "tests/bench_sqlite_storage.py",
44
+ ]
45
+
46
+ [tool.coverage.report]
47
+ show_missing = true
48
+ skip_covered = true
49
+ fail_under = 100
50
+
51
+ [tool.pytest.ini_options]
52
+ filterwarnings = ["error"]
53
+
54
+ [tool.ruff.lint]
55
+ select = ["D", "E", "F"]
56
+ ignore = [
57
+ "D107", # undocumented-public-init
58
+ "D200", # unnecessary-multiline-docstring
59
+ "D203", # incorrect-blank-line-before-class
60
+ "D205", # missing-blank-line-after-summary
61
+ "D211", # blank-line-before-class
62
+ "D212", # multi-line-summary-first-line
63
+ ]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,9 @@
1
+ """
2
+ funkycache is a function cache that tracks file dependencies.
3
+ """
4
+
5
+ from .manager import FunkyCache
6
+ from .storage import CannotOverwriteValueException
7
+ from .version import __version__
8
+
9
+ __all__ = ["CannotOverwriteValueException", "FunkyCache", "__version__"]