{"id":13419349,"url":"https://github.com/hernantz/classyconf","last_synced_at":"2025-04-14T23:46:30.240Z","repository":{"id":49220827,"uuid":"264553026","full_name":"hernantz/classyconf","owner":"hernantz","description":"Declarative and extensible library for configuration \u0026 code separation","archived":false,"fork":false,"pushed_at":"2023-02-08T01:30:15.000Z","size":217,"stargazers_count":83,"open_issues_count":5,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-09-16T00:25:58.271Z","etag":null,"topics":["configuration","python3","settings-management","twelve-factor"],"latest_commit_sha":null,"homepage":"https://classyconf.readthedocs.io/en/latest/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hernantz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null},"funding":{"github":["hernantz"]}},"created_at":"2020-05-17T00:21:22.000Z","updated_at":"2024-02-26T10:47:53.000Z","dependencies_parsed_at":"2024-01-12T04:56:42.252Z","dependency_job_id":"3732a052-e57b-491b-94d0-11c43f28b169","html_url":"https://github.com/hernantz/classyconf","commit_stats":{"total_commits":120,"total_committers":3,"mean_commits":40.0,"dds":0.01666666666666672,"last_synced_commit":"2c29fda3db99809a03f550d6275d2566b4dc40f3"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hernantz%2Fclassyconf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hernantz%2Fclassyconf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hernantz%2Fclassyconf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hernantz%2Fclassyconf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hernantz","download_url":"https://codeload.github.com/hernantz/classyconf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248799713,"owners_count":21163398,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["configuration","python3","settings-management","twelve-factor"],"created_at":"2024-07-30T22:01:14.736Z","updated_at":"2025-04-14T23:46:30.219Z","avatar_url":"https://github.com/hernantz.png","language":"Python","funding_links":["https://github.com/sponsors/hernantz"],"categories":["Python"],"sub_categories":[],"readme":"# ClassyConf\n\n![PyPI](https://img.shields.io/pypi/v/classyconf?style=flat-square)\n![Run tests](https://github.com/hernantz/classyconf/workflows/Run%20tests/badge.svg?event=push)\n[![codecov](https://codecov.io/gh/hernantz/classyconf/branch/master/graph/badge.svg)](https://codecov.io/gh/hernantz/classyconf)\n\n\n![carbon](https://user-images.githubusercontent.com/613512/84096088-53f74c00-a9d7-11ea-9353-25d2910abc02.png)\n\n\n\n**ClassyConf is the configuration architecture solution for perfectionists with deadlines.**\n\nIt provides a declarative way to define settings for your projects contained\nin a class that can be extended, overriden at runtime, config objects can be\npassed around modules and settings are lazily loaded, plus some other\ngoodies.\n\nYou can find out more documentation at [Read the\nDocs](https://classyconf.readthedocs.io/en/latest/index.html) website, and\nthe [intro post](http://hernantz.github.io/configuration-is-an-api-not-an-sdk.html) here to understand the motivations behind it.\n\nHere is a preview of how to use it:\n\n```python\nfrom classyconf import Configuration, Value, Environment, IniFile, as_boolean, EnvPrefix\n\nclass AppConfig(Configuration):\n    \"\"\"Configuration for My App\"\"\"\n    class Meta:\n        loaders = [\n            Environment(keyfmt=EnvPrefix(\"MY_APP_\")),\n            IniFile(\"/etc/app/conf.ini\", section=\"myapp\")\n        ]\n\n    DEBUG = Value(default=False, cast=as_boolean, help=\"Toggle debugging mode.\")\n    DATABASE_URL = Value(default=\"postgres://localhost:5432/mydb\", help=\"Database connection.\")\n```\n\nLater this object can be used to print settings\n\n```python\n\u003e\u003e\u003e config = AppConfig()\n\u003e\u003e\u003e print(config)\nDEBUG=True - Toggle debugging mode.\nDATABASE_URL='postgres://localhost:5432/mydb' - Database connection.\n```\n\nor with `__repr__()`\n\n```python\n\u003e\u003e\u003e config = AppConfig()\n\u003e\u003e\u003e config\nAppConf(loaders=[Environment(keyfmt=EnvPrefix(\"MY_APP_\"), EnvFile(\"main.env\")])\n```\n\nextended\n\n```python\nclass TestConfig(AppConfig):\n    class Meta:\n        loaders = [IniFile(\"test_settings.ini\"), EnvFile(\"main.env\")]\n```\n\noverridden at runtime\n\n```python\n\u003e\u003e\u003e dev_config = AppConfig(loaders=[IniFile(\"dev_settings.ini\")])\n\u003e\u003e\u003e dev_config.DEBUG\nTrue\n```\n\naccessed as dict or object\n\n```python\n\u003e\u003e\u003e config.DEBUG\nFalse\n\u003e\u003e\u003e config[\"DEBUG\"]\nFalse\n```\n\niterated\n\n```python\n \u003e\u003e\u003e for setting in config:\n...     print(setting)\n...\n('DEBUG', Value(key=\"DEBUG\", help=\"Toggle debugging on/off.\"))\n('DATABASE_URL', Value(key=\"DATABASE_URL\", help=\"Database connection.\"))\n```\n\nor passed around\n\n```python\ndef do_something(cfg):\n    if cfg.DEBUG:   # this is evaluated lazily\n         return\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhernantz%2Fclassyconf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhernantz%2Fclassyconf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhernantz%2Fclassyconf/lists"}