{"id":16337960,"url":"https://github.com/jnoortheen/dynamic-conf","last_synced_at":"2025-10-25T23:31:28.711Z","repository":{"id":57424760,"uuid":"214230523","full_name":"jnoortheen/dynamic-conf","owner":"jnoortheen","description":"Declarative way to manage configuration variables separated from source. ","archived":false,"fork":false,"pushed_at":"2024-04-09T08:33:34.000Z","size":66,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-31T12:04:33.377Z","etag":null,"topics":["configuration-files","configuration-management","django","dotenv","python"],"latest_commit_sha":null,"homepage":"","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/jnoortheen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-10-10T16:19:16.000Z","updated_at":"2023-09-09T10:01:21.000Z","dependencies_parsed_at":"2022-09-10T04:03:58.636Z","dependency_job_id":null,"html_url":"https://github.com/jnoortheen/dynamic-conf","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jnoortheen%2Fdynamic-conf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jnoortheen%2Fdynamic-conf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jnoortheen%2Fdynamic-conf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jnoortheen%2Fdynamic-conf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jnoortheen","download_url":"https://codeload.github.com/jnoortheen/dynamic-conf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238223769,"owners_count":19436722,"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-files","configuration-management","django","dotenv","python"],"created_at":"2024-10-10T23:48:38.703Z","updated_at":"2025-10-25T23:31:28.705Z","avatar_url":"https://github.com/jnoortheen.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dynamic-config\nProject configuration variables are declared beforehand and inferred from environment variables or configuration files. Useful while developing and deploying( CI/CD) django web-apps\n\n-------\n\n[![PyPi Version](https://img.shields.io/pypi/v/dynamic-conf.svg?style=flat)](https://pypi.python.org/pypi/dynamic-conf)\n[![Python Version](https://img.shields.io/pypi/pyversions/returns.svg)](https://pypi.org/project/dynamic-conf/)\n\n-------\n\n\n# Install\n```\npip install dynamic-conf\n```\n\n# Features\n- supports `.env` or `.py` files\n- supports casting with type annotations\n- You also don't need to include a sample file. Since the `Config` object would be able to generate `.env.py` itself.\n- It also loads Configuration variables from environment variables.\nThe order of preference is `env variables` \u003e `env.py`\n- Attributes are lazily evaluated.\n\n# Getting Started\n\n- You need to subclass the `Config` class.\n- The config file should define all the variables needed for a project.\n\n```python\n\n# project/conf.py\n\nfrom dynamic_conf import Config\n\nclass CONFIG(Config):\n    \"\"\"singleton to be used for configuring from os.environ and env.py\"\"\"\n\n    SECRET_KEY:str      # required value\n\n    # default settings\n    ENV = \"prod\"        # optional field with a default value\n\n    DB_NAME = \"db\"\n    DB_HOST = \"127.0.0.1\"\n    DB_USER = \"postgres\"\n    DB_PASS = None      # even None could be given as default value\n```\n\n- to create `project/env.py` just run with the path to CONFIG class's module\n```shell script\n# you could pass environment variables or set already with export\nenv DB_PASS='123' dynamic-conf project/conf.py\n\ndynamic-conf project/conf.py DB_USER='user-1' DB_PASS='123' # pass as list of key-value pair\n\n#to filter environment variables with a prefix\nenv VARS_PREFIX=\"PROD_\" dynamic-conf project/conf.py PROD_DB_USER=\"user-2\"\n```\n\n# Usage\n\n- To use the config simply import and use particular attribute\n```python\n# project/settings.py\nfrom conf import CONFIG\nDATABASES = {\n    \"default\": {\n        \"ENGINE\": \"django.contrib.gis.db.backends.postgis\",\n        \"HOST\": CONFIG.DB_HOST,\n        \"NAME\": CONFIG.DB_NAME,\n        \"USER\": CONFIG.DB_USER,\n        \"PASSWORD\": CONFIG.DB_PASSWORD,\n        \"PORT\": \"5432\",\n    }\n}\n```\n\n# New release\n\n- create a new release from Github web interface. The package is published to PyPI using Github Actions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjnoortheen%2Fdynamic-conf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjnoortheen%2Fdynamic-conf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjnoortheen%2Fdynamic-conf/lists"}