rn-forge-web 0.3.0__tar.gz → 0.3.1__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.
- {rn_forge_web-0.3.0 → rn_forge_web-0.3.1}/PKG-INFO +3 -3
- {rn_forge_web-0.3.0 → rn_forge_web-0.3.1}/pyproject.toml +13 -5
- {rn_forge_web-0.3.0 → rn_forge_web-0.3.1}/pyproject.toml.orig +38 -30
- {rn_forge_web-0.3.0 → rn_forge_web-0.3.1}/src/rn_forge/web/problem.py +59 -0
- {rn_forge_web-0.3.0 → rn_forge_web-0.3.1}/LICENSE +0 -0
- {rn_forge_web-0.3.0 → rn_forge_web-0.3.1}/README.md +0 -0
- {rn_forge_web-0.3.0 → rn_forge_web-0.3.1}/src/rn_forge/web/__init__.py +0 -0
- {rn_forge_web-0.3.0 → rn_forge_web-0.3.1}/src/rn_forge/web/asgi.py +0 -0
- {rn_forge_web-0.3.0 → rn_forge_web-0.3.1}/src/rn_forge/web/auth.py +0 -0
- {rn_forge_web-0.3.0 → rn_forge_web-0.3.1}/src/rn_forge/web/concurrency.py +0 -0
- {rn_forge_web-0.3.0 → rn_forge_web-0.3.1}/src/rn_forge/web/conformance/__init__.py +0 -0
- {rn_forge_web-0.3.0 → rn_forge_web-0.3.1}/src/rn_forge/web/conformance/cases.py +0 -0
- {rn_forge_web-0.3.0 → rn_forge_web-0.3.1}/src/rn_forge/web/conformance/types.py +0 -0
- {rn_forge_web-0.3.0 → rn_forge_web-0.3.1}/src/rn_forge/web/deprecation.py +0 -0
- {rn_forge_web-0.3.0 → rn_forge_web-0.3.1}/src/rn_forge/web/exceptions.py +0 -0
- {rn_forge_web-0.3.0 → rn_forge_web-0.3.1}/src/rn_forge/web/health.py +0 -0
- {rn_forge_web-0.3.0 → rn_forge_web-0.3.1}/src/rn_forge/web/idempotency.py +0 -0
- {rn_forge_web-0.3.0 → rn_forge_web-0.3.1}/src/rn_forge/web/merge_patch.py +0 -0
- {rn_forge_web-0.3.0 → rn_forge_web-0.3.1}/src/rn_forge/web/models.py +0 -0
- {rn_forge_web-0.3.0 → rn_forge_web-0.3.1}/src/rn_forge/web/openapi.py +0 -0
- {rn_forge_web-0.3.0 → rn_forge_web-0.3.1}/src/rn_forge/web/operations.py +0 -0
- {rn_forge_web-0.3.0 → rn_forge_web-0.3.1}/src/rn_forge/web/pagination.py +0 -0
- {rn_forge_web-0.3.0 → rn_forge_web-0.3.1}/src/rn_forge/web/py.typed +0 -0
- {rn_forge_web-0.3.0 → rn_forge_web-0.3.1}/src/rn_forge/web/read_mask.py +0 -0
- {rn_forge_web-0.3.0 → rn_forge_web-0.3.1}/src/rn_forge/web/security.py +0 -0
- {rn_forge_web-0.3.0 → rn_forge_web-0.3.1}/src/rn_forge/web/soft_delete.py +0 -0
- {rn_forge_web-0.3.0 → rn_forge_web-0.3.1}/src/rn_forge/web/tracing.py +0 -0
- {rn_forge_web-0.3.0 → rn_forge_web-0.3.1}/src/rn_forge/web/transfer.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rn-forge-web
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.1
|
|
4
4
|
Summary: Framework-agnostic HTTP/API primitives built on rn-forge-commons
|
|
5
5
|
Author: Rohit Narayanan
|
|
6
6
|
Author-email: Rohit Narayanan <rohit.nn@gmail.com>
|
|
@@ -13,10 +13,10 @@ Classifier: Programming Language :: Python :: 3
|
|
|
13
13
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.14
|
|
15
15
|
Classifier: Typing :: Typed
|
|
16
|
-
Requires-Dist: rn-forge-commons[pydantic]>=0.8.0,<0.
|
|
16
|
+
Requires-Dist: rn-forge-commons[pydantic]>=0.8.0,<0.10
|
|
17
17
|
Requires-Dist: opentelemetry-api>=1.44
|
|
18
18
|
Requires-Dist: secure>=2.0.1 ; extra == 'security'
|
|
19
|
-
Requires-Dist: assertpy>=
|
|
19
|
+
Requires-Dist: assertpy>=2.35 ; extra == 'testing'
|
|
20
20
|
Requires-Dist: pytest>=9.1.1 ; extra == 'testing'
|
|
21
21
|
Requires-Python: >=3.14
|
|
22
22
|
Project-URL: Documentation, https://rn-forge.github.io/pykit/packages/rn-forge-web/latest/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "rn-forge-web"
|
|
3
|
-
version = "0.3.
|
|
3
|
+
version = "0.3.1"
|
|
4
4
|
description = "Framework-agnostic HTTP/API primitives built on rn-forge-commons"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "MIT"
|
|
@@ -16,7 +16,7 @@ classifiers = [
|
|
|
16
16
|
]
|
|
17
17
|
requires-python = ">=3.14"
|
|
18
18
|
dependencies = [
|
|
19
|
-
"rn-forge-commons[pydantic]>=0.8.0,<0.
|
|
19
|
+
"rn-forge-commons[pydantic]>=0.8.0,<0.10",
|
|
20
20
|
"opentelemetry-api>=1.44",
|
|
21
21
|
]
|
|
22
22
|
|
|
@@ -26,7 +26,7 @@ email = "rohit.nn@gmail.com"
|
|
|
26
26
|
|
|
27
27
|
[project.optional-dependencies]
|
|
28
28
|
testing = [
|
|
29
|
-
"assertpy>=
|
|
29
|
+
"assertpy>=2.35",
|
|
30
30
|
"pytest>=9.1.1",
|
|
31
31
|
]
|
|
32
32
|
security = ["secure>=2.0.1"]
|
|
@@ -38,11 +38,19 @@ Changelog = "https://github.com/rn-forge/pykit/blob/main/packages/rn-forge-web/C
|
|
|
38
38
|
Issues = "https://github.com/rn-forge/pykit/issues"
|
|
39
39
|
|
|
40
40
|
[build-system]
|
|
41
|
-
requires = ["uv_build>=0.
|
|
41
|
+
requires = ["uv_build>=0.13.7,<0.14.0"]
|
|
42
42
|
build-backend = "uv_build"
|
|
43
43
|
|
|
44
|
+
[tool.pyright]
|
|
45
|
+
typeCheckingMode = "strict"
|
|
46
|
+
reportMissingTypeStubs = false
|
|
47
|
+
reportUnnecessaryTypeIgnoreComment = "error"
|
|
48
|
+
venv = ".venv"
|
|
49
|
+
venvPath = "../.."
|
|
50
|
+
|
|
44
51
|
[tool.uv.build-backend]
|
|
45
52
|
module-name = "rn_forge.web"
|
|
53
|
+
source-exclude = ["**/.DS_Store"]
|
|
46
54
|
|
|
47
55
|
[tool.uv.sources.rn-forge-auth]
|
|
48
56
|
workspace = true
|
|
@@ -60,7 +68,7 @@ markers = ["unit: fast isolated tests"]
|
|
|
60
68
|
|
|
61
69
|
[dependency-groups]
|
|
62
70
|
dev = [
|
|
63
|
-
"assertpy>=
|
|
71
|
+
"assertpy>=2.35",
|
|
64
72
|
"opentelemetry-instrumentation-asgi>=0.65b0",
|
|
65
73
|
"opentelemetry-sdk>=1.44",
|
|
66
74
|
"pyright>=1.1.411",
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "rn-forge-web"
|
|
3
|
-
version = "0.3.
|
|
3
|
+
version = "0.3.1"
|
|
4
4
|
description = "Framework-agnostic HTTP/API primitives built on rn-forge-commons"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
authors = [{ name = "Rohit Narayanan", email = "rohit.nn@gmail.com" }]
|
|
7
7
|
license = "MIT"
|
|
8
8
|
license-files = ["LICENSE"]
|
|
9
9
|
classifiers = [
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
"Development Status :: 3 - Alpha",
|
|
11
|
+
"Intended Audience :: Developers",
|
|
12
|
+
"Operating System :: OS Independent",
|
|
13
|
+
"Programming Language :: Python :: 3",
|
|
14
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
15
|
+
"Programming Language :: Python :: 3.14",
|
|
16
|
+
"Typing :: Typed",
|
|
17
17
|
]
|
|
18
18
|
requires-python = ">=3.14"
|
|
19
19
|
# Internal requirements are version ranges (ADR-0004).
|
|
@@ -22,12 +22,12 @@ requires-python = ">=3.14"
|
|
|
22
22
|
# `opentelemetry-api`, following OpenTelemetry's own library guidance (a no-op
|
|
23
23
|
# until the application configures the SDK). See "Dependencies and why" in README.md.
|
|
24
24
|
dependencies = [
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
"rn-forge-commons[pydantic]>=0.8.0,<0.10",
|
|
26
|
+
"opentelemetry-api>=1.44",
|
|
27
27
|
]
|
|
28
28
|
|
|
29
29
|
[project.optional-dependencies]
|
|
30
|
-
testing = ["assertpy>=
|
|
30
|
+
testing = ["assertpy>=2.35", "pytest>=9.1.1"]
|
|
31
31
|
# `rn_forge.web.security` only. `secure` is framework-agnostic (no dependencies
|
|
32
32
|
# of its own) and emits the OWASP header preset directly, so it is wrapped
|
|
33
33
|
# rather than hand-rolled.
|
|
@@ -40,11 +40,19 @@ Changelog = "https://github.com/rn-forge/pykit/blob/main/packages/rn-forge-web/C
|
|
|
40
40
|
Issues = "https://github.com/rn-forge/pykit/issues"
|
|
41
41
|
|
|
42
42
|
[build-system]
|
|
43
|
-
requires = ["uv_build>=0.
|
|
43
|
+
requires = ["uv_build>=0.13.7,<0.14.0"]
|
|
44
44
|
build-backend = "uv_build"
|
|
45
45
|
|
|
46
|
+
[tool.pyright]
|
|
47
|
+
typeCheckingMode = "strict"
|
|
48
|
+
reportMissingTypeStubs = false
|
|
49
|
+
reportUnnecessaryTypeIgnoreComment = "error"
|
|
50
|
+
venv = ".venv"
|
|
51
|
+
venvPath = "../.."
|
|
52
|
+
|
|
46
53
|
[tool.uv.build-backend]
|
|
47
54
|
module-name = "rn_forge.web"
|
|
55
|
+
source-exclude = ["**/.DS_Store"]
|
|
48
56
|
|
|
49
57
|
[tool.uv.sources]
|
|
50
58
|
rn-forge-auth = { workspace = true }
|
|
@@ -58,24 +66,24 @@ markers = ["unit: fast isolated tests"]
|
|
|
58
66
|
|
|
59
67
|
[dependency-groups]
|
|
60
68
|
dev = [
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
"assertpy>=2.35",
|
|
70
|
+
"opentelemetry-instrumentation-asgi>=0.65b0",
|
|
71
|
+
"opentelemetry-sdk>=1.44",
|
|
72
|
+
"pyright>=1.1.411",
|
|
73
|
+
"pytest>=9.1.1",
|
|
74
|
+
"pytest-asyncio>=1.3.0",
|
|
75
|
+
"pytest-cov>=7.1.0",
|
|
76
|
+
"pytest-randomly>=4.1.0",
|
|
77
|
+
# The guide examples, which the tests run, import rn-forge-auth.
|
|
78
|
+
"rn-forge-auth>=0.1.0,<0.2",
|
|
79
|
+
"rn-forge-web[security]",
|
|
80
|
+
"ruff>=0.15.21",
|
|
73
81
|
]
|
|
74
82
|
docs = [
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
83
|
+
"mkdocs>=1.6.1",
|
|
84
|
+
"mkdocs-material>=9.7.6",
|
|
85
|
+
"mkdocstrings[python]>=1.0.6",
|
|
86
|
+
"opentelemetry-instrumentation-asgi>=0.65b0",
|
|
87
|
+
"rn-forge-auth>=0.1.0,<0.2",
|
|
88
|
+
"rn-forge-web[security]",
|
|
81
89
|
]
|
|
@@ -220,6 +220,57 @@ class ProblemRegistry:
|
|
|
220
220
|
self._rows[exc_type] = problem
|
|
221
221
|
return self
|
|
222
222
|
|
|
223
|
+
def register_hierarchy(
|
|
224
|
+
self,
|
|
225
|
+
base: type[Exception],
|
|
226
|
+
*,
|
|
227
|
+
code_attr: str = "code",
|
|
228
|
+
status_attr: str = "status_code",
|
|
229
|
+
) -> Self:
|
|
230
|
+
"""Register a row for *base* and every subclass, returning ``self``.
|
|
231
|
+
|
|
232
|
+
Each class gets ``ProblemType(code, status, phrase)``: its *code_attr*
|
|
233
|
+
is the slug, its *status_attr* the HTTP status, and the title is that
|
|
234
|
+
status's IANA reason phrase. The attributes are read with ``getattr``,
|
|
235
|
+
so a subclass inherits them or overrides them. Classes are walked depth
|
|
236
|
+
first, base first, in ``__subclasses__()`` order, each once; only
|
|
237
|
+
classes already imported are seen.
|
|
238
|
+
|
|
239
|
+
Args:
|
|
240
|
+
base: The root of the exception hierarchy.
|
|
241
|
+
code_attr: The class attribute holding the slug.
|
|
242
|
+
status_attr: The class attribute holding the HTTP status.
|
|
243
|
+
|
|
244
|
+
Raises:
|
|
245
|
+
TypeError: A class in the hierarchy has no *code_attr* or no
|
|
246
|
+
*status_attr*; the message names the class and the attribute.
|
|
247
|
+
ValueError: A class's status has no IANA reason phrase.
|
|
248
|
+
|
|
249
|
+
Example::
|
|
250
|
+
|
|
251
|
+
class AppError(Exception):
|
|
252
|
+
code = "app-error"
|
|
253
|
+
status_code = 500
|
|
254
|
+
|
|
255
|
+
class OrderLocked(AppError):
|
|
256
|
+
code = "order-locked"
|
|
257
|
+
status_code = 409
|
|
258
|
+
|
|
259
|
+
registry.register_hierarchy(AppError)
|
|
260
|
+
"""
|
|
261
|
+
pending: list[type[Exception]] = [base]
|
|
262
|
+
seen: set[type[Exception]] = set()
|
|
263
|
+
while pending:
|
|
264
|
+
cls = pending.pop()
|
|
265
|
+
if cls in seen:
|
|
266
|
+
continue
|
|
267
|
+
seen.add(cls)
|
|
268
|
+
slug = _required_attr(cls, code_attr)
|
|
269
|
+
status = _required_attr(cls, status_attr)
|
|
270
|
+
self.register(cls, ProblemType(slug, status, HTTPStatus(status).phrase))
|
|
271
|
+
pending.extend(reversed(cls.__subclasses__()))
|
|
272
|
+
return self
|
|
273
|
+
|
|
223
274
|
@property
|
|
224
275
|
def fallback(self) -> ProblemType:
|
|
225
276
|
"""The row an unregistered exception resolves to."""
|
|
@@ -335,6 +386,14 @@ class ProblemRegistry:
|
|
|
335
386
|
)
|
|
336
387
|
|
|
337
388
|
|
|
389
|
+
def _required_attr(cls: type[Exception], name: str) -> Any:
|
|
390
|
+
"""Return ``cls.<name>``, raising :class:`TypeError` when it is missing."""
|
|
391
|
+
try:
|
|
392
|
+
return getattr(cls, name)
|
|
393
|
+
except AttributeError:
|
|
394
|
+
raise TypeError(f"{cls.__qualname__} has no {name!r} attribute") from None
|
|
395
|
+
|
|
396
|
+
|
|
338
397
|
def _status_phrase(status: int) -> str:
|
|
339
398
|
"""Return the IANA reason phrase for *status*, or the status as a string.
|
|
340
399
|
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|