Package: runtime-yolk
runtime-yolkRequirementsPython>= 3.8Load your local.envfile to environ, load your application.ini which can be
environment specific, and setup basic logging behavior all with a single call.
Designed to be low effort, runtime-yolk works well in the initial entry point of
a project and doesn't add additional requires to downstream libraries.Environment variables are loaded from the.envfile, or specified source,
directly toos.environ. This allows other processes to pull directly from
the environ and reduces library coupling.Configuration files are loaded asConfigParserobjects. The loading
layers each consecutive file allowing flexible environment specific configs to
be leveraged.  A custom{{key}}string interpolation is used when loading
config files to allow environ vars to be injected into the config. If the
requested key cannot be interpolated the literal value is kept instead of
raising exceptions.%is also safe for all api-token/key needs.Set logging levels and format initially from the configuration. Helper methods
for creating a logger for the entry script, define logging level, or addFileHandlersmake setup easier.InstallationFrom github:$python-mpipinstallgit+https://github.com/Preocts/runtime-yolk@#.#.#Replace the#.#.#with the desired version or@mainfor the latest (unstable).From pypi:$python-mpipinstallruntime-yolkUsage ExamplesLoading runtime setup manuallyLoading runtime setup automaticallySetup ofapplication.iniThe default configuration file looked for loading isapplication.ini. This can be change on call of.load_config()if desired. There are no required fields in the configuration file. However, a few will impactruntime-yolk's behavior directly when present in the[DEFAULT]section:logging_level: When set,.set_logging()will use this logging levellogging_format: Allow overriding the default logging format template used.Default is%(asctime)s - %(levelname)s - %(name)s - %(message)senvironment: When defined the value will be used to load additionalapplication-[environment].iniconfiguration files. These can be chained however will break the loading loop on a file that has already been loaded.Sample:[DEFAULT]logging_level=DEBUGlogging_format=%(asctime)s - %(levelname)s - %(name)s - %(message)senvironment={{YOLK_ENVIRONMENT}}.envfile loading.envfiles are loaded with the expectation of key = value pairs.#comments are allowed as well as blank lines.Current format for the.envfile supports strings only and is parsed in
the following order:Each separate line is considered a new possible key/value setEach set is delimited by the first=foundLeading and trailing whitespace are removedRemoves leading 'export ' prefix, case agnosticMatched leading/trailing single quotes or double quotes will be
stripped from values (not keys).Sample:# OAuth token goes here, do not commit this GlennSAMPLE_TOKEN=somesecrettokenforuseENVIRONMENT=sandboxLocal developer installationIt isstronglyrecommended to use a virtual environment
(venv) when working with python
projects. Leveraging avenvwill ensure the installed dependency files will
not impact other python projects or any system dependencies.The following steps outline how to install this repo for local development. See
theCONTRIBUTING.mdfile in the repo root for information on
contributing to the repo.Windows users: Depending on your python install you will usepyin place
ofpythonto create thevenv.Linux/Mac users: Replacepython, if needed, with the appropriate call to
the desired version while creating thevenv. (e.g.python3orpython3.8)All users: Once inside an activevenvall systems should allow the use ofpythonfor command line instructions. This will ensure you are using thevenv's python and not the system level python.Installation stepsClone this repo and enter root directory of repo:$gitclonehttps://github.com/Preocts/runtime-yolk$cdruntime-yolkCreate thevenv:$python-mvenvvenvActivate thevenv:#Linux/Mac$.venv/bin/activate#Windows$venv\Scripts\activateThe command prompt should now have a(venv)prefix on it.pythonwill now
call the version of the interpreter used to create thevenvInstall editable library and development requirements:#Updatepipandtools$python-mpipinstall--upgradepip#Installeditableversionoflibrary$python-mpipinstall--editable.[dev]Install pre-commit(see below for details):$pre-commitinstallMisc StepsRun pre-commit on all files:$pre-commitrun--all-filesRun tests:$tox[-r][-epy3x]Build dist:$python-mpipinstall--upgradebuild$python-mbuildTo deactivate (exit) thevenv:$deactivateNote on flake8:flake8is included in therequirements-dev.txtof the project. However it
disagrees withblack, the formatter of choice, on max-line-length and two
general linting errors..pre-commit-config.yamlis already configured to
ignore these.flake8doesn't supportpyproject.tomlso be sure to add the
following to the editor of choice as needed.--ignore=W503,E203--max-line-length=88pre-commitA framework for managing and maintaining multi-language pre-commit hooks.This repo is setup with a.pre-commit-config.yamlwith the expectation that
any code submitted for review already passes all selected pre-commit checks.pre-commitis installed with the development requirements and runs seemlessly
withgithooks.MakefileThis repo has a Makefile with some quality of life scripts if the system
supportsmake.  Please note there are no checks for an activevenvin the
Makefile.PHONYDescriptioninstall-devinstall development/test requirements and project as editable installcoverageRun coverage and output console reportdocker-testRun coverage and tests in a docker container.build-distBuild source distribution and wheel distributioncleanDeletes build, tox, coverage, pytest, mypy, cache, and pyc artifacts