fastapi-cachex 0.3.1__tar.gz → 0.3.2__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 (37) hide show
  1. {fastapi_cachex-0.3.1 → fastapi_cachex-0.3.2}/PKG-INFO +1 -1
  2. {fastapi_cachex-0.3.1 → fastapi_cachex-0.3.2}/fastapi_cachex/cache.py +13 -3
  3. fastapi_cachex-0.3.2/pyproject.toml +189 -0
  4. fastapi_cachex-0.3.1/pyproject.toml → fastapi_cachex-0.3.2/pyproject.toml.orig +2 -2
  5. {fastapi_cachex-0.3.1 → fastapi_cachex-0.3.2}/README.md +0 -0
  6. {fastapi_cachex-0.3.1 → fastapi_cachex-0.3.2}/fastapi_cachex/__init__.py +0 -0
  7. {fastapi_cachex-0.3.1 → fastapi_cachex-0.3.2}/fastapi_cachex/backends/__init__.py +0 -0
  8. {fastapi_cachex-0.3.1 → fastapi_cachex-0.3.2}/fastapi_cachex/backends/base.py +0 -0
  9. {fastapi_cachex-0.3.1 → fastapi_cachex-0.3.2}/fastapi_cachex/backends/config.py +0 -0
  10. {fastapi_cachex-0.3.1 → fastapi_cachex-0.3.2}/fastapi_cachex/backends/memcached.py +0 -0
  11. {fastapi_cachex-0.3.1 → fastapi_cachex-0.3.2}/fastapi_cachex/backends/memory.py +0 -0
  12. {fastapi_cachex-0.3.1 → fastapi_cachex-0.3.2}/fastapi_cachex/backends/redis.py +0 -0
  13. {fastapi_cachex-0.3.1 → fastapi_cachex-0.3.2}/fastapi_cachex/dependencies.py +0 -0
  14. {fastapi_cachex-0.3.1 → fastapi_cachex-0.3.2}/fastapi_cachex/directives.py +0 -0
  15. {fastapi_cachex-0.3.1 → fastapi_cachex-0.3.2}/fastapi_cachex/exceptions.py +0 -0
  16. {fastapi_cachex-0.3.1 → fastapi_cachex-0.3.2}/fastapi_cachex/manager.py +0 -0
  17. {fastapi_cachex-0.3.1 → fastapi_cachex-0.3.2}/fastapi_cachex/manager_proxy.py +0 -0
  18. {fastapi_cachex-0.3.1 → fastapi_cachex-0.3.2}/fastapi_cachex/proxy.py +0 -0
  19. {fastapi_cachex-0.3.1 → fastapi_cachex-0.3.2}/fastapi_cachex/py.typed +0 -0
  20. {fastapi_cachex-0.3.1 → fastapi_cachex-0.3.2}/fastapi_cachex/routes.py +0 -0
  21. {fastapi_cachex-0.3.1 → fastapi_cachex-0.3.2}/fastapi_cachex/session/__init__.py +0 -0
  22. {fastapi_cachex-0.3.1 → fastapi_cachex-0.3.2}/fastapi_cachex/session/config.py +0 -0
  23. {fastapi_cachex-0.3.1 → fastapi_cachex-0.3.2}/fastapi_cachex/session/dependencies.py +0 -0
  24. {fastapi_cachex-0.3.1 → fastapi_cachex-0.3.2}/fastapi_cachex/session/exceptions.py +0 -0
  25. {fastapi_cachex-0.3.1 → fastapi_cachex-0.3.2}/fastapi_cachex/session/manager.py +0 -0
  26. {fastapi_cachex-0.3.1 → fastapi_cachex-0.3.2}/fastapi_cachex/session/middleware.py +0 -0
  27. {fastapi_cachex-0.3.1 → fastapi_cachex-0.3.2}/fastapi_cachex/session/models.py +0 -0
  28. {fastapi_cachex-0.3.1 → fastapi_cachex-0.3.2}/fastapi_cachex/session/proxy.py +0 -0
  29. {fastapi_cachex-0.3.1 → fastapi_cachex-0.3.2}/fastapi_cachex/session/security.py +0 -0
  30. {fastapi_cachex-0.3.1 → fastapi_cachex-0.3.2}/fastapi_cachex/session/token_serializers.py +0 -0
  31. {fastapi_cachex-0.3.1 → fastapi_cachex-0.3.2}/fastapi_cachex/state/__init__.py +0 -0
  32. {fastapi_cachex-0.3.1 → fastapi_cachex-0.3.2}/fastapi_cachex/state/dependencies.py +0 -0
  33. {fastapi_cachex-0.3.1 → fastapi_cachex-0.3.2}/fastapi_cachex/state/exceptions.py +0 -0
  34. {fastapi_cachex-0.3.1 → fastapi_cachex-0.3.2}/fastapi_cachex/state/manager.py +0 -0
  35. {fastapi_cachex-0.3.1 → fastapi_cachex-0.3.2}/fastapi_cachex/state/models.py +0 -0
  36. {fastapi_cachex-0.3.1 → fastapi_cachex-0.3.2}/fastapi_cachex/state/proxy.py +0 -0
  37. {fastapi_cachex-0.3.1 → fastapi_cachex-0.3.2}/fastapi_cachex/types.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastapi-cachex
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: A caching library for FastAPI with support for Cache-Control, ETag, and multiple backends.
5
5
  Keywords: fastapi,cache,etag,cache-control,redis,memcached,in-memory
6
6
  Author: allen0099
@@ -151,11 +151,21 @@ async def get_response(
151
151
  msg = "Route not found in request scope"
152
152
  raise CacheXError(msg)
153
153
 
154
- # FastAPI <= 0.136.x stores a DefaultPlaceholder; >= 0.137.0 stores the class directly.
155
- # getattr with a fallback handles both without importing the internal class.
154
+ # A placeholder means this route uses the application default. Unwrap the
155
+ # application value instead of calling the route's DefaultPlaceholder.
156
+ route_response_class = route.response_class
157
+ application_default_response_class = __request.app.router.default_response_class
156
158
  response_class: type[Response] = cast(
157
159
  "type[Response]",
158
- getattr(route.response_class, "value", route.response_class),
160
+ (
161
+ getattr(
162
+ application_default_response_class,
163
+ "value",
164
+ application_default_response_class,
165
+ )
166
+ if hasattr(route_response_class, "value")
167
+ else route_response_class
168
+ ),
159
169
  )
160
170
 
161
171
  # Convert non-Response result to Response using appropriate response_class
@@ -0,0 +1,189 @@
1
+ [project]
2
+ name = "fastapi-cachex"
3
+ version = "0.3.2"
4
+ description = "A caching library for FastAPI with support for Cache-Control, ETag, and multiple backends."
5
+ readme = "README.md"
6
+ requires-python = ">=3.10"
7
+ license = "Apache-2.0"
8
+ classifiers = [
9
+ "Development Status :: 3 - Alpha",
10
+ "Intended Audience :: Developers",
11
+ "Programming Language :: Python",
12
+ "Programming Language :: Python :: 3",
13
+ "Programming Language :: Python :: 3.10",
14
+ "Programming Language :: Python :: 3.11",
15
+ "Programming Language :: Python :: 3.12",
16
+ "Programming Language :: Python :: 3.13",
17
+ "Programming Language :: Python :: 3.14",
18
+ "Programming Language :: Python :: 3 :: Only",
19
+ "Framework :: FastAPI",
20
+ "Topic :: Software Development :: Libraries :: Python Modules",
21
+ "Topic :: Internet :: WWW/HTTP :: HTTP Servers",
22
+ ]
23
+ keywords = [
24
+ "fastapi",
25
+ "cache",
26
+ "etag",
27
+ "cache-control",
28
+ "redis",
29
+ "memcached",
30
+ "in-memory",
31
+ ]
32
+ dependencies = [
33
+ "fastapi",
34
+ "pydantic",
35
+ ]
36
+
37
+ [[project.authors]]
38
+ name = "allen0099"
39
+ email = "s96016641@gmail.com"
40
+
41
+ [project.urls]
42
+ Homepage = "https://github.com/allen0099/FastAPI-CacheX"
43
+ Repository = "https://github.com/allen0099/FastAPI-CacheX.git"
44
+ Issues = "https://github.com/allen0099/FastAPI-CacheX/issues"
45
+
46
+ [project.optional-dependencies]
47
+ memcache = ["pymemcache"]
48
+ redis = [
49
+ "redis[hiredis]>=5.3.0",
50
+ "orjson",
51
+ ]
52
+ jwt = ["PyJWT>=2.9.0"]
53
+ starlette = ["itsdangerous"]
54
+
55
+ [dependency-groups]
56
+ dev = [
57
+ "coverage>=7.8.0",
58
+ "httpx>=0.28.1",
59
+ "mypy>=1.15.0",
60
+ "orjson>=3.10.16",
61
+ "pre-commit>=4.2.0",
62
+ "pymemcache>=4.0.0",
63
+ "pytest>=8.3.5",
64
+ "pytest-asyncio>=0.26.0",
65
+ "pytest-cov>=6.1.0",
66
+ "redis[hiredis]>=5.3.0",
67
+ "ruff>=0.11.2",
68
+ "tox>=4.25.0",
69
+ "tox-uv>=1.29.0",
70
+ "ty>=0.0.1a34",
71
+ "types-orjson>=3.6.2",
72
+ "types-redis>=4.6.0.20241004",
73
+ ]
74
+
75
+ [build-system]
76
+ requires = ["uv_build>=0.12,<0.13"]
77
+ build-backend = "uv_build"
78
+
79
+ [tool.uv.build-backend]
80
+ module-root = ""
81
+ include = ["fastapi_cachex/py.typed"]
82
+
83
+ [tool.pytest.ini_options]
84
+ pythonpath = ["."]
85
+ asyncio_default_fixture_loop_scope = "function"
86
+
87
+ [tool.ruff.lint]
88
+ ignore = [
89
+ "E501",
90
+ "ANN401",
91
+ "COM812",
92
+ "B008",
93
+ "B904",
94
+ "FBT001",
95
+ "FBT002",
96
+ "S105",
97
+ "C901",
98
+ ]
99
+ preview = true
100
+ explicit-preview-rules = true
101
+ extend-select = ["ALL"]
102
+
103
+ [tool.ruff.lint.isort]
104
+ force-single-line = true
105
+
106
+ [tool.ruff.lint.pyupgrade]
107
+ keep-runtime-typing = true
108
+
109
+ [tool.ruff.lint.per-file-ignores]
110
+ "tests/**" = [
111
+ "D",
112
+ "S101",
113
+ "S106",
114
+ "ARG",
115
+ "ANN",
116
+ "B011",
117
+ "BLE",
118
+ "PLR",
119
+ "SLF",
120
+ "PLC0415",
121
+ "PT031",
122
+ ]
123
+ "fastapi_cachex/cache.py" = [
124
+ "PLR0913",
125
+ "PLR0915",
126
+ "PLR0911",
127
+ "PLR0912",
128
+ "S101",
129
+ ]
130
+ "fastapi_cachex/backends/memcached.py" = ["PLC0415"]
131
+ "fastapi_cachex/backends/redis.py" = [
132
+ "PLR0913",
133
+ "PLC0415",
134
+ ]
135
+ "fastapi_cachex/proxy.py" = ["PLW0603"]
136
+ "fastapi_cachex/session/manager.py" = ["PLR0915"]
137
+ "fastapi_cachex/session/middleware.py" = ["PLC0415"]
138
+
139
+ [tool.ruff.lint.pydocstyle]
140
+ convention = "google"
141
+
142
+ [tool.ruff.format]
143
+ docstring-code-format = true
144
+
145
+ [tool.ty.src]
146
+ exclude = ["./.serena/"]
147
+
148
+ [tool.coverage.run]
149
+ source = ["fastapi_cachex"]
150
+ omit = ["tests/*"]
151
+ branch = true
152
+
153
+ [tool.coverage.report]
154
+ exclude_lines = [
155
+ "pragma: no cover",
156
+ "def __repr__",
157
+ "if TYPE_CHECKING:",
158
+ "raise NotImplementedError",
159
+ "if __name__ == .__main__.:",
160
+ "pass",
161
+ '\.\.\.',
162
+ ]
163
+ fail_under = 90
164
+ show_missing = true
165
+
166
+ [tool.mypy]
167
+ python_version = "3.10"
168
+ plugins = ["pydantic.mypy"]
169
+ warn_redundant_casts = true
170
+ warn_unused_ignores = true
171
+ disallow_any_generics = true
172
+ check_untyped_defs = true
173
+ disallow_untyped_defs = true
174
+ disallow_incomplete_defs = true
175
+ disallow_untyped_decorators = true
176
+ no_implicit_optional = true
177
+ warn_return_any = true
178
+ warn_unreachable = true
179
+ strict_optional = true
180
+ strict_equality = true
181
+
182
+ [[tool.mypy.overrides]]
183
+ module = ["tests.*"]
184
+ disallow_untyped_defs = false
185
+ disallow_incomplete_defs = false
186
+
187
+ [[tool.mypy.overrides]]
188
+ module = ["pymemcache.*"]
189
+ ignore_missing_imports = true
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "fastapi-cachex"
3
- version = "0.3.1"
3
+ version = "0.3.2"
4
4
  description = "A caching library for FastAPI with support for Cache-Control, ETag, and multiple backends."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -61,7 +61,7 @@ jwt = ["PyJWT>=2.9.0"]
61
61
  starlette = ["itsdangerous"]
62
62
 
63
63
  [build-system]
64
- requires = ["uv_build>=0.11.26,<0.12"]
64
+ requires = ["uv_build>=0.12,<0.13"]
65
65
  build-backend = "uv_build"
66
66
 
67
67
  [tool.uv.build-backend]
File without changes