You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This directory contains Python samples that demonstrate how to use the Temporal SDK's external client configuration feature. This feature allows you to configure a `temporalio.client.Client` using a TOML file and/or programmatic overrides, decoupling connection settings from your application code.
4
+
5
+
## Prerequisites
6
+
7
+
To run, first see [README.md](../README.md) for prerequisites.
8
+
9
+
## Configuration File
10
+
11
+
The `config.toml` file defines three profiles for different environments:
12
+
13
+
-`[profile.default]`: A working configuration for local development.
14
+
-`[profile.staging]`: A configuration with an intentionally **incorrect** address (`localhost:9999`) to demonstrate how it can be corrected by an override.
15
+
-`[profile.prod]`: A non-runnable, illustrative-only configuration showing a realistic setup for Temporal Cloud with placeholder credentials. This profile is not used by the samples but serves as a reference.
16
+
17
+
## Samples
18
+
19
+
The following Python scripts demonstrate different ways to load and use these configuration profiles. Each runnable sample highlights a unique feature.
20
+
21
+
### `load_from_file.py`
22
+
23
+
This sample shows the most common use case: loading the `default` profile from the `config.toml` file.
24
+
25
+
**To run this sample:**
26
+
27
+
```bash
28
+
uv run env_config/load_from_file.py
29
+
```
30
+
31
+
### `load_profile.py`
32
+
33
+
This sample demonstrates loading the `staging` profile by name (which has an incorrect address) and then correcting the address programmatically. This highlights the recommended approach for overriding configuration values at runtime.
34
+
35
+
**To run this sample:**
36
+
37
+
```bash
38
+
uv run env_config/load_profile.py
39
+
```
40
+
41
+
## Running the Samples
42
+
43
+
You can run each sample script directly from the root of the `samples-python` repository. Ensure you have the necessary dependencies installed by running `pip install -e .` (or the equivalent for your environment).
0 commit comments