Skip to main content

Extra small env config system (like pydantic-settings, but simpler)

Project description

Nano settings

Creates simple config from environment variables. Smaller analog of pydantic-settings.

from dataclasses import dataclass

from nano_settings import BaseConfig, from_env


@dataclass
class DbSetup(BaseConfig):
    max_sessions: int
    autocommit: bool = True
    

@dataclass
class Database(BaseConfig):
    url: str
    timeout: int
    setup: DbSetup


# export MY_VAR__URL=https://site.com
# export MY_VAR__TIMEOUT=10
# export MY_VAR__SETUP__MAX_SESSIONS=2
config = from_env(Database, env_prefix='my_var')
print(config)
# Database(timeout=10, url='https://site.com', setup=DbSetup(max_sessions=2, autocommit=True))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nano_settings-0.1.0.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nano_settings-0.1.0-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file nano_settings-0.1.0.tar.gz.

File metadata

  • Download URL: nano_settings-0.1.0.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.9

File hashes

Hashes for nano_settings-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0a06a6eea3dc8cb910905d77c6490f8df26381aa42ee8fcc354e414f1d1cb510
MD5 a3fb6b25e96337dd11280d90300ada00
BLAKE2b-256 8c0ea7be26c628b3a243a1e9351d70243bdda5b363fa8d4b552249873684ea57

See more details on using hashes here.

File details

Details for the file nano_settings-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for nano_settings-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 53fbd834007044a3ffda807be9b40d423ba4b0820172ff9992688dc5a8d65e17
MD5 5e73441abedf0b5ad0a29cc1eae06aef
BLAKE2b-256 7036d02ec97ece8256271c13fcb090f5e860e821e208db50a9008dd883b4fc20

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page