{"id":19632486,"url":"https://github.com/metwork-framework/opinionated_configparser","last_synced_at":"2026-03-07T00:32:16.998Z","repository":{"id":49265981,"uuid":"233815118","full_name":"metwork-framework/opinionated_configparser","owner":"metwork-framework","description":"opinionated python configparser library override to deal with configuration variants (PROD, DEV...)","archived":false,"fork":false,"pushed_at":"2025-05-27T03:18:51.000Z","size":50,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-02-15T17:40:17.646Z","etag":null,"topics":["autoreadme","configparser","configuration-variants","github-actions","integration-level-3","jinja2","python-configparser-library"],"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/metwork-framework.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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,"zenodo":null}},"created_at":"2020-01-14T10:23:09.000Z","updated_at":"2025-05-27T03:18:55.000Z","dependencies_parsed_at":"2023-12-18T17:49:19.566Z","dependency_job_id":"7c909a31-663e-4f21-9826-d01f19867d26","html_url":"https://github.com/metwork-framework/opinionated_configparser","commit_stats":{"total_commits":46,"total_committers":5,"mean_commits":9.2,"dds":0.6086956521739131,"last_synced_commit":"a15664eaaaad36d27ced60fe93b3523ec6e850a8"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/metwork-framework/opinionated_configparser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metwork-framework%2Fopinionated_configparser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metwork-framework%2Fopinionated_configparser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metwork-framework%2Fopinionated_configparser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metwork-framework%2Fopinionated_configparser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/metwork-framework","download_url":"https://codeload.github.com/metwork-framework/opinionated_configparser/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metwork-framework%2Fopinionated_configparser/sbom","scorecard":{"id":638436,"data":{"date":"2025-08-11","repo":{"name":"github.com/metwork-framework/opinionated_configparser","commit":"ae32b76536155541358be826c1e81c217b164986"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.7,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":2,"reason":"3 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 1/27 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Warn: no topLevel permission defined: .github/workflows/pythonpublish.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/metwork-framework/opinionated_configparser/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/metwork-framework/opinionated_configparser/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pythonpublish.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/metwork-framework/opinionated_configparser/pythonpublish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pythonpublish.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/metwork-framework/opinionated_configparser/pythonpublish.yml/master?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/ci.yml:21","Warn: pipCommand not pinned by hash: .github/workflows/ci.yml:22","Warn: pipCommand not pinned by hash: .github/workflows/ci.yml:25","Warn: pipCommand not pinned by hash: .github/workflows/ci.yml:33","Warn: pipCommand not pinned by hash: .github/workflows/ci.yml:40","Warn: pipCommand not pinned by hash: .github/workflows/pythonpublish.yml:18","Warn: pipCommand not pinned by hash: .github/workflows/pythonpublish.yml:19","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   7 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"10 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: PYSEC-2019-217 / GHSA-462w-v97r-4m45","Warn: Project is vulnerable to: PYSEC-2014-8 / GHSA-8r7q-cvjq-x353","Warn: Project is vulnerable to: GHSA-cpwx-vrp4-4pq7","Warn: Project is vulnerable to: PYSEC-2014-82 / GHSA-fqh9-2qgg-h84h","Warn: Project is vulnerable to: PYSEC-2021-66 / GHSA-g3rq-g295-4j3m","Warn: Project is vulnerable to: GHSA-h5c8-rqwp-cp95","Warn: Project is vulnerable to: GHSA-h75v-3vvj-5mfj","Warn: Project is vulnerable to: PYSEC-2019-220 / GHSA-hj2j-77xm-mc5v","Warn: Project is vulnerable to: GHSA-q2x7-8rv6-6q7h","Warn: Project is vulnerable to: PYSEC-2022-238 / GHSA-h3qr-fjhm-jphw"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 5 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-21T09:57:43.378Z","repository_id":49265981,"created_at":"2025-08-21T09:57:43.378Z","updated_at":"2025-08-21T09:57:43.378Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30204154,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-06T19:07:06.838Z","status":"ssl_error","status_checked_at":"2026-03-06T18:57:34.882Z","response_time":250,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["autoreadme","configparser","configuration-variants","github-actions","integration-level-3","jinja2","python-configparser-library"],"created_at":"2024-11-11T12:14:16.976Z","updated_at":"2026-03-07T00:32:16.959Z","avatar_url":"https://github.com/metwork-framework.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# opinionated_configparser\n\n[//]: # (automatically generated from https://github.com/metwork-framework/github_organization_management/blob/master/common_files/README.md)\n\n**Status (master branch)**\n\n[![GitHub CI](https://github.com/metwork-framework/opinionated_configparser/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/metwork-framework/opinionated_configparser/actions?query=workflow%3ACI+branch%3Amaster)\n[![Maintenance](https://raw.githubusercontent.com/metwork-framework/resources/master/badges/maintained.svg)](https://github.com/metwork-framework/resources/blob/master/badges/maintained.svg)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/metwork-framework/opinionated_configparser/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/metwork-framework/opinionated_configparser/?branch=master)\n[![codecov](https://codecov.io/gh/metwork-framework/opinionated_configparser/branch/master/graph/badge.svg)](https://codecov.io/gh/metwork-framework/opinionated_configparser)\n\n\n\n\n## What is it?\n\nThis is an opinionated Python2/Python3 thin layer over the [Python configparser library](https://docs.python.org/3/library/configparser.html) to deal with:\n\n- configuration variants (PROD, DEV...) expressed as alternative keys in ini file\n- [jinja2](https://jinja.palletsprojects.com/) as (optional) interpolation method for configuration values\n\nFor Python2, we use [Python3 configparser backport](https://pypi.org/project/configparser/).\n\n\n## Concepts\n\n### Configuration variants\n\n#### Basic\n\nWith this example:\n\n```ini\n[group1]\ndebug=0\ndebug[DEV]=1\n```\n\nWe have two default configuration variant for the `debug` key: the `DEV` one and the default one.\n\nIf you don't do anything special, the `debug` value will be `0` (standard default value).\n\nBut if you initialize the library with `DEV` as *configuration name*, the `debug` value will be `1`.\n\nNow, if you use `PROD` as *configuration name*, as there is no `debug[PROD]` line/variant,\nthe debug value will fallback to standard value: `0` (in this example).\n\n#### Inheritance\n\nStill with the same example:\n\n```ini\n[group1]\ndebug=0\ndebug[DEV]=1\n```\n\nWhat about if we use `DEV_JOHN_MONDAY` as *configuration name* when initializing the library?\n\nAs there is no `debug[DEV_JOHN_MONDAY]` line,\none might think that the retained value would be the default one: `0`.\n\nIn fact, the retrained value will be `1`! Why? Because `_` (underscore) has a special meaning\nin configuration names. This is a kind of inheritance mark.\n\nSo `DEV_JOHN_MONDAY` means as a configuration name:\n\n- use `DEV_JOHN_MONDAY` if there is a variant with this exact name\n- (else) use `DEV_JOHN` (first level of inheritance) if there is a variant with this name: `DEV_JOHN`\n- (else) use `DEV` (second level of inheritance) if there is a variant with this name: `DEV`\n- (else) use standard/default value\n\nSo with this example:\n\n```ini\n[group1]\ndebug=0\ndebug[DEV]=1\ndebug[DEV_JOHN]=2\ndebug[DEV_PETER]=3\ndebug[DEV_JOHN_MONDAY]=4\ndebug[DEV_JOHN_TUESDAY]=5\ndebug[QA]=6\n```\n\nWe get this table:\n\nConfiguration name | selected value for `debug` key | comment\n--- | --- | ---\n`FOO` | `0` | standard value is used\n`DEV` | `1` | exact variant\n`DEV_JOHN_MONDAY` | `4` | exact variant\n`DEV_JOHN_FRIDAY` | `2` | `DEV_JOHN` level of inheritance is used\n`DEV_PETER` | `3` | exact variant\n`DEV_KATE` | `1` | `DEV` level of inheritance is used\n`DEV_SMITH_FOO_BAR_1` | `1` | `DEV` level of inheritance is used\n`DEV_JOHN_QA` | `2` | `DEV_JOHN` level of inheritance is used\n`FOO_QA` | `0` | the `QA` level can be used only if the configuration name begins with `QA`\n`QA5` | `0` | the `QA5` variant does not exist and there is no inheritance because there is no `underscore`\n`QA_5` | `6` | `QA` level of inheritance\n\n### jinja2 usage inside configuration values\n\nBy default, we use [jinja2](https://jinja.palletsprojects.com/) as interpolation method\nfor configuration values. The Jinja2 context is initialized with environment variables.\n\nSo with this example:\n```ini\n[group1]\nkey=This is a Jinja2 test value: {{HOME}}\n```\n\nYou will get the `{{HOME}}` placeholder replaced by the corresponding environment variable value.\n\nMissing variables will be replaced by the empty string (without errors).\n\nYou can define your own Jinja2 context by adding `interpolation=opinionated_configparser.Jinja2Interpolation(jinja2_context)` to the `OpinionatedConfigParser` constructor call.\n\n## Usage\n\n`opinionated_configparser` is just a thin layer over [Python configparser library](https://docs.python.org/3/library/configparser.html). So you use it exactly in the same way.\n\nJust an example:\n\n```python\nfrom opinionated_configparser import OpinionatedConfigParser\n\n\nTEST_DICT = {\n    \"section1\": {\n        \"key1\": \"value1\",\n        \"key1[foo]\": \"value2\",\n        \"key1[foo_bar]\": \"value3\",\n        \"key2\": \"value4\"\n    },\n    \"section2\": {\n        \"key3\": \"value5\"\n    }\n}\n\n\nparser = OpinionatedConfigParser(configuration_name=\"foo\")\nparser.read_dict(TEST_DICT)\n\n# will output: value2\nprint(parser.get(\"section1\", \"key1\"))\n\n# [...]\n# use the parser object exactly as configparser.ConfigParser one\n# [...]\n```\n\n## FAQ\n\n### What about if I don't want to use Jinja2 as interpolation method?\n\nJust pass `interpolation=None` keyword argument in `OpinionatedConfigParser`\nconstructor.\n\nOr use `interpolation=configparser.BasicInterpolation()` to get the default\ninterpolation method of `configparser` API.\n\n### What about if I want to use different jinja2 template options?\n\nJust pass `interpolation=opinionated_configparser.Jinja2Interpolation(jinja2_context, **jinja2_template_kwargs)` keyword argument in `OpinionatedConfigParser` constructor.\n\n\n\n\n\n\n## Contributing guide\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) file.\n\n\n\n## Code of Conduct\n\nSee [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) file.\n\n\n\n## Sponsors\n\n*(If you are officially paid to work on MetWork Framework, please contact us to add your company logo here!)*\n\n[![logo](https://raw.githubusercontent.com/metwork-framework/resources/master/sponsors/meteofrance-small.jpeg)](http://www.meteofrance.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetwork-framework%2Fopinionated_configparser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmetwork-framework%2Fopinionated_configparser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetwork-framework%2Fopinionated_configparser/lists"}