encore-dev 2.0.0b14__tar.gz → 2.0.0b15__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.
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/PKG-INFO +105 -16
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/README.md +104 -15
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/__init__.py +3 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/_run.py +1 -1
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/cron/__init__.py +33 -3
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/internal/_native.pyi +71 -15
- encore_dev-2.0.0b15/encore/redaction/__init__.py +222 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/secrets/__init__.py +14 -8
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/server/_serve.py +2 -8
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/server/_span.py +1 -1
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/server/_tracing.py +63 -41
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/server/asgi.py +11 -6
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/server/wsgi.py +14 -6
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/storage/objects/__init__.py +239 -94
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/tracing/__init__.py +5 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/pyproject.toml +1 -1
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/pyproject.toml.orig +1 -1
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/_schema.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/config/__init__.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/config/_build.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/config/_markers.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/django/__init__.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/django/base.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/env/__init__.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/errs/__init__.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/frontends/__init__.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/gateway/__init__.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/gateway/_serve.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/gateway/match.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/gateways/__init__.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/internal/__init__.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/internal/_loader.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/internal/clients.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/internal/grpc.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/internal/lazy.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/internal/reqfields.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/internal/runtime.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/internal/startup.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/internal/testscope.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/logs/__init__.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/logs/_api.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/logs/_console.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/logs/_runtime.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/metrics/__init__.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/metrics/_instrument.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/metrics/_metrics.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/metrics/_provider.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/pubsub/__init__.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/py.typed +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/reqctx/__init__.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/reqctx/_json.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/server/__init__.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/services/__init__.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/services/_propagate.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/services/aiohttp.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/services/httpx.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/services/niquests.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/services/requests.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/shutdown/__init__.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/storage/__init__.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/storage/clickhouse/__init__.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/storage/postgres/__init__.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/storage/redis/__init__.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/storage/redis/_base.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/storage/redis/_batch.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/storage/redis/_errors.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/storage/redis/_responses.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/storage/redis/_scan.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/storage/redis/_values.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/storage/redis/bitmap.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/storage/redis/command.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/storage/redis/generic.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/storage/redis/geo.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/storage/redis/hash.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/storage/redis/hyperloglog.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/storage/redis/json.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/storage/redis/list.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/storage/redis/pubsub.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/storage/redis/script.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/storage/redis/set.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/storage/redis/sorted_set.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/storage/redis/stream.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/storage/redis/string.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/testing/__init__.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/testing/_playwright_fixtures.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/testing/_steps.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/testing/playwright.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/testing/pytest_plugin.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/testing/system.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/tracing/_context.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/tracing/_encode.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/tracing/_provider.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/tracing/_span.py +0 -0
- {encore_dev-2.0.0b14 → encore_dev-2.0.0b15}/encore/tracing/_tracer.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: encore-dev
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.0b15
|
|
4
4
|
Summary: Encore SDK for Python — infrastructure resources
|
|
5
5
|
Author: Encore
|
|
6
6
|
License: MPL-2.0
|
|
@@ -69,9 +69,9 @@ async def place_order(order):
|
|
|
69
69
|
`secrets.Secret[str]("Name")` belongs to the service that declares it.
|
|
70
70
|
`secrets.Secret[str]("Name", scope="shared")` is one secret for the whole app,
|
|
71
71
|
given to the services that read it, and `scope="global"` one that every service
|
|
72
|
-
is given. `value` reads the secret as a string
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
is given. `value` reads the secret as a string. Locally (`encore run`,
|
|
73
|
+
`encore test`) a secret with no value reads as `""`, as a secret lacks one
|
|
74
|
+
there until it is set; anywhere else reading it raises `KeyError`. A secret's value is resolved once per process: a new
|
|
75
75
|
value reaches a service when it restarts.
|
|
76
76
|
|
|
77
77
|
A shared secret is declared once in the app. Another Python service can't
|
|
@@ -332,7 +332,7 @@ if __name__ == "__main__":
|
|
|
332
332
|
- **Requests**: HTTP/1.1 and HTTP/2 (h2c). Each request has its Request Context
|
|
333
333
|
and a span continuing its trace. The
|
|
334
334
|
server records the span itself, from the request's arrival to its response,
|
|
335
|
-
named
|
|
335
|
+
named using the deployed route when available; the app's code reaches it as
|
|
336
336
|
`trace.get_current_span()`.
|
|
337
337
|
- **Shutdown**: on SIGTERM or SIGINT it stops accepting connections and taking
|
|
338
338
|
Pub/Sub messages, lets the requests in flight finish, runs the app's lifespan
|
|
@@ -370,8 +370,7 @@ if __name__ == "__main__":
|
|
|
370
370
|
encore.run(WSGIMiddleware(app))
|
|
371
371
|
```
|
|
372
372
|
|
|
373
|
-
|
|
374
|
-
they matched.
|
|
373
|
+
The generic WSGI-to-ASGI adapter does not provide a route template.
|
|
375
374
|
|
|
376
375
|
FastAPI can record its own server, dependency, endpoint and serialization
|
|
377
376
|
spans when configured with a tracer provider. `run` turns them off for its
|
|
@@ -400,9 +399,20 @@ app = wsgi.Middleware(app) # Flask, Django's WSGI application
|
|
|
400
399
|
|
|
401
400
|
The middleware works beside OpenTelemetry's own: inside it, as
|
|
402
401
|
`FastAPIInstrumentor` arranges, the request's span is that one's; outside it,
|
|
403
|
-
OpenTelemetry's records an internal span under Encore's.
|
|
404
|
-
|
|
405
|
-
|
|
402
|
+
OpenTelemetry's records an internal span under Encore's.
|
|
403
|
+
|
|
404
|
+
### Server span names
|
|
405
|
+
|
|
406
|
+
Encore uses `METHOD /route/{param}` when a deployed policy matches. Otherwise
|
|
407
|
+
it uses the registered template from framework dispatch, or just `METHOD` if
|
|
408
|
+
there is no template. Unrecognized methods use `HTTP` in the name, `_OTHER` in
|
|
409
|
+
`http.request.method`, and the original method in `http.request.method_original`.
|
|
410
|
+
A framework template does not authorize recording the request URL or headers.
|
|
411
|
+
|
|
412
|
+
For framework-aware route names without deployed policy, use the framework's
|
|
413
|
+
OpenTelemetry instrumentation with Encore's tracer provider. Disable the
|
|
414
|
+
Encore server span (`encore.run(app, server_spans=False)`) or use the middleware
|
|
415
|
+
with `tracing=False` to avoid a second server span.
|
|
406
416
|
|
|
407
417
|
## Postgres queries and handles
|
|
408
418
|
|
|
@@ -837,6 +847,56 @@ Encore always uses its cached, owned provider for SDK-created spans,
|
|
|
837
847
|
independent of the global provider. `tracing.span`, `encore.run` and server
|
|
838
848
|
middleware leave global trace, meter and logger providers unchanged.
|
|
839
849
|
|
|
850
|
+
## Telemetry redaction
|
|
851
|
+
|
|
852
|
+
`encore.redaction.redactor()` applies the service's deployed policy to telemetry
|
|
853
|
+
copies. It neither changes application traffic nor emits telemetry. Unknown
|
|
854
|
+
routes omit URL fields; never fall back to the originals. Record `Payload.body` only
|
|
855
|
+
when set; `withheld` explains withholding, and both unset means omit.
|
|
856
|
+
|
|
857
|
+
Select HTTP policy with `redactor().http(method, path_and_query)`.
|
|
858
|
+
`request_url()` returns optional `route`, `path`, and `query` strings.
|
|
859
|
+
`request(headers=original_headers, body=wire)` and
|
|
860
|
+
`response(headers=original_headers, body=wire)` return safe `headers` and an
|
|
861
|
+
optional `body: Payload`. Headers, metadata, and trailers are `(str, str)` pairs;
|
|
862
|
+
duplicates are preserved. Pass original headers so body decoding uses wire
|
|
863
|
+
encoding. Omit `body` or `message` to skip capture; empty bytes request capture.
|
|
864
|
+
Use `redactor().topic(name).publish(wire)` for publishing and
|
|
865
|
+
`redactor().topic(name).delivery(subscription, wire)` for delivery.
|
|
866
|
+
|
|
867
|
+
Use `redactor().grpc(method)` with protobuf-py's `protobuf.DescMethod`, obtained
|
|
868
|
+
from a generated service descriptor or `registry.service(name).methods`. This
|
|
869
|
+
uses `parent.type_name` and `method_kind`, not Google's `MethodDescriptor` API.
|
|
870
|
+
The optional `encore-dev[grpc]` extra supplies protobuf-py on Python 3.11+;
|
|
871
|
+
HTTP and topic redaction require no protobuf library. Pass unframed message
|
|
872
|
+
bytes to `request(metadata=original_metadata, message=wire)` or
|
|
873
|
+
`response(metadata=original_metadata, message=wire, trailers=original_trailers)`.
|
|
874
|
+
Results contain safe `metadata`, optional `message: Payload`, and `trailers`. Streaming
|
|
875
|
+
*directions* are withheld; the unary direction of a streaming RPC still uses
|
|
876
|
+
its deployed policy.
|
|
877
|
+
|
|
878
|
+
### Third-party spans
|
|
879
|
+
|
|
880
|
+
Encore redacts the request path and user agent it records in its own server
|
|
881
|
+
spans. It does **not** sanitize arbitrary span names, attributes, events,
|
|
882
|
+
exceptions, or logs, including third-party framework spans exported through
|
|
883
|
+
`tracer_provider()`. Passing Encore's provider is not a redaction boundary.
|
|
884
|
+
|
|
885
|
+
FastAPI's native telemetry and OpenTelemetry's FastAPI/Starlette/ASGI/WSGI
|
|
886
|
+
instrumentation can record original paths, URLs, query strings, and headers.
|
|
887
|
+
For example, `encore.run(app, server_spans=False)` leaves FastAPI's request span
|
|
888
|
+
unredacted even when the deployed policy marks its path parameter sensitive.
|
|
889
|
+
Encore middleware inside third-party instrumentation likewise leaves that
|
|
890
|
+
instrumentation's span unchanged. The shared provider cannot reliably identify
|
|
891
|
+
all request-derived values in user attributes, events, or instrumentation hooks;
|
|
892
|
+
it does not rewrite those spans or application requests.
|
|
893
|
+
|
|
894
|
+
Keep `encore.run`'s default server spans (which suppress FastAPI's native request
|
|
895
|
+
telemetry), and disable separate request instrumentation when relying on
|
|
896
|
+
Encore's automatic request metadata redaction. For custom instrumentation,
|
|
897
|
+
redact telemetry copies explicitly before recording them; avoid recording
|
|
898
|
+
original requests, exceptions, or headers containing secrets.
|
|
899
|
+
|
|
840
900
|
## Metrics
|
|
841
901
|
|
|
842
902
|
Declare metrics at module scope: `Counter` for increasing totals,
|
|
@@ -925,14 +985,43 @@ async def example() -> None:
|
|
|
925
985
|
)
|
|
926
986
|
attrs = await uploads.attrs("hello.txt")
|
|
927
987
|
present = await uploads.exists("hello.txt")
|
|
928
|
-
|
|
988
|
+
download = await uploads.download("hello.txt", offset=0, length=5)
|
|
989
|
+
part = await download.read()
|
|
929
990
|
async for entry in uploads.list(prefix="hello", limit=10):
|
|
930
|
-
print(entry.name, entry.size)
|
|
991
|
+
print(entry.name, entry.size, entry.last_modified)
|
|
931
992
|
download_url = await uploads.signed_download_url("hello.txt", ttl=3600)
|
|
932
993
|
await uploads.remove("hello.txt")
|
|
933
994
|
```
|
|
934
995
|
|
|
935
996
|
`attrs`, `exists`, `download`, and `remove` accept a keyword-only `version`.
|
|
997
|
+
|
|
998
|
+
`download` returns once the provider has answered, before any of the object's
|
|
999
|
+
bytes: a missing object, or a range outside it, raises there. The `Download` it
|
|
1000
|
+
returns says what the provider said of the object (`revision`, `size`,
|
|
1001
|
+
`content_type`, `last_modified`) and gives its bytes: `await download.read()`
|
|
1002
|
+
for all of them, or `async for chunk in download` as they arrive. A byte range
|
|
1003
|
+
is `offset` and `length`, or `last=n` for the object's last `n` bytes; `size` is
|
|
1004
|
+
the whole object's either way.
|
|
1005
|
+
|
|
1006
|
+
To replace an object only if nobody has written it since it was read, pass the
|
|
1007
|
+
download's revision to `upload_if_match` (or `remove_if_match`):
|
|
1008
|
+
|
|
1009
|
+
```python
|
|
1010
|
+
async def bump() -> None:
|
|
1011
|
+
download = await uploads.download("counter")
|
|
1012
|
+
count = int(await download.read())
|
|
1013
|
+
try:
|
|
1014
|
+
await uploads.upload_if_match(
|
|
1015
|
+
"counter", str(count + 1).encode(), download.revision
|
|
1016
|
+
)
|
|
1017
|
+
except objects.PreconditionFailed:
|
|
1018
|
+
... # someone else wrote it first: read it again
|
|
1019
|
+
```
|
|
1020
|
+
|
|
1021
|
+
A `Revision` is opaque. Two are equal when they name the same revision, whether
|
|
1022
|
+
each came from a download or from an object's attributes (`attrs.revision`); the
|
|
1023
|
+
attributes themselves are accepted wherever a revision is.
|
|
1024
|
+
|
|
936
1025
|
`signed_upload_url` and `signed_download_url` return URL strings (`str`);
|
|
937
1026
|
TTL is in seconds, defaults to one hour, and must be between 1 and 604800.
|
|
938
1027
|
`public_url` is synchronous and requires a public bucket. `Bucket.named(name)`
|
|
@@ -955,16 +1044,16 @@ Producer exceptions and cancellation abort the upload. The caller owns closing
|
|
|
955
1044
|
an input generator that needs cleanup; cancellation cannot undo an upload the
|
|
956
1045
|
provider has already committed.
|
|
957
1046
|
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
early, including when piping a download into another upload:
|
|
1047
|
+
Iterating a download yields provider-sized byte chunks, read on demand. A
|
|
1048
|
+
download not read to its end holds its connection, so use `aclosing` when a
|
|
1049
|
+
loop might stop early, including when piping a download into another upload:
|
|
961
1050
|
|
|
962
1051
|
```python
|
|
963
1052
|
from contextlib import aclosing
|
|
964
1053
|
|
|
965
1054
|
|
|
966
1055
|
async def copy_large_object() -> None:
|
|
967
|
-
async with aclosing(uploads.
|
|
1056
|
+
async with aclosing(await uploads.download("source.bin")) as chunks:
|
|
968
1057
|
await uploads.upload_stream(
|
|
969
1058
|
"copy.bin", chunks, content_type="application/octet-stream"
|
|
970
1059
|
)
|
|
@@ -45,9 +45,9 @@ async def place_order(order):
|
|
|
45
45
|
`secrets.Secret[str]("Name")` belongs to the service that declares it.
|
|
46
46
|
`secrets.Secret[str]("Name", scope="shared")` is one secret for the whole app,
|
|
47
47
|
given to the services that read it, and `scope="global"` one that every service
|
|
48
|
-
is given. `value` reads the secret as a string
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
is given. `value` reads the secret as a string. Locally (`encore run`,
|
|
49
|
+
`encore test`) a secret with no value reads as `""`, as a secret lacks one
|
|
50
|
+
there until it is set; anywhere else reading it raises `KeyError`. A secret's value is resolved once per process: a new
|
|
51
51
|
value reaches a service when it restarts.
|
|
52
52
|
|
|
53
53
|
A shared secret is declared once in the app. Another Python service can't
|
|
@@ -308,7 +308,7 @@ if __name__ == "__main__":
|
|
|
308
308
|
- **Requests**: HTTP/1.1 and HTTP/2 (h2c). Each request has its Request Context
|
|
309
309
|
and a span continuing its trace. The
|
|
310
310
|
server records the span itself, from the request's arrival to its response,
|
|
311
|
-
named
|
|
311
|
+
named using the deployed route when available; the app's code reaches it as
|
|
312
312
|
`trace.get_current_span()`.
|
|
313
313
|
- **Shutdown**: on SIGTERM or SIGINT it stops accepting connections and taking
|
|
314
314
|
Pub/Sub messages, lets the requests in flight finish, runs the app's lifespan
|
|
@@ -346,8 +346,7 @@ if __name__ == "__main__":
|
|
|
346
346
|
encore.run(WSGIMiddleware(app))
|
|
347
347
|
```
|
|
348
348
|
|
|
349
|
-
|
|
350
|
-
they matched.
|
|
349
|
+
The generic WSGI-to-ASGI adapter does not provide a route template.
|
|
351
350
|
|
|
352
351
|
FastAPI can record its own server, dependency, endpoint and serialization
|
|
353
352
|
spans when configured with a tracer provider. `run` turns them off for its
|
|
@@ -376,9 +375,20 @@ app = wsgi.Middleware(app) # Flask, Django's WSGI application
|
|
|
376
375
|
|
|
377
376
|
The middleware works beside OpenTelemetry's own: inside it, as
|
|
378
377
|
`FastAPIInstrumentor` arranges, the request's span is that one's; outside it,
|
|
379
|
-
OpenTelemetry's records an internal span under Encore's.
|
|
380
|
-
|
|
381
|
-
|
|
378
|
+
OpenTelemetry's records an internal span under Encore's.
|
|
379
|
+
|
|
380
|
+
### Server span names
|
|
381
|
+
|
|
382
|
+
Encore uses `METHOD /route/{param}` when a deployed policy matches. Otherwise
|
|
383
|
+
it uses the registered template from framework dispatch, or just `METHOD` if
|
|
384
|
+
there is no template. Unrecognized methods use `HTTP` in the name, `_OTHER` in
|
|
385
|
+
`http.request.method`, and the original method in `http.request.method_original`.
|
|
386
|
+
A framework template does not authorize recording the request URL or headers.
|
|
387
|
+
|
|
388
|
+
For framework-aware route names without deployed policy, use the framework's
|
|
389
|
+
OpenTelemetry instrumentation with Encore's tracer provider. Disable the
|
|
390
|
+
Encore server span (`encore.run(app, server_spans=False)`) or use the middleware
|
|
391
|
+
with `tracing=False` to avoid a second server span.
|
|
382
392
|
|
|
383
393
|
## Postgres queries and handles
|
|
384
394
|
|
|
@@ -813,6 +823,56 @@ Encore always uses its cached, owned provider for SDK-created spans,
|
|
|
813
823
|
independent of the global provider. `tracing.span`, `encore.run` and server
|
|
814
824
|
middleware leave global trace, meter and logger providers unchanged.
|
|
815
825
|
|
|
826
|
+
## Telemetry redaction
|
|
827
|
+
|
|
828
|
+
`encore.redaction.redactor()` applies the service's deployed policy to telemetry
|
|
829
|
+
copies. It neither changes application traffic nor emits telemetry. Unknown
|
|
830
|
+
routes omit URL fields; never fall back to the originals. Record `Payload.body` only
|
|
831
|
+
when set; `withheld` explains withholding, and both unset means omit.
|
|
832
|
+
|
|
833
|
+
Select HTTP policy with `redactor().http(method, path_and_query)`.
|
|
834
|
+
`request_url()` returns optional `route`, `path`, and `query` strings.
|
|
835
|
+
`request(headers=original_headers, body=wire)` and
|
|
836
|
+
`response(headers=original_headers, body=wire)` return safe `headers` and an
|
|
837
|
+
optional `body: Payload`. Headers, metadata, and trailers are `(str, str)` pairs;
|
|
838
|
+
duplicates are preserved. Pass original headers so body decoding uses wire
|
|
839
|
+
encoding. Omit `body` or `message` to skip capture; empty bytes request capture.
|
|
840
|
+
Use `redactor().topic(name).publish(wire)` for publishing and
|
|
841
|
+
`redactor().topic(name).delivery(subscription, wire)` for delivery.
|
|
842
|
+
|
|
843
|
+
Use `redactor().grpc(method)` with protobuf-py's `protobuf.DescMethod`, obtained
|
|
844
|
+
from a generated service descriptor or `registry.service(name).methods`. This
|
|
845
|
+
uses `parent.type_name` and `method_kind`, not Google's `MethodDescriptor` API.
|
|
846
|
+
The optional `encore-dev[grpc]` extra supplies protobuf-py on Python 3.11+;
|
|
847
|
+
HTTP and topic redaction require no protobuf library. Pass unframed message
|
|
848
|
+
bytes to `request(metadata=original_metadata, message=wire)` or
|
|
849
|
+
`response(metadata=original_metadata, message=wire, trailers=original_trailers)`.
|
|
850
|
+
Results contain safe `metadata`, optional `message: Payload`, and `trailers`. Streaming
|
|
851
|
+
*directions* are withheld; the unary direction of a streaming RPC still uses
|
|
852
|
+
its deployed policy.
|
|
853
|
+
|
|
854
|
+
### Third-party spans
|
|
855
|
+
|
|
856
|
+
Encore redacts the request path and user agent it records in its own server
|
|
857
|
+
spans. It does **not** sanitize arbitrary span names, attributes, events,
|
|
858
|
+
exceptions, or logs, including third-party framework spans exported through
|
|
859
|
+
`tracer_provider()`. Passing Encore's provider is not a redaction boundary.
|
|
860
|
+
|
|
861
|
+
FastAPI's native telemetry and OpenTelemetry's FastAPI/Starlette/ASGI/WSGI
|
|
862
|
+
instrumentation can record original paths, URLs, query strings, and headers.
|
|
863
|
+
For example, `encore.run(app, server_spans=False)` leaves FastAPI's request span
|
|
864
|
+
unredacted even when the deployed policy marks its path parameter sensitive.
|
|
865
|
+
Encore middleware inside third-party instrumentation likewise leaves that
|
|
866
|
+
instrumentation's span unchanged. The shared provider cannot reliably identify
|
|
867
|
+
all request-derived values in user attributes, events, or instrumentation hooks;
|
|
868
|
+
it does not rewrite those spans or application requests.
|
|
869
|
+
|
|
870
|
+
Keep `encore.run`'s default server spans (which suppress FastAPI's native request
|
|
871
|
+
telemetry), and disable separate request instrumentation when relying on
|
|
872
|
+
Encore's automatic request metadata redaction. For custom instrumentation,
|
|
873
|
+
redact telemetry copies explicitly before recording them; avoid recording
|
|
874
|
+
original requests, exceptions, or headers containing secrets.
|
|
875
|
+
|
|
816
876
|
## Metrics
|
|
817
877
|
|
|
818
878
|
Declare metrics at module scope: `Counter` for increasing totals,
|
|
@@ -901,14 +961,43 @@ async def example() -> None:
|
|
|
901
961
|
)
|
|
902
962
|
attrs = await uploads.attrs("hello.txt")
|
|
903
963
|
present = await uploads.exists("hello.txt")
|
|
904
|
-
|
|
964
|
+
download = await uploads.download("hello.txt", offset=0, length=5)
|
|
965
|
+
part = await download.read()
|
|
905
966
|
async for entry in uploads.list(prefix="hello", limit=10):
|
|
906
|
-
print(entry.name, entry.size)
|
|
967
|
+
print(entry.name, entry.size, entry.last_modified)
|
|
907
968
|
download_url = await uploads.signed_download_url("hello.txt", ttl=3600)
|
|
908
969
|
await uploads.remove("hello.txt")
|
|
909
970
|
```
|
|
910
971
|
|
|
911
972
|
`attrs`, `exists`, `download`, and `remove` accept a keyword-only `version`.
|
|
973
|
+
|
|
974
|
+
`download` returns once the provider has answered, before any of the object's
|
|
975
|
+
bytes: a missing object, or a range outside it, raises there. The `Download` it
|
|
976
|
+
returns says what the provider said of the object (`revision`, `size`,
|
|
977
|
+
`content_type`, `last_modified`) and gives its bytes: `await download.read()`
|
|
978
|
+
for all of them, or `async for chunk in download` as they arrive. A byte range
|
|
979
|
+
is `offset` and `length`, or `last=n` for the object's last `n` bytes; `size` is
|
|
980
|
+
the whole object's either way.
|
|
981
|
+
|
|
982
|
+
To replace an object only if nobody has written it since it was read, pass the
|
|
983
|
+
download's revision to `upload_if_match` (or `remove_if_match`):
|
|
984
|
+
|
|
985
|
+
```python
|
|
986
|
+
async def bump() -> None:
|
|
987
|
+
download = await uploads.download("counter")
|
|
988
|
+
count = int(await download.read())
|
|
989
|
+
try:
|
|
990
|
+
await uploads.upload_if_match(
|
|
991
|
+
"counter", str(count + 1).encode(), download.revision
|
|
992
|
+
)
|
|
993
|
+
except objects.PreconditionFailed:
|
|
994
|
+
... # someone else wrote it first: read it again
|
|
995
|
+
```
|
|
996
|
+
|
|
997
|
+
A `Revision` is opaque. Two are equal when they name the same revision, whether
|
|
998
|
+
each came from a download or from an object's attributes (`attrs.revision`); the
|
|
999
|
+
attributes themselves are accepted wherever a revision is.
|
|
1000
|
+
|
|
912
1001
|
`signed_upload_url` and `signed_download_url` return URL strings (`str`);
|
|
913
1002
|
TTL is in seconds, defaults to one hour, and must be between 1 and 604800.
|
|
914
1003
|
`public_url` is synchronous and requires a public bucket. `Bucket.named(name)`
|
|
@@ -931,16 +1020,16 @@ Producer exceptions and cancellation abort the upload. The caller owns closing
|
|
|
931
1020
|
an input generator that needs cleanup; cancellation cannot undo an upload the
|
|
932
1021
|
provider has already committed.
|
|
933
1022
|
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
early, including when piping a download into another upload:
|
|
1023
|
+
Iterating a download yields provider-sized byte chunks, read on demand. A
|
|
1024
|
+
download not read to its end holds its connection, so use `aclosing` when a
|
|
1025
|
+
loop might stop early, including when piping a download into another upload:
|
|
937
1026
|
|
|
938
1027
|
```python
|
|
939
1028
|
from contextlib import aclosing
|
|
940
1029
|
|
|
941
1030
|
|
|
942
1031
|
async def copy_large_object() -> None:
|
|
943
|
-
async with aclosing(uploads.
|
|
1032
|
+
async with aclosing(await uploads.download("source.bin")) as chunks:
|
|
944
1033
|
await uploads.upload_stream(
|
|
945
1034
|
"copy.bin", chunks, content_type="application/octet-stream"
|
|
946
1035
|
)
|
|
@@ -59,6 +59,7 @@ if TYPE_CHECKING or "_pytest" not in sys.modules:
|
|
|
59
59
|
logs,
|
|
60
60
|
metrics,
|
|
61
61
|
pubsub,
|
|
62
|
+
redaction,
|
|
62
63
|
reqctx,
|
|
63
64
|
secrets,
|
|
64
65
|
services,
|
|
@@ -78,6 +79,7 @@ __all__ = [
|
|
|
78
79
|
"config",
|
|
79
80
|
"storage",
|
|
80
81
|
"pubsub",
|
|
82
|
+
"redaction",
|
|
81
83
|
"cron",
|
|
82
84
|
"env",
|
|
83
85
|
"errs",
|
|
@@ -112,6 +114,7 @@ _SUBMODULES = {
|
|
|
112
114
|
"logs",
|
|
113
115
|
"metrics",
|
|
114
116
|
"pubsub",
|
|
117
|
+
"redaction",
|
|
115
118
|
"reqctx",
|
|
116
119
|
"secrets",
|
|
117
120
|
"services",
|
|
@@ -38,7 +38,7 @@ def run(
|
|
|
38
38
|
server, over HTTP/1.1 and HTTP/2 (h2c), where Encore assigns the
|
|
39
39
|
service. Each request has its Request Context, and with ``tracing`` a
|
|
40
40
|
``SERVER`` span continuing its trace, recorded by the server from its
|
|
41
|
-
arrival to its response and named
|
|
41
|
+
arrival to its response and named using the deployed route, if known.
|
|
42
42
|
Without one, as for a service that only handles Pub/Sub messages, run
|
|
43
43
|
the rest.
|
|
44
44
|
|
|
@@ -25,15 +25,18 @@ whether it has seen the key before::
|
|
|
25
25
|
``TRIGGER_HEADER`` says why the job runs. Only Encore sends either: a gateway
|
|
26
26
|
removes them from the requests it takes from clients.
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
Locally, a job runs on schedule only if declared with
|
|
29
|
+
``run_in={"local": True}``, while the app has a session open, and a developer
|
|
30
|
+
can override that for their checkout either way. ``encore cron trigger <name>``
|
|
31
|
+
runs a job now, as Encore runs it when it is due, with both headers.
|
|
30
32
|
"""
|
|
31
33
|
|
|
32
34
|
from __future__ import annotations
|
|
33
35
|
|
|
34
36
|
from collections.abc import Mapping
|
|
37
|
+
from typing import TypedDict
|
|
35
38
|
|
|
36
|
-
__all__ = ["IDEMPOTENCY_KEY_HEADER", "TRIGGER_HEADER", "Job"]
|
|
39
|
+
__all__ = ["IDEMPOTENCY_KEY_HEADER", "TRIGGER_HEADER", "Job", "RunIn"]
|
|
37
40
|
|
|
38
41
|
IDEMPOTENCY_KEY_HEADER = "x-encore-cron-execution"
|
|
39
42
|
"""The header with a run's idempotency key: the same each time Encore sends it."""
|
|
@@ -42,6 +45,20 @@ TRIGGER_HEADER = "x-encore-cron-trigger"
|
|
|
42
45
|
"""The header that says why a job runs: ``scheduled``, or ``manual``."""
|
|
43
46
|
|
|
44
47
|
|
|
48
|
+
class RunIn(TypedDict, total=False):
|
|
49
|
+
"""The kinds of environment a cron job is scheduled in.
|
|
50
|
+
|
|
51
|
+
Wherever the app is deployed, it is; locally only when ``local`` says so.
|
|
52
|
+
The type of ``Job``'s ``run_in``, which is written out where the job is
|
|
53
|
+
declared as a dict literal, ``run_in={"local": True}``: Encore reads it
|
|
54
|
+
from the source.
|
|
55
|
+
"""
|
|
56
|
+
|
|
57
|
+
local: bool
|
|
58
|
+
"""Scheduled on a developer's machine too, while the app has a session
|
|
59
|
+
open there. False unless set; a developer can override it either way."""
|
|
60
|
+
|
|
61
|
+
|
|
45
62
|
class Job:
|
|
46
63
|
"""A scheduled HTTP request declared at module scope."""
|
|
47
64
|
|
|
@@ -54,6 +71,7 @@ class Job:
|
|
|
54
71
|
every: str | None = None,
|
|
55
72
|
schedule: str | None = None,
|
|
56
73
|
tags: Mapping[str, str] | None = None,
|
|
74
|
+
run_in: RunIn | None = None,
|
|
57
75
|
) -> None:
|
|
58
76
|
"""Declare a cron job with exactly one scheduling option.
|
|
59
77
|
|
|
@@ -69,6 +87,9 @@ class Job:
|
|
|
69
87
|
with a letter, and keys starting with ``encore`` are reserved.
|
|
70
88
|
At most 32. A dict of string literals: Encore reads it from the
|
|
71
89
|
source, and the runtime ignores it.
|
|
90
|
+
run_in: The kinds of environment the job is scheduled in, such as
|
|
91
|
+
``{"local": True}``. Written out: Encore reads it from the
|
|
92
|
+
source.
|
|
72
93
|
|
|
73
94
|
Raises:
|
|
74
95
|
ValueError: Both or neither scheduling options are set, or path does
|
|
@@ -83,6 +104,7 @@ class Job:
|
|
|
83
104
|
self._title = title
|
|
84
105
|
self._every = every
|
|
85
106
|
self._schedule = schedule
|
|
107
|
+
self._run_in = RunIn(**(run_in or {}))
|
|
86
108
|
|
|
87
109
|
# Read-only: Encore schedules the job from its declaration in the source,
|
|
88
110
|
# so a changed path would not be the one it requests.
|
|
@@ -111,3 +133,11 @@ class Job:
|
|
|
111
133
|
def schedule(self) -> str | None:
|
|
112
134
|
"""The cron expression, if declared with one."""
|
|
113
135
|
return self._schedule
|
|
136
|
+
|
|
137
|
+
@property
|
|
138
|
+
def run_in(self) -> RunIn:
|
|
139
|
+
"""Where the job is declared to be scheduled.
|
|
140
|
+
|
|
141
|
+
Locally, a developer can override it.
|
|
142
|
+
"""
|
|
143
|
+
return RunIn(**self._run_in)
|
|
@@ -34,8 +34,11 @@ class Bucket:
|
|
|
34
34
|
class BucketObject:
|
|
35
35
|
def attrs(self, /, options: AttrsOptions |None = None, source: bytes |None = None) -> "typing.Awaitable[ObjectAttrs]": ...
|
|
36
36
|
def delete(self, /, options: DeleteOptions |None = None, source: bytes |None = None) -> "typing.Awaitable[None]": ...
|
|
37
|
-
def
|
|
38
|
-
|
|
37
|
+
def download(self, /, options: DownloadOptions |None = None, source: bytes |None = None) -> "typing.Awaitable[Download]":
|
|
38
|
+
"""
|
|
39
|
+
Begins a download: resolves once the provider has answered, with what
|
|
40
|
+
it says of the object and its bytes still to come.
|
|
41
|
+
"""
|
|
39
42
|
def exists(self, /, options: ExistsOptions |None = None, source: bytes |None = None) -> "typing.Awaitable[bool]": ...
|
|
40
43
|
def extend_retention(self, /, until: datetime, options: ExtendRetentionOptions |None = None, source: bytes |None = None) -> "typing.Awaitable[ObjectAttrs]":
|
|
41
44
|
"""
|
|
@@ -54,7 +57,11 @@ class BucketObject:
|
|
|
54
57
|
|
|
55
58
|
@final
|
|
56
59
|
class ByteRange:
|
|
57
|
-
|
|
60
|
+
"""
|
|
61
|
+
`length` bytes from `offset` (to the end of the object for `None`), or
|
|
62
|
+
with `last`, the object's last so many bytes.
|
|
63
|
+
"""
|
|
64
|
+
def __new__(cls, /, *, offset: int = 0, length: int |None = None, last: int |None = None) -> "ByteRange": ...
|
|
58
65
|
|
|
59
66
|
@final
|
|
60
67
|
class ClickHouseAccess:
|
|
@@ -223,13 +230,46 @@ class DeleteOptions:
|
|
|
223
230
|
def __new__(cls, /, *, version: str |None = None, if_match: Revision |None = None) -> "DeleteOptions": ...
|
|
224
231
|
|
|
225
232
|
@final
|
|
226
|
-
class
|
|
227
|
-
|
|
233
|
+
class Download:
|
|
234
|
+
"""
|
|
235
|
+
A download under way: what the provider said of the object, and its
|
|
236
|
+
bytes, read whole (`read`) or as they arrive (`next`).
|
|
237
|
+
"""
|
|
238
|
+
def close(self, /) -> "typing.Awaitable[None]":
|
|
239
|
+
"""
|
|
240
|
+
Drops what of the download has not been read, which cancels it.
|
|
241
|
+
"""
|
|
242
|
+
@property
|
|
243
|
+
def content_type(self, /) -> str |None: ...
|
|
244
|
+
@property
|
|
245
|
+
def last_modified(self, /) -> datetime |None:
|
|
246
|
+
"""
|
|
247
|
+
When this version of the object was written, in UTC; `None` if the
|
|
248
|
+
provider didn't say.
|
|
249
|
+
"""
|
|
250
|
+
def next(self, /) -> "typing.Awaitable[typing.Optional[bytes]]":
|
|
251
|
+
"""
|
|
252
|
+
The next chunk, or `None` once the download has all arrived.
|
|
253
|
+
"""
|
|
254
|
+
def read(self, /) -> "typing.Awaitable[bytes]":
|
|
255
|
+
"""
|
|
256
|
+
The rest of the download, in one piece: all of it, if nothing was read
|
|
257
|
+
yet, and nothing once it has all been read.
|
|
258
|
+
"""
|
|
259
|
+
@property
|
|
260
|
+
def revision(self, /) -> Revision:
|
|
261
|
+
"""
|
|
262
|
+
The revision the bytes are of: what an `if_match` precondition takes.
|
|
263
|
+
"""
|
|
264
|
+
@property
|
|
265
|
+
def size(self, /) -> int:
|
|
266
|
+
"""
|
|
267
|
+
The size of the whole object in bytes, also when a range is read.
|
|
268
|
+
"""
|
|
228
269
|
|
|
229
270
|
@final
|
|
230
|
-
class
|
|
231
|
-
def
|
|
232
|
-
def next(self, /) -> "typing.Awaitable[typing.Optional[bytes]]": ...
|
|
271
|
+
class DownloadOptions:
|
|
272
|
+
def __new__(cls, /, *, version: str |None = None, range: ByteRange |None = None) -> "DownloadOptions": ...
|
|
233
273
|
|
|
234
274
|
@final
|
|
235
275
|
class DownloadUrlOptions:
|
|
@@ -385,7 +425,7 @@ class HttpRequest:
|
|
|
385
425
|
"""
|
|
386
426
|
Whether the client went away.
|
|
387
427
|
"""
|
|
388
|
-
def fail(self, /, type_name: str, message: str, stacktrace: str
|
|
428
|
+
def fail(self, /, type_name: str, message: str, stacktrace: str) -> "None":
|
|
389
429
|
"""
|
|
390
430
|
The app raised: answered with a 500 if it had not started its
|
|
391
431
|
response, and cut off if it had. The exception, its type's name,
|
|
@@ -396,11 +436,10 @@ class HttpRequest:
|
|
|
396
436
|
The Request Context fields the request carries: `(name, value)` in
|
|
397
437
|
their wire form.
|
|
398
438
|
"""
|
|
399
|
-
def finish(self,
|
|
439
|
+
def finish(self, /) -> "None":
|
|
400
440
|
"""
|
|
401
441
|
The app returned. A response it never started is a 500; one whose
|
|
402
|
-
body it never finished is cut off.
|
|
403
|
-
route the app matched, which names the request's span.
|
|
442
|
+
body it never finished is cut off.
|
|
404
443
|
"""
|
|
405
444
|
def head(self, /) -> "tuple[str, str, bytes, bytes, list[tuple[bytes, bytes]], str, tuple[str, int] | None, tuple[str, int], int]":
|
|
406
445
|
"""
|
|
@@ -457,8 +496,7 @@ class HttpRequest:
|
|
|
457
496
|
"""
|
|
458
497
|
def span_update_name(self, /, name: str) -> "None":
|
|
459
498
|
"""
|
|
460
|
-
Renames the request's span.
|
|
461
|
-
when the request finishes.
|
|
499
|
+
Renames the request's span.
|
|
462
500
|
"""
|
|
463
501
|
def start_response(self, /, status: int, headers: Sequence[tuple[Sequence[int], Sequence[int]]], trailers: bool = False) -> "None":
|
|
464
502
|
"""
|
|
@@ -578,6 +616,12 @@ class ListEntry:
|
|
|
578
616
|
@property
|
|
579
617
|
def is_prefix(self, /) -> bool: ...
|
|
580
618
|
@property
|
|
619
|
+
def last_modified(self, /) -> datetime |None:
|
|
620
|
+
"""
|
|
621
|
+
When the object was written, in UTC; `None` for a prefix, or if the
|
|
622
|
+
provider didn't say.
|
|
623
|
+
"""
|
|
624
|
+
@property
|
|
581
625
|
def name(self, /) -> str: ...
|
|
582
626
|
@property
|
|
583
627
|
def size(self, /) -> int: ...
|
|
@@ -1229,8 +1273,13 @@ class RedisSubscription:
|
|
|
1229
1273
|
@final
|
|
1230
1274
|
class Revision:
|
|
1231
1275
|
"""
|
|
1232
|
-
One revision of an object, for an `if_match` precondition.
|
|
1276
|
+
One revision of an object, for an `if_match` precondition. Two are equal
|
|
1277
|
+
when they name the same revision, as the core has it: by version where
|
|
1278
|
+
both have one, by ETag otherwise. That is no equivalence a hash can
|
|
1279
|
+
follow, so a revision is unhashable.
|
|
1233
1280
|
"""
|
|
1281
|
+
def __eq__(self, value: object, /) -> bool: ...
|
|
1282
|
+
def __ne__(self, value: object, /) -> bool: ...
|
|
1234
1283
|
def __new__(cls, /, *, etag: str, version: str |None = None) -> "Revision": ...
|
|
1235
1284
|
|
|
1236
1285
|
@final
|
|
@@ -1318,6 +1367,7 @@ class Runtime:
|
|
|
1318
1367
|
"""
|
|
1319
1368
|
A handle to the named pub/sub topic, or an error if it isn't configured.
|
|
1320
1369
|
"""
|
|
1370
|
+
def redact(self, /, spec: bytes, payload: bytes) -> "bytes": ...
|
|
1321
1371
|
def redis_database(self, /, name: str) -> "RedisDatabase":
|
|
1322
1372
|
"""
|
|
1323
1373
|
Look up a Redis database configured for this service.
|
|
@@ -1387,6 +1437,12 @@ class Runtime:
|
|
|
1387
1437
|
Whether each test has infrastructure of its own: the process runs
|
|
1388
1438
|
tests, under `encore test` or a test runner.
|
|
1389
1439
|
"""
|
|
1440
|
+
def unset_secrets_read_empty(self, /) -> "bool":
|
|
1441
|
+
"""
|
|
1442
|
+
Whether a secret `secret` has no value of reads as `""` rather than
|
|
1443
|
+
failing: only where the app runs locally, as `encore run` and
|
|
1444
|
+
`encore test` do, where a secret lacks a value until it is set.
|
|
1445
|
+
"""
|
|
1390
1446
|
@staticmethod
|
|
1391
1447
|
def version() -> "str":
|
|
1392
1448
|
"""
|