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.
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/PKG-INFO +19 -15
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/README.md +18 -14
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/pyproject.toml +1 -1
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/pyproject.toml.orig +1 -1
- {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
- {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
- xtr_http_kernel-5.1.0/src/xtr_http_kernel/recipe/files/config/http_kernel.py.tmpl +27 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/recipe/manifest.toml +7 -5
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/LICENSE +0 -0
- {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
- {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
- {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
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/__init__.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/_kernel_middleware.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/_route_contexts.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/_staging.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/_state.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/bridge/__init__.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/bridge/_headers.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/bridge/_media_types.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/bridge/_scope_uri.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/bridge/_server_params.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/bridge/http_message_factory.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/bridge/http_message_factory_interface.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/bridge/response.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/bridge/response_factory.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/bridge/served_connection.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/bridge/starlette_http_factory.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/bridge/starlette_http_factory_interface.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/bundle/__init__.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/bundle/_messages.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/bundle/http_kernel_bundle.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/bundle/http_kernel_config.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/bundle/request_lifecycle_middleware_factory.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/bundle/route_registry_pass.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/command/__init__.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/command/debug_router_command.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/command/route_description.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/command/router_command.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/command/router_match_command.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/event/__init__.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/event/exception_event.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/event/finish_request_event.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/event/request_event.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/event/response_event.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/event/terminate_event.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/event_listener/__init__.py +0 -0
- {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
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/event_listener/error_logging_listener.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/event_listener/log_unit_listener.py +0 -0
- {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
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/event_listener/request_id_listener.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/exception/__init__.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/exception/http_kernel_error.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/exception/invalid_argument_error.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/exception/invalid_cookie_error.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/exception/invalid_middleware_priority_error.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/exception/invalid_rate_limit_error.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/exception/ranged_response_body_error.py +0 -0
- {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
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/exception/streamed_response_body_error.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/exception/too_many_requests_error.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/exception/unknown_rate_limiter_error.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/exception/unsupported_connection_error.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/kernel_events.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/middleware_stack.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/middleware_tag.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/py.typed +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/rate_limiter/__init__.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/rate_limiter/_applied_rate_limit.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/rate_limiter/rate_limited.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/recipe/__init__.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/request_lifecycle_middleware.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/routing/__init__.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/routing/decorator/__init__.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/routing/decorator/as_route_resource.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/routing/decorator/as_routes.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/routing/exception/__init__.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/routing/exception/invalid_argument_error.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/routing/exception/route_conflict_error.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/routing/exception/routing_error.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/routing/route_registry.py +0 -0
- {xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/setup.py +0 -0
- {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.
|
|
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*
|
|
488
|
-
`HttpKernelBundle
|
|
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
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
that — see [Configure](#configure) and
|
|
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
|
|
508
|
-
|
|
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*
|
|
458
|
-
`HttpKernelBundle
|
|
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
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
that — see [Configure](#configure) and
|
|
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
|
|
478
|
-
|
|
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
|
|
@@ -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
|
|
339
|
-
prints for you
|
|
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**
|
|
352
|
-
`X-Request-Id` per request (an inbound one is not trusted),
|
|
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
|
|
376
|
-
|
|
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
|
-
|
|
9
|
-
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
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
|
|
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
|
{xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/bridge/_server_params.py
RENAMED
|
File without changes
|
{xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/bridge/http_message_factory.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/bridge/response_factory.py
RENAMED
|
File without changes
|
{xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/bridge/served_connection.py
RENAMED
|
File without changes
|
{xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/bridge/starlette_http_factory.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/bundle/http_kernel_bundle.py
RENAMED
|
File without changes
|
{xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/bundle/http_kernel_config.py
RENAMED
|
File without changes
|
|
File without changes
|
{xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/bundle/route_registry_pass.py
RENAMED
|
File without changes
|
|
File without changes
|
{xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/command/debug_router_command.py
RENAMED
|
File without changes
|
{xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/command/route_description.py
RENAMED
|
File without changes
|
{xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/command/router_command.py
RENAMED
|
File without changes
|
{xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/command/router_match_command.py
RENAMED
|
File without changes
|
|
File without changes
|
{xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/event/exception_event.py
RENAMED
|
File without changes
|
{xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/event/finish_request_event.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/event/terminate_event.py
RENAMED
|
File without changes
|
{xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/event_listener/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/exception/http_kernel_error.py
RENAMED
|
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
|
{xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/rate_limiter/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/rate_limiter/rate_limited.py
RENAMED
|
File without changes
|
|
File without changes
|
{xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/request_lifecycle_middleware.py
RENAMED
|
File without changes
|
|
File without changes
|
{xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/routing/decorator/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/routing/decorator/as_routes.py
RENAMED
|
File without changes
|
{xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/routing/exception/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{xtr_http_kernel-5.0.0 → xtr_http_kernel-5.1.0}/src/xtr_http_kernel/routing/route_registry.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|