cfgenvy


Namecfgenvy JSON
Version 2.0.0 PyPI version JSON
download
home_page
SummaryConfiguration from Environment embedded in yaml.
upload_time2023-02-03 15:28:20
maintainer
docs_urlNone
author
requires_python>=3.9
licenseMIT License Copyright (c) 2021 Penn Signals Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ## Overview

[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

[![Release](https://github.com/pennsignals/cfgenvy/workflows/release/badge.svg)](https://github.com/pennsignals/cfgenvy/actions?query=workflow%3Arelease)

[![Test](https://github.com/pennsignals/cfgenvy/workflows/test/badge.svg)](https://github.com/pennsignals/cfgenvy/actions?query=workflow%3Atest)

Keep secrets out of env variables in production by using env files. Merge env files into configuration dynamically. Keep env file and env variable handling out of the application by making application dependent only on the configuration file. Prefer deserilization from yaml over configuration of partially initialized objects.

An argument parser that accepts:

- A required yaml file for configuration/deserialization.
- An optional env file for secrets.

Features:

- MIT license
- Interpolate environment variables directly into yaml configuration.
- Optional replacement of environment variables with an environment variable file.
- Use C Yaml safe load/dump or yaml safe load/dump.
- Pass in env to parser with os.environ as a default.
- Pass in argv to parser with sys.argv[1:] as a default.
- Yaml type registration functions.

Relative configargparse, python-dotenv, envyaml, and yamlenv:

- Dependency injection through depth-first deserialization of yaml is better than two-pass, breadth-first initialization followed by a configuration.
- Contract for env variables is between configuration file and env xor the env file, the app no longer cares much about env or secrets as it uses the interpolated configuration file.
- No ${MY_VAR:my-default} --unexpected env var syntax for default values, an expensive pattern match, and allows typos of MY_VAR to pass silently--.
- No "N/A" or null default when environment variable does not exist --allows configuration errors to pass silently to become runtime errors--.
- Env file is optional, but when provided it does not merge with existing environment variables --better tracability in production deployment--.
- Yaml type registration retains the registered yaml tag in a closure.
- Env yaml type registration retains the registered env variable set in a closure.

## Install

    pip install "."

## Develop, Lint & Test

Setup virtual environment:

    python3.10 -m venv .venv

Or setup homebrew environment:

    brew install python@3.10
    /opt/homebrew/Cellar/python@3.10/.../Frameworks/Python.framework/Versions/Current/python@3.10 -m venv .venv

Once virtual environment is setup:

    . .venv/bin/activate
    pip install -U pip setuptools wheel
    pip install -e ".[dev]"
    pre-commit install

Session:

    . .venv/bin/activate
    ...
    pytest
    ...
    pre-coommit run --all-files
    ...
    git commit -m 'Message'
    ...
    deactivate

## Docker, Lint & Test

    docker compose up test
    docker compose up pre-commit
    docker compose up build-wheel && docker compose up install-wheel
    ...
    docker compose down

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "cfgenvy",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "",
    "author": "",
    "author_email": "Jason Lubken <jlubken@users.noreply.github.com>, Graydon Neill <grayeye@users.noreply.github.com>, Penn Signals <pennsignals@pennmedicine.upenn.edu>",
    "download_url": "",
    "platform": null,
    "description": "## Overview\n\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\n[![Release](https://github.com/pennsignals/cfgenvy/workflows/release/badge.svg)](https://github.com/pennsignals/cfgenvy/actions?query=workflow%3Arelease)\n\n[![Test](https://github.com/pennsignals/cfgenvy/workflows/test/badge.svg)](https://github.com/pennsignals/cfgenvy/actions?query=workflow%3Atest)\n\nKeep secrets out of env variables in production by using env files. Merge env files into configuration dynamically. Keep env file and env variable handling out of the application by making application dependent only on the configuration file. Prefer deserilization from yaml over configuration of partially initialized objects.\n\nAn argument parser that accepts:\n\n- A required yaml file for configuration/deserialization.\n- An optional env file for secrets.\n\nFeatures:\n\n- MIT license\n- Interpolate environment variables directly into yaml configuration.\n- Optional replacement of environment variables with an environment variable file.\n- Use C Yaml safe load/dump or yaml safe load/dump.\n- Pass in env to parser with os.environ as a default.\n- Pass in argv to parser with sys.argv[1:] as a default.\n- Yaml type registration functions.\n\nRelative configargparse, python-dotenv, envyaml, and yamlenv:\n\n- Dependency injection through depth-first deserialization of yaml is better than two-pass, breadth-first initialization followed by a configuration.\n- Contract for env variables is between configuration file and env xor the env file, the app no longer cares much about env or secrets as it uses the interpolated configuration file.\n- No ${MY_VAR:my-default} --unexpected env var syntax for default values, an expensive pattern match, and allows typos of MY_VAR to pass silently--.\n- No \"N/A\" or null default when environment variable does not exist --allows configuration errors to pass silently to become runtime errors--.\n- Env file is optional, but when provided it does not merge with existing environment variables --better tracability in production deployment--.\n- Yaml type registration retains the registered yaml tag in a closure.\n- Env yaml type registration retains the registered env variable set in a closure.\n\n## Install\n\n    pip install \".\"\n\n## Develop, Lint & Test\n\nSetup virtual environment:\n\n    python3.10 -m venv .venv\n\nOr setup homebrew environment:\n\n    brew install python@3.10\n    /opt/homebrew/Cellar/python@3.10/.../Frameworks/Python.framework/Versions/Current/python@3.10 -m venv .venv\n\nOnce virtual environment is setup:\n\n    . .venv/bin/activate\n    pip install -U pip setuptools wheel\n    pip install -e \".[dev]\"\n    pre-commit install\n\nSession:\n\n    . .venv/bin/activate\n    ...\n    pytest\n    ...\n    pre-coommit run --all-files\n    ...\n    git commit -m 'Message'\n    ...\n    deactivate\n\n## Docker, Lint & Test\n\n    docker compose up test\n    docker compose up pre-commit\n    docker compose up build-wheel && docker compose up install-wheel\n    ...\n    docker compose down\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2021 Penn Signals  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Configuration from Environment embedded in yaml.",
    "version": "2.0.0",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7183c3d326334cdd2f5a7f18427a7062d31601b20cd759e7fd7bdeb7f263d052",
                "md5": "c3c616955cad140a8ad25ac5c4f2537c",
                "sha256": "09c40713fafc8882bd13abf5e9d4f80fb7f5bc25293637ac73720df54924e55c"
            },
            "downloads": -1,
            "filename": "cfgenvy-2.0.0-py39.py310.py311-none-any.whl",
            "has_sig": false,
            "md5_digest": "c3c616955cad140a8ad25ac5c4f2537c",
            "packagetype": "bdist_wheel",
            "python_version": "py39.py310.py311",
            "requires_python": ">=3.9",
            "size": 6801,
            "upload_time": "2023-02-03T15:28:20",
            "upload_time_iso_8601": "2023-02-03T15:28:20.137305Z",
            "url": "https://files.pythonhosted.org/packages/71/83/c3d326334cdd2f5a7f18427a7062d31601b20cd759e7fd7bdeb7f263d052/cfgenvy-2.0.0-py39.py310.py311-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-02-03 15:28:20",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "cfgenvy"
}
        
Elapsed time: 0.03467s