{"id":15909209,"url":"https://github.com/dnouri/noconf","last_synced_at":"2025-10-17T13:32:21.976Z","repository":{"id":163533376,"uuid":"629039613","full_name":"dnouri/noconf","owner":"dnouri","description":"Component-based configuration for everyone!","archived":false,"fork":false,"pushed_at":"2023-09-13T08:55:05.000Z","size":25,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-25T12:59:33.946Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/dnouri.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-17T13:50:10.000Z","updated_at":"2023-05-10T14:17:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"8d4216b2-5104-4234-a196-84e97051a741","html_url":"https://github.com/dnouri/noconf","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/dnouri/noconf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnouri%2Fnoconf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnouri%2Fnoconf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnouri%2Fnoconf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnouri%2Fnoconf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dnouri","download_url":"https://codeload.github.com/dnouri/noconf/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnouri%2Fnoconf/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279353002,"owners_count":26154071,"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","status":"online","status_checked_at":"2025-10-17T02:00:07.504Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-10-06T14:42:21.802Z","updated_at":"2025-10-17T13:32:21.954Z","avatar_url":"https://github.com/dnouri.png","language":"Python","readme":"======\nnoconf\n======\n\nKey features\n============\n\n1. **Flexible configuration**: noconf allows you to configure your\n   Python applications using configuration files that use Python\n   syntax.\n\n2. **Multiple configuration files**: noconf allows you to split your\n   configuration across multiple files, making it easier to manage and\n   update your configuration as your application grows.\n\n3. **Configuration referencing**: noconf allows you to reference other\n   parts of your configuration from within your configuration,\n   avoiding duplication and keeping your configuration DRY (Don't\n   Repeat Yourself).\n\n4. **Component-based programming**: noconf enables you to initialize\n   classes using your configuration, making it easy to compose complex\n   systems out of smaller, reusable components. This promotes code\n   reuse and maintainability.\n\nUsage\n=====\n\nAt a minimum, noconf allows us to read configuration that's stored in\nfiles with Python syntax, where the file contains exactly one top\nlevel dictionary.\n\nLet's first write a very simple config file:\n\n\u003e\u003e\u003e config1_fname = folder / \"config1.py\"\n\u003e\u003e\u003e config1_fname.write_text(\"\"\"\n... {'key1': 'value1', 'key2': ['value2']}\n... \"\"\")\n40\n\n\u003e\u003e\u003e from noconf import load\n\u003e\u003e\u003e load(config1_fname)\n{'key1': 'value1', 'key2': ['value2']}\n\nWe can also chain configuration files, that is, load multiple\nconfiguration files and merge them, where contents of the files later\nin the list of files to load will take precedence:\n\n\u003e\u003e\u003e config2_fname = folder / \"config2.py\"\n\u003e\u003e\u003e config2_fname.write_text(\"\"\"\n... {'key1': 'new', 'key3': {'__copy__': 'key2'}}\n... \"\"\")\n47\n\u003e\u003e\u003e load((config1_fname, config2_fname))  # a tuple of config files\n{'key1': 'new', 'key2': ['value2'], 'key3': ['value2']}\n\nNotice that in the above example, we also used a `'__copy__'` feature,\nwhich allows us to refer to other parts in the configuration, and to\navoid duplication.\n\nWe can also instantiate classes directly from the configuration.\nLet's create a configuration file that instantiates a Python logging\nFileHandler class.  We're also going to configure the FileHandler with\na filename that's passed as an environment variable.  We use the\nspecial `environ` variable in noconf to access environment variables:\n\n\u003e\u003e\u003e setenv(\"LOGFILE\", str(folder / \"mylogfile.txt\"))\n\n\u003e\u003e\u003e config3_fname = folder / \"config3.py\"\n\u003e\u003e\u003e config3_fname.write_text(\"\"\"\n... {\n...     'handlers': [\n...         {\n...             '!': 'logging.FileHandler',\n...             'filename': environ['LOGFILE'],\n...         },\n...     ],\n... }\n... \"\"\")\n135\n\u003e\u003e\u003e config = load(config3_fname)\n\u003e\u003e\u003e filehandler = config['handlers'][0]\n\n\u003e\u003e\u003e from pathlib import Path\n\u003e\u003e\u003e Path(filehandler.baseFilename).parts[-1]\n'mylogfile.txt'\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdnouri%2Fnoconf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdnouri%2Fnoconf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdnouri%2Fnoconf/lists"}