Skip to main content

Pattern Agentic Settings

A settings class based on pydantic-settings that facilitates:

  • printing all settings on startup (redacts senstive attrs)
  • easy loading of .env files via an env variable
  • optionally load app version from importlib (sourced from pyproject.toml)
  • optional hot reload using watchfiles

Installation

pip install pattern_agentic_settings[hotreload]

Note that without the hotreload extension:

pip install pattern_agentic_settings

watchfiles is not pulled in, and dot envs will not auto-reload.

Example

class Settings(PABaseSettings):
    model_config = SettingsConfigDict(
        env_prefix="MYAPP_"
    )
    worker_count: int

# expects MYAPP_WORKER_COUNT 
# if MYAPP_DOT_ENV points to a file, will try to load vars from it
# throws an error if not defined
settings = Settings.load('my_app')

# This will watch the env file on disk and reload values if it changes
# This must be called in the context of an existing async runloop
# it also requires the hotreload extension (see Installation)

settings.watch_env_file()

Exepcted output:

My App v1.0.0
Configuration:
  WORKER_COUNT: 3

And on failure:

RuntimeError: Configuration validation failed:

      Missing required configuration fields:
        - worker_count

Tests

To run the tests the package must be installed in edit mode:

uv pip install -e .

# or to test hotreload
uv pip install -e .[hotreload]

After that:

# Base test
uv run pytest tests/test_base.py

# All tests
uv run pytest

Metadata

Release files for pattern-agentic-settings 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pattern-agentic-settings 2.0.0
File Size Uploaded Provenance Actions
pattern_agentic_settings-2.0.0.tar.gz 27.7 kB Without provenance Details for pattern_agentic_settings-2.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pattern-agentic-settings 2.0.0
File Interpreter ABI Platform Actions
pattern_agentic_settings-2.0.0-py3-none-any.whl Python 3 none any Details for pattern_agentic_settings-2.0.0-py3-none-any.whl

Total release size: 34.7 kB

Release files / pattern_agentic_settings-2.0.0.tar.gz

Download URL pattern_agentic_settings-2.0.0.tar.gz
Size 27.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9aec547b00a3a261a98c8197255a38659425a65741487e70facea1b5777a940e
BLAKE2b-256 checksum
How to use checksums
94b544b2580fcd30fe699612bdbcfa0906f45ca836f920df578de239c8f72b1f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.7

Release files / pattern_agentic_settings-2.0.0-py3-none-any.whl

Download URL pattern_agentic_settings-2.0.0-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4936d8950ac2ec39d5192d49dfd397ba0d0498448f8ac653210f3e906d1a0887
BLAKE2b-256 checksum
How to use checksums
46b3cd7e51ba6a27de1ca9966f30bb5b5cbd72d4359c32cd208709fa5b57429a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.7

Security for pattern-agentic-settings 2.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page