Methods to interact with the environment.
Project description
Environment utilities
This library is for the most part a wrapper on the os stdlib module.
ldr.environment.get
Loads an environment variable, a default, or None if no default is provided and the var is unset.
ldr.environment.require
Loads an environment, a default, or raises a ldr.environment.MissingVarError if no default is provided and the var is unset.
ldr.environment.google
This module contains pydantic models that will load Google Cloud Run container contract variables into a model.
from ldr.environment.google import CloudRunJob
# When in a Cloud Run Job environment.
job_vars = CloudRunJob()
assert job_vars.job == "my-job-name"
assert job_vars.task_index == 1
# Or locally
job_vars = CloudRunJob()
assert job_vars.job is None
ldr.environment.config
Load configuration from the environment.
ldr.environment.config.use_pretty_exceptions
Check whether to use pretty exceptions.
Reads from the PRETTY_EXCEPTIONS env var. Valid values are:
y|yes|enable|true: Enable pretty exceptionsauto: Check for Cloud Run container env vars and disable if any are present.- Any other value: Disable pretty exceptions
Defaults to auto if unset.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ldr_environment-0.1.0.tar.gz.
File metadata
- Download URL: ldr_environment-0.1.0.tar.gz
- Upload date:
- Size: 63.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
69fafce5621185783a3d4d58a7b163402a56bde0883e33802b768c9bc8895077
|
|
| MD5 |
498cf7c8d38c22e1d0e8260c7d6f78e9
|
|
| BLAKE2b-256 |
10654df40697574d353c5dd6ab547cc953660c6319f688e392d1752a9927dabe
|
File details
Details for the file ldr_environment-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ldr_environment-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
154ba7a32d21ff8534fc8d58d8c01551e2b024d41a4e4bfe701eca235d3ada04
|
|
| MD5 |
a9da3489df20b1cb7fd0e8fb0d0b9dac
|
|
| BLAKE2b-256 |
43e5b7e8c939fc342e90f5ecec6ba82e1364d47b322b2ee26efcb1733f9df65c
|