Skip to content

feat(envconfig): add extension support - #2079

Merged
johanngan merged 2 commits into
mainfrom
johanngan/envconfig-extensions
Nov 6, 2026
Merged

johanngan merged 2 commits into
mainfrom
johanngan/envconfig-extensions

Conversation

@johanngan

@johanngan johanngan commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

What was changed

Add support for envconfig extensions. These allow separate packages to extend envconfig with their own TOML keys and environment variables by implementing the ClientConfigExtension interface. An extension operates on a config profile as input and outputs a plugin to be attached to the client created from envconfig output.

A TOML file with an extension looks as follows:

[profile.default.ext.my_extension]
some_field = "value"

An envconfig consumer specifies a list of extensions to use when loading connection options via ClientConfig.load_client_connect_config(extensions=...). Returned plugins are client plugins set under the "plugins" key of the resulting ClientConnectConfig, so they are applied when the config is passed to Client.connect(**config). For now, extensions are not supported in other contexts.

Why?

It's useful for external packages to be able to extend the envconfig format without needing to modify the envconfig package itself. The first use-case for this will be integrating with AWS Secrets Manager to specify client secrets via Secrets Manager ID.

Also see the Go implementation in temporalio/sdk-go#2771. Also see the Rust core change in temporalio/sdk-rust#1736.

Checklist

  1. How was this tested:
  • Added new unit tests.
  • Manual end-to-end check (performed by Claude): a small standalone program loaded a real temporal.toml (via TEMPORAL_CONFIG_FILE) with an [profile.default.ext.e2e] table, using real process env vars (TEMPORAL_NAMESPACE, TEMPORAL_EXT_E2E_SUFFIX). An extension passed to ClientConfig.load_client_connect_config read its TOML table and env var and returned a plugin. The program confirmed that the extension saw the env-overridden profile, and that the returned config had the expected namespace and target host and exactly one plugin carrying the expected values.
  1. Any docs updates needed?
    The associated in-repo docs are updated. I don't think we need other public docs for now, as right now this is primarily just an implementation detail for the Lambda worker integration with Secrets Manager.

@johanngan
johanngan requested a review from THardy98 November 3, 2026 18:31
@johanngan
johanngan requested a review from a team as a code owner November 3, 2026 18:31
@CLAassistant

CLAassistant commented Nov 3, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Comment thread temporalio/bridge/sdk-core Resolved
@johanngan
johanngan force-pushed the johanngan/envconfig-extensions branch from bcf5e9d to d4d4a6b Compare November 3, 2026 22:30
@johanngan

johanngan commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor Author

I added an additional commit to convert TOML datetimes within envconfig ext tables into native Python datetime types within the Rust bridge, the way tomllib would. It's a fair bit of extra code for something that's probably not going to be used very often, if at all, but it seems like we ought to do it for completeness, but I'm open to dropping it and leaving datetimes as strings instead.

@tconley1428
tconley1428 marked this pull request as draft November 3, 2026 23:43
@tconley1428

Copy link
Copy Markdown
Contributor

Converting to a draft just because I don't like having open PRs which pass CI but shouldn't merge, it can be reviewed in draft until core is ready.

@johanngan

Copy link
Copy Markdown
Contributor Author

Converting to a draft just because I don't like having open PRs which pass CI but shouldn't merge, it can be reviewed in draft until core is ready.

SGTM, I converted the .NET/Ruby ones as well

johanngan and others added 2 commits November 5, 2026 18:22
Add support for envconfig extensions. These allow separate packages to
extend envconfig with their own TOML keys and environment variables by
implementing the ClientConfigExtension interface. An extension operates
on a config profile as input and outputs a plugin to be attached to the
client created from envconfig output.

A TOML file with an extension looks as follows:

```
[profile.default.ext.my_extension]
some_field = "value"
```

An envconfig consumer specifies a list of extensions to use when
loading connection options via
ClientConfig.load_client_connect_config(extensions=...). Returned
plugins are client plugins set under the "plugins" key of the resulting
ClientConnectConfig, so they are applied when the config is passed to
Client.connect(**config). For now, extensions are not supported in
other contexts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Convert TOML datetimes in profile ext tables the same way as tomllib,
instead of passing them through as ISO 8601 strings. Offset datetimes
become aware datetimes, local datetimes become naive datetimes, local
dates become dates, and local times become times, with fractional
seconds truncated to microseconds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@johanngan
johanngan force-pushed the johanngan/envconfig-extensions branch from d4d4a6b to 4560e3a Compare November 6, 2026 00:27
@johanngan

Copy link
Copy Markdown
Contributor Author

(Force push to rebase on the recent sdk-core submodule bump in #2093)

@johanngan
johanngan marked this pull request as ready for review November 6, 2026 00:28
@johanngan
johanngan enabled auto-merge (squash) November 6, 2026 00:32
@johanngan
johanngan merged commit 2c9ae2f into main Nov 6, 2026
47 of 52 checks passed
@johanngan
johanngan deleted the johanngan/envconfig-extensions branch November 6, 2026 01:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants