pboot 4.0.1__tar.gz → 4.0.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 (109) hide show
  1. {pboot-4.0.1 → pboot-4.0.2}/CHANGES.rst +10 -0
  2. {pboot-4.0.1 → pboot-4.0.2}/PKG-INFO +1 -1
  3. {pboot-4.0.1 → pboot-4.0.2}/pyproject.toml +1 -1
  4. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/__init__.py +1 -1
  5. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/blueprints.py +12 -0
  6. {pboot-4.0.1 → pboot-4.0.2}/tests/test_blueprints.py +24 -0
  7. {pboot-4.0.1 → pboot-4.0.2}/LICENSE.txt +0 -0
  8. {pboot-4.0.1 → pboot-4.0.2}/README.md +0 -0
  9. {pboot-4.0.1 → pboot-4.0.2}/docs/_static/pboot-logo.svg +0 -0
  10. {pboot-4.0.1 → pboot-4.0.2}/docs/migration-from-flask.md +0 -0
  11. {pboot-4.0.1 → pboot-4.0.2}/examples/api/app.py +0 -0
  12. {pboot-4.0.1 → pboot-4.0.2}/examples/basic/app.py +0 -0
  13. {pboot-4.0.1 → pboot-4.0.2}/examples/templates/app.py +0 -0
  14. {pboot-4.0.1 → pboot-4.0.2}/examples/templates/templates/index.html +0 -0
  15. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/__main__.py +0 -0
  16. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/_body_limit.py +0 -0
  17. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/_compat/__init__.py +0 -0
  18. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/_compat/shared.py +0 -0
  19. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/_compat/v2.py +0 -0
  20. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/_datastructures.py +0 -0
  21. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/_form_limits.py +0 -0
  22. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/_import.py +0 -0
  23. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/_local.py +0 -0
  24. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/app.py +0 -0
  25. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/applications.py +0 -0
  26. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/background.py +0 -0
  27. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/cli.py +0 -0
  28. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/compat.py +0 -0
  29. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/concurrency.py +0 -0
  30. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/config.py +0 -0
  31. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/ctx.py +0 -0
  32. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/datastructures.py +0 -0
  33. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/debughelpers.py +0 -0
  34. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/dependencies/__init__.py +0 -0
  35. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/dependencies/models.py +0 -0
  36. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/dependencies/utils.py +0 -0
  37. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/encoders.py +0 -0
  38. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/exception_handlers.py +0 -0
  39. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/exceptions.py +0 -0
  40. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/globals.py +0 -0
  41. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/helpers.py +0 -0
  42. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/json/__init__.py +0 -0
  43. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/json/provider.py +0 -0
  44. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/json/tag.py +0 -0
  45. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/logger.py +0 -0
  46. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/logging.py +0 -0
  47. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/middleware/__init__.py +0 -0
  48. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/middleware/asyncexitstack.py +0 -0
  49. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/middleware/cors.py +0 -0
  50. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/middleware/gzip.py +0 -0
  51. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/middleware/httpsredirect.py +0 -0
  52. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/middleware/trustedhost.py +0 -0
  53. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/middleware/wsgi.py +0 -0
  54. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/openapi/__init__.py +0 -0
  55. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/openapi/constants.py +0 -0
  56. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/openapi/docs.py +0 -0
  57. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/openapi/models.py +0 -0
  58. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/openapi/utils.py +0 -0
  59. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/param_functions.py +0 -0
  60. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/params.py +0 -0
  61. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/py.typed +0 -0
  62. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/requests.py +0 -0
  63. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/responses.py +0 -0
  64. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/routing.py +0 -0
  65. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/sansio/__init__.py +0 -0
  66. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/sansio/app.py +0 -0
  67. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/sansio/blueprints.py +0 -0
  68. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/sansio/scaffold.py +0 -0
  69. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/security/__init__.py +0 -0
  70. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/security/api_key.py +0 -0
  71. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/security/base.py +0 -0
  72. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/security/http.py +0 -0
  73. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/security/oauth2.py +0 -0
  74. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/security/open_id_connect_url.py +0 -0
  75. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/security/utils.py +0 -0
  76. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/sessions.py +0 -0
  77. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/signals.py +0 -0
  78. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/sse.py +0 -0
  79. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/staticfiles.py +0 -0
  80. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/telemetry/__init__.py +0 -0
  81. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/telemetry/_api.py +0 -0
  82. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/telemetry/_asgi.py +0 -0
  83. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/telemetry/_runtime.py +0 -0
  84. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/templating.py +0 -0
  85. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/testclient.py +0 -0
  86. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/testing.py +0 -0
  87. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/types.py +0 -0
  88. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/typing.py +0 -0
  89. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/utils.py +0 -0
  90. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/views.py +0 -0
  91. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/websockets.py +0 -0
  92. {pboot-4.0.1 → pboot-4.0.2}/src/pboot/wrappers.py +0 -0
  93. {pboot-4.0.1 → pboot-4.0.2}/tests/conftest.py +0 -0
  94. {pboot-4.0.1 → pboot-4.0.2}/tests/templates/hello.html +0 -0
  95. {pboot-4.0.1 → pboot-4.0.2}/tests/test_appctx.py +0 -0
  96. {pboot-4.0.1 → pboot-4.0.2}/tests/test_basic.py +0 -0
  97. {pboot-4.0.1 → pboot-4.0.2}/tests/test_cli.py +0 -0
  98. {pboot-4.0.1 → pboot-4.0.2}/tests/test_compat_api.py +0 -0
  99. {pboot-4.0.1 → pboot-4.0.2}/tests/test_config.py +0 -0
  100. {pboot-4.0.1 → pboot-4.0.2}/tests/test_error_handlers.py +0 -0
  101. {pboot-4.0.1 → pboot-4.0.2}/tests/test_fastapi.py +0 -0
  102. {pboot-4.0.1 → pboot-4.0.2}/tests/test_helpers.py +0 -0
  103. {pboot-4.0.1 → pboot-4.0.2}/tests/test_json.py +0 -0
  104. {pboot-4.0.1 → pboot-4.0.2}/tests/test_reqctx.py +0 -0
  105. {pboot-4.0.1 → pboot-4.0.2}/tests/test_session.py +0 -0
  106. {pboot-4.0.1 → pboot-4.0.2}/tests/test_signals.py +0 -0
  107. {pboot-4.0.1 → pboot-4.0.2}/tests/test_templating.py +0 -0
  108. {pboot-4.0.1 → pboot-4.0.2}/tests/test_testing.py +0 -0
  109. {pboot-4.0.1 → pboot-4.0.2}/tests/test_views.py +0 -0
@@ -1,3 +1,13 @@
1
+ Version 4.0.2
2
+ -------------
3
+
4
+ Released 2026-12-02
5
+
6
+ - Fix the endpoint names of the FastAPI style routes registered on a
7
+ blueprint. They are now prefixed with the blueprint name, so that
8
+ ``url_for("api.item")`` works the same way as for the Flask style
9
+ routes.
10
+
1
11
  Version 4.0.1
2
12
  -------------
3
13
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pboot
3
- Version: 4.0.1
3
+ Version: 4.0.2
4
4
  Summary: A Pydantic/FastAPI-based framework for building complex web applications.
5
5
  Keywords: web,framework,asgi,fastapi,flask,pydantic,starlette
6
6
  Maintainer: pboot-org
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pboot"
3
- version = "4.0.1"
3
+ version = "4.0.2"
4
4
  description = "A Pydantic/FastAPI-based framework for building complex web applications."
5
5
  readme = "README.md"
6
6
  license = "BSD-3-Clause"
@@ -5,7 +5,7 @@ Flask-style application API: application contexts, sessions, templates,
5
5
  blueprints, signals, a test client and a command line interface.
6
6
  """
7
7
 
8
- __version__ = "4.0.1"
8
+ __version__ = "4.0.2"
9
9
 
10
10
  from starlette import status as status
11
11
 
@@ -401,6 +401,18 @@ class Blueprint:
401
401
  app.register_error_handler(code_or_exception, f)
402
402
 
403
403
  if self.router.routes:
404
+ # 端点名与 Flask 保持一致, 形如 "蓝图名.视图名"。
405
+ if not hasattr(self, "_original_route_names"):
406
+ self._original_route_names = {
407
+ id(route): t.cast("t.Any", route).name
408
+ for route in self.router.routes
409
+ }
410
+
411
+ for route in self.router.routes:
412
+ named = t.cast("t.Any", route)
413
+ original = self._original_route_names.get(id(route), named.name)
414
+ named.name = f"{full_name}.{original}"
415
+
404
416
  app.include_router(self.router, prefix=self.url_prefix or "")
405
417
 
406
418
  app.blueprints[full_name] = self
@@ -205,3 +205,27 @@ def test_blueprint_method_decorators(app, client):
205
205
 
206
206
  assert client.post("/create").json() == {"created": True}
207
207
  assert client.delete("/remove").json() == {"removed": True}
208
+
209
+
210
+ def test_blueprint_url_for_fastapi_style(app):
211
+ bp = Blueprint("api", __name__, url_prefix="/api")
212
+
213
+ @bp.get("/items/{item_id}")
214
+ async def item(item_id: int):
215
+ return {"id": item_id}
216
+
217
+ app.register_blueprint(bp)
218
+
219
+ assert app.url_for("api.item", item_id=3) == "/api/items/3"
220
+
221
+
222
+ def test_blueprint_url_for_flask_style(app):
223
+ bp = Blueprint("api", __name__, url_prefix="/api")
224
+
225
+ @bp.route("/hello/<name>")
226
+ async def hello(name):
227
+ return name
228
+
229
+ app.register_blueprint(bp)
230
+
231
+ assert app.url_for("api.hello", name="x") == "/api/hello/x"
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
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
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
File without changes
File without changes