New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

essex-config

Package Overview
Dependencies
Maintainers
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

essex-config

Python library for creating configuration objects that read from various sources, including files, environment variables, and Azure Key Vault.

  • 0.0.6
  • PyPI
  • Socket score

Maintainers
5

Getting Started

essex-config is a Python library for creating configuration objects that read from various sources, including files, environment variables, and Azure Key Vault.

pip install essex-config

Basic Usage

Create a configuration object for connecting to a customer database:

from pydantic import BaseModel, Field
from essex_config import load_config

class CustomerDatabase(BaseModel):
    """Configuration for connecting to the Customer Database"""
    host: str = Field(default="127.0.0.1", description="DB connection host")
    port: int = Field(description="DB connection port")
    password: str = Field(description="DB connection password")

if __name__ == "__main__":
    config = load_config(CustomerDatabase)
    print(config)

When load_config(CustomerDatabase) is executed, values are populated from environment variables or default values.

Nested Configurations

Nest configuration objects:

class Inner(BaseModel):
    inner_hello: str

class NestedConfiguration(BaseModel):
    hello: str
    nested: Inner

nested_config = load_config(NestedConfiguration)

load_config() populates every field, including nested_config.nested.inner_hello. The default prefix for every field in Inner is nested, which can be changed with Annotated[Inner, Prefixed("new_prefix")].

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc