xtr-http-kernel 5.0.0__tar.gz → 5.1.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.
Files changed (84) hide show
  1. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/PKG-INFO +19 -15
  2. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/README.md +18 -14
  3. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/pyproject.toml +1 -1
  4. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/pyproject.toml.orig +1 -1
  5. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/.agents/skills/xtr-http-kernel/SKILL.md +12 -9
  6. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/.agents/skills/xtr-http-kernel/references/configure.md +1 -1
  7. xtr_http_kernel-5.1.0/src/xtr_http_kernel/recipe/files/config/http_kernel.py.tmpl +27 -0
  8. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/recipe/manifest.toml +7 -5
  9. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/LICENSE +0 -0
  10. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/.agents/skills/xtr-http-kernel/references/listeners.md +0 -0
  11. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/.agents/skills/xtr-http-kernel/references/rate-limits.md +0 -0
  12. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/.agents/skills/xtr-http-kernel/references/routing.md +0 -0
  13. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/__init__.py +0 -0
  14. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/_kernel_middleware.py +0 -0
  15. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/_route_contexts.py +0 -0
  16. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/_staging.py +0 -0
  17. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/_state.py +0 -0
  18. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/bridge/__init__.py +0 -0
  19. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/bridge/_headers.py +0 -0
  20. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/bridge/_media_types.py +0 -0
  21. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/bridge/_scope_uri.py +0 -0
  22. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/bridge/_server_params.py +0 -0
  23. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/bridge/http_message_factory.py +0 -0
  24. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/bridge/http_message_factory_interface.py +0 -0
  25. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/bridge/response.py +0 -0
  26. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/bridge/response_factory.py +0 -0
  27. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/bridge/served_connection.py +0 -0
  28. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/bridge/starlette_http_factory.py +0 -0
  29. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/bridge/starlette_http_factory_interface.py +0 -0
  30. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/bundle/__init__.py +0 -0
  31. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/bundle/_messages.py +0 -0
  32. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/bundle/http_kernel_bundle.py +0 -0
  33. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/bundle/http_kernel_config.py +0 -0
  34. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/bundle/request_lifecycle_middleware_factory.py +0 -0
  35. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/bundle/route_registry_pass.py +0 -0
  36. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/command/__init__.py +0 -0
  37. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/command/debug_router_command.py +0 -0
  38. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/command/route_description.py +0 -0
  39. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/command/router_command.py +0 -0
  40. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/command/router_match_command.py +0 -0
  41. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/event/__init__.py +0 -0
  42. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/event/exception_event.py +0 -0
  43. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/event/finish_request_event.py +0 -0
  44. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/event/request_event.py +0 -0
  45. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/event/response_event.py +0 -0
  46. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/event/terminate_event.py +0 -0
  47. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/event_listener/__init__.py +0 -0
  48. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/event_listener/disallow_robots_indexing_listener.py +0 -0
  49. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/event_listener/error_logging_listener.py +0 -0
  50. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/event_listener/log_unit_listener.py +0 -0
  51. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/event_listener/rate_limit_headers_listener.py +0 -0
  52. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/event_listener/request_id_listener.py +0 -0
  53. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/exception/__init__.py +0 -0
  54. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/exception/http_kernel_error.py +0 -0
  55. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/exception/invalid_argument_error.py +0 -0
  56. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/exception/invalid_cookie_error.py +0 -0
  57. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/exception/invalid_middleware_priority_error.py +0 -0
  58. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/exception/invalid_rate_limit_error.py +0 -0
  59. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/exception/ranged_response_body_error.py +0 -0
  60. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/exception/response_already_a_message_error.py +0 -0
  61. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/exception/streamed_response_body_error.py +0 -0
  62. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/exception/too_many_requests_error.py +0 -0
  63. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/exception/unknown_rate_limiter_error.py +0 -0
  64. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/exception/unsupported_connection_error.py +0 -0
  65. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/kernel_events.py +0 -0
  66. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/middleware_stack.py +0 -0
  67. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/middleware_tag.py +0 -0
  68. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/py.typed +0 -0
  69. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/rate_limiter/__init__.py +0 -0
  70. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/rate_limiter/_applied_rate_limit.py +0 -0
  71. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/rate_limiter/rate_limited.py +0 -0
  72. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/recipe/__init__.py +0 -0
  73. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/request_lifecycle_middleware.py +0 -0
  74. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/routing/__init__.py +0 -0
  75. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/routing/decorator/__init__.py +0 -0
  76. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/routing/decorator/as_route_resource.py +0 -0
  77. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/routing/decorator/as_routes.py +0 -0
  78. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/routing/exception/__init__.py +0 -0
  79. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/routing/exception/invalid_argument_error.py +0 -0
  80. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/routing/exception/route_conflict_error.py +0 -0
  81. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/routing/exception/routing_error.py +0 -0
  82. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/routing/route_registry.py +0 -0
  83. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/setup.py +0 -0
  84. {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/testing.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xtr-http-kernel
3
- Version: 5.0.0
3
+ Version: 5.1.0
4
4
  Summary: Requests turned into responses through events: a request lifecycle for FastAPI applications on the xtr kernel.
5
5
  Keywords: http,kernel,request,lifecycle,events,middleware,fastapi
6
6
  Author: Xterr
@@ -484,10 +484,11 @@ removing it undoes.
484
484
  parser a submitted form with files in it is read with: building the request as a message
485
485
  asks the web framework for the form behind every multipart body, and the framework refuses
486
486
  outright where that parser is missing.
487
- - **Recipe** — `uv run xtr-recipes recipes:sync` does the *Activate* step below: it lists
488
- `HttpKernelBundle`. There is no config file, environment or ignore line to write; it prints the
487
+ - **Recipe** — `uv run xtr-recipes recipes:sync` does the *Activate* and *Configure* steps below:
488
+ it lists `HttpKernelBundle` and writes `<app>/config/packages/http_kernel.py` with the bundle's
489
+ own defaults. There is no environment or ignore line to write; it prints the
489
490
  `setup(app, kernel)` step, which a recipe cannot make for you.
490
- - **Activate** — `HttpKernelBundle: {"all": True}` in `BUNDLES` in `<app>/bundles.py`, imported
491
+ - **Activate** — `HttpKernelBundle: {"all": True}` in `BUNDLES` in `<app>/config/bundles.py`, imported
491
492
  from `xtr_http_kernel.bundle`. Then call `setup(app, kernel)` where the application is built.
492
493
  - **Brings along** — the [event dispatcher](../xtr-event-dispatcher) bundle always, because the
493
494
  lifecycle dispatches through it; the [logging](../xtr-logging), [console](../xtr-console) and
@@ -496,16 +497,19 @@ removing it undoes.
496
497
  package is not installed. Listing is not what activates them; installing the package is. No
497
498
  bundle comes along for the messages: neither message package ships one, and this bundle
498
499
  registers their services itself.
499
- - **Configure** — nothing is required: the zero-config path gives every request a fresh `uuid4`
500
- id under `X-Request-Id` — an inbound one is not trusted — no robots header, and the `request`
501
- log channel, and makes the request and the response of a request askable as
502
- [messages](#the-request-and-the-response-as-messages). A
503
- `<app>/config/http_kernel.py` `@configure` function returning an `HttpKernelConfig` changes
504
- that — see [Configure](#configure) and [Kernel / bundle](#kernel--bundle).
500
+ - **Configure** — nothing is required: the recipe writes `<app>/config/packages/http_kernel.py`
501
+ holding the lifecycle defaults — every request a fresh `uuid4` id under `X-Request-Id`, an
502
+ inbound one is not trusted, no robots header, the `request` log channel, and the request and
503
+ the response of a request askable as
504
+ [messages](#the-request-and-the-response-as-messages). Changing what that `@configure`
505
+ function returns changes that — see [Configure](#configure) and
506
+ [Kernel / bundle](#kernel--bundle).
505
507
  - **Environment** — nothing.
506
508
  - **Ignore** — nothing.
507
- - **Remove** — drop the `setup(app, kernel)` call, drop the `BUNDLES` entry, delete
508
- `<app>/config/http_kernel.py` if you wrote one, then `uv remove xtr-http-kernel`.
509
+ - **Remove** — drop the `setup(app, kernel)` call, drop the `BUNDLES` entry;
510
+ `uv run xtr-recipes recipes:remove xtr-http-kernel` deletes
511
+ `<app>/config/packages/http_kernel.py`, unless you edited it, in which case it is moved aside
512
+ to `http_kernel.py.removed`. Then `uv remove xtr-http-kernel`.
509
513
  - **Check** — `debug:bundles` shows `http_kernel` as `listed` and `active`, `event_dispatcher`
510
514
  as `required`, and (when those packages are installed) `logging` and `console` as `required`;
511
515
  `debug:router` lists the application's routes.
@@ -544,17 +548,17 @@ config resolves after logging's, so it cannot declare a name it does not yet kno
544
548
  ## Kernel / bundle
545
549
 
546
550
  An application using [xtr-dependency-injection](../xtr-dependency-injection) lists
547
- `HttpKernelBundle` in its `app/bundles.py`:
551
+ `HttpKernelBundle` in its `app/config/bundles.py`:
548
552
 
549
553
  ```python
550
- # app/bundles.py
554
+ # app/config/bundles.py
551
555
  from xtr_http_kernel.bundle import HttpKernelBundle
552
556
 
553
557
  BUNDLES = {HttpKernelBundle: {"all": True}}
554
558
  ```
555
559
 
556
560
  ```python
557
- # app/config/http_kernel.py
561
+ # app/config/packages/http_kernel.py
558
562
  from xtr_dependency_injection import configure
559
563
 
560
564
  from xtr_http_kernel.bundle import HttpKernelConfig
@@ -454,10 +454,11 @@ removing it undoes.
454
454
  parser a submitted form with files in it is read with: building the request as a message
455
455
  asks the web framework for the form behind every multipart body, and the framework refuses
456
456
  outright where that parser is missing.
457
- - **Recipe** — `uv run xtr-recipes recipes:sync` does the *Activate* step below: it lists
458
- `HttpKernelBundle`. There is no config file, environment or ignore line to write; it prints the
457
+ - **Recipe** — `uv run xtr-recipes recipes:sync` does the *Activate* and *Configure* steps below:
458
+ it lists `HttpKernelBundle` and writes `<app>/config/packages/http_kernel.py` with the bundle's
459
+ own defaults. There is no environment or ignore line to write; it prints the
459
460
  `setup(app, kernel)` step, which a recipe cannot make for you.
460
- - **Activate** — `HttpKernelBundle: {"all": True}` in `BUNDLES` in `<app>/bundles.py`, imported
461
+ - **Activate** — `HttpKernelBundle: {"all": True}` in `BUNDLES` in `<app>/config/bundles.py`, imported
461
462
  from `xtr_http_kernel.bundle`. Then call `setup(app, kernel)` where the application is built.
462
463
  - **Brings along** — the [event dispatcher](../xtr-event-dispatcher) bundle always, because the
463
464
  lifecycle dispatches through it; the [logging](../xtr-logging), [console](../xtr-console) and
@@ -466,16 +467,19 @@ removing it undoes.
466
467
  package is not installed. Listing is not what activates them; installing the package is. No
467
468
  bundle comes along for the messages: neither message package ships one, and this bundle
468
469
  registers their services itself.
469
- - **Configure** — nothing is required: the zero-config path gives every request a fresh `uuid4`
470
- id under `X-Request-Id` — an inbound one is not trusted — no robots header, and the `request`
471
- log channel, and makes the request and the response of a request askable as
472
- [messages](#the-request-and-the-response-as-messages). A
473
- `<app>/config/http_kernel.py` `@configure` function returning an `HttpKernelConfig` changes
474
- that — see [Configure](#configure) and [Kernel / bundle](#kernel--bundle).
470
+ - **Configure** — nothing is required: the recipe writes `<app>/config/packages/http_kernel.py`
471
+ holding the lifecycle defaults — every request a fresh `uuid4` id under `X-Request-Id`, an
472
+ inbound one is not trusted, no robots header, the `request` log channel, and the request and
473
+ the response of a request askable as
474
+ [messages](#the-request-and-the-response-as-messages). Changing what that `@configure`
475
+ function returns changes that — see [Configure](#configure) and
476
+ [Kernel / bundle](#kernel--bundle).
475
477
  - **Environment** — nothing.
476
478
  - **Ignore** — nothing.
477
- - **Remove** — drop the `setup(app, kernel)` call, drop the `BUNDLES` entry, delete
478
- `<app>/config/http_kernel.py` if you wrote one, then `uv remove xtr-http-kernel`.
479
+ - **Remove** — drop the `setup(app, kernel)` call, drop the `BUNDLES` entry;
480
+ `uv run xtr-recipes recipes:remove xtr-http-kernel` deletes
481
+ `<app>/config/packages/http_kernel.py`, unless you edited it, in which case it is moved aside
482
+ to `http_kernel.py.removed`. Then `uv remove xtr-http-kernel`.
479
483
  - **Check** — `debug:bundles` shows `http_kernel` as `listed` and `active`, `event_dispatcher`
480
484
  as `required`, and (when those packages are installed) `logging` and `console` as `required`;
481
485
  `debug:router` lists the application's routes.
@@ -514,17 +518,17 @@ config resolves after logging's, so it cannot declare a name it does not yet kno
514
518
  ## Kernel / bundle
515
519
 
516
520
  An application using [xtr-dependency-injection](../xtr-dependency-injection) lists
517
- `HttpKernelBundle` in its `app/bundles.py`:
521
+ `HttpKernelBundle` in its `app/config/bundles.py`:
518
522
 
519
523
  ```python
520
- # app/bundles.py
524
+ # app/config/bundles.py
521
525
  from xtr_http_kernel.bundle import HttpKernelBundle
522
526
 
523
527
  BUNDLES = {HttpKernelBundle: {"all": True}}
524
528
  ```
525
529
 
526
530
  ```python
527
- # app/config/http_kernel.py
531
+ # app/config/packages/http_kernel.py
528
532
  from xtr_dependency_injection import configure
529
533
 
530
534
  from xtr_http_kernel.bundle import HttpKernelConfig
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "xtr-http-kernel"
3
- version = "5.0.0"
3
+ version = "5.1.0"
4
4
  description = "Requests turned into responses through events: a request lifecycle for FastAPI applications on the xtr kernel."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "xtr-http-kernel"
3
- version = "5.0.0"
3
+ version = "5.1.0"
4
4
  description = "Requests turned into responses through events: a request lifecycle for FastAPI applications on the xtr kernel."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -335,25 +335,26 @@ tests serving one application must not run at the same time.
335
335
  ## Use in an application
336
336
 
337
337
  `uv run xtr-recipes recipes:sync` applies the recipe shipped with this package: it lists
338
- `HttpKernelBundle`. That is the steps below a recipe can do; the `setup(app, kernel)` step it
339
- prints for you to make.
338
+ `HttpKernelBundle` and writes `<app>/config/packages/http_kernel.py` with the bundle's own
339
+ defaults. That is the steps below a recipe can do; the `setup(app, kernel)` step it prints for you
340
+ to make.
340
341
 
341
342
  1. **Install** `uv add xtr-http-kernel`. Installed beside it, xtr-logging adds the listeners that
342
343
  write to a log, xtr-console the router commands, xtr-rate-limiter the rate limits. None is
343
344
  needed to serve requests. The two message packages come with it, and so does the parser a
344
345
  submitted form with files in it is read with: building the request as a message asks the
345
346
  framework for the form behind every multipart body.
346
- 2. **Activate** `HttpKernelBundle: {"all": True}` in `BUNDLES` in `<app>/bundles.py`, imported
347
+ 2. **Activate** `HttpKernelBundle: {"all": True}` in `BUNDLES` in `<app>/config/bundles.py`, imported
347
348
  from `xtr_http_kernel.bundle`, then call `setup(app, kernel)` where the application is built.
348
349
  3. **Brings along** the event dispatcher bundle always; the logging, console and rate limiter
349
350
  bundles whenever those packages are installed. Installing the package is what activates them,
350
351
  not listing.
351
- 4. **Configure** nothing by default: a fresh `uuid4` id under
352
- `X-Request-Id` per request (an inbound one is not trusted), no robots header, the `request`
353
- log channel.
352
+ 4. **Configure** the recipe writes `<app>/config/packages/http_kernel.py` holding the lifecycle
353
+ defaults: a fresh `uuid4` id under `X-Request-Id` per request (an inbound one is not trusted),
354
+ no robots header, the `request` log channel.
354
355
 
355
356
  ```python
356
- # <app>/config/http_kernel.py
357
+ # <app>/config/packages/http_kernel.py
357
358
  from xtr_dependency_injection import configure
358
359
 
359
360
  from xtr_http_kernel.bundle import HttpKernelConfig
@@ -372,8 +373,10 @@ prints for you to make.
372
373
  7. **Check** `debug:bundles` shows `http_kernel` as `listed` and `active`, `event_dispatcher` as
373
374
  `required`. With a console bundle, `debug:router` lists the routes in the order routing tries
374
375
  them, and `router:match PATH [--method GET]` names the route a path reaches.
375
- 8. **Remove** drop the `setup(app, kernel)` call, drop the `BUNDLES` entry, delete
376
- `<app>/config/http_kernel.py`, then `uv remove xtr-http-kernel`.
376
+ 8. **Remove** drop the `setup(app, kernel)` call, drop the `BUNDLES` entry;
377
+ `uv run xtr-recipes recipes:remove xtr-http-kernel` deletes
378
+ `<app>/config/packages/http_kernel.py`, unless you edited it, in which case it is moved aside
379
+ to `http_kernel.py.removed`. Then `uv remove xtr-http-kernel`.
377
380
 
378
381
  ## Errors
379
382
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  A frozen dataclass buildable with no arguments; every field has a default. Import it from
4
4
  `xtr_http_kernel.bundle` and return it from a `@configure` function in
5
- `<app>/config/http_kernel.py`.
5
+ `<app>/config/packages/http_kernel.py`.
6
6
 
7
7
  ```python
8
8
  from xtr_dependency_injection import configure
@@ -0,0 +1,27 @@
1
+ """The request lifecycle: request ids, the error log, and the application the commands read.
2
+
3
+ ```python
4
+ HttpKernelConfig(app="${app}.web.app:app", disallow_search_indexing=True)
5
+ ```
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ from xtr_dependency_injection import configure
11
+ from xtr_http_kernel.bundle import HttpKernelConfig
12
+
13
+ __all__ = ["http_kernel"]
14
+
15
+
16
+ @configure
17
+ def http_kernel() -> HttpKernelConfig:
18
+ """A fresh request id per request, and uncaught errors written to the request channel."""
19
+ # Set app to the "package.module:app" the router commands load, so debug:router and
20
+ # router:match need no --app.
21
+ #
22
+ # Every response echoes the X-Request-Id header, unless request_id_header names another.
23
+ # trust_request_id keeps the id a caller sent: turn it on only behind a proxy you control.
24
+ #
25
+ # disallow_search_indexing marks every response noindex; log_channel names the channel
26
+ # uncaught errors are written to.
27
+ return HttpKernelConfig()
@@ -5,11 +5,13 @@
5
5
  # "<module>:<class>" = the environments it is listed with, exactly as in BUNDLES.
6
6
  "xtr_http_kernel.bundle:HttpKernelBundle" = { all = true }
7
7
 
8
- # No [files]: nothing is required. With no configuration a request gets a uuid4
9
- # id under X-Request-Id, no robots header, and the "request" log channel; an
10
- # application changing any of that writes config/http_kernel.py itself. A
11
- # bundle's recipe writing a routes file under config/routes/ gets that package
12
- # created by xtr-recipes itself.
8
+ [files]
9
+ # Destination under the application package = template under this recipe.
10
+ # The bundle's own defaults written out — a uuid4 id under X-Request-Id, no
11
+ # robots header, the "request" log channel — as the place to change them and to
12
+ # name the application the router commands read. A bundle's recipe writing a
13
+ # routes file under config/routes/ gets that package created by xtr-recipes.
14
+ "config/packages/http_kernel.py" = "files/config/http_kernel.py.tmpl"
13
15
 
14
16
  # No [env], and nothing to ignore.
15
17
 
File without changes