Package: cyto
Cyto 🦠Idiomatic boilerplate and glue code for PythonCyto lets you:Create aclickCLI from apydanticmodelLoadpydantic settingsfromTOMLfiles [WIP]Daemonizeyour application [WIP]Cyto is the bridge between an oppinionated selection of Python tech.
Cyto is everything you need to create a modern Python app.
Cyto is the glue and boilerplate code that you no longer have to write yourself.Only pay for what you useSo you only want the click–pydantic integration but not the TOML loader?
Don't worry, Cyto is split into so-calledextras so you can select just the extras that you want. In turn, Cyto only pulls in the dependencies for the selected extras. This is the "only pay for what you use" principle. In fact, Cyto haszerodependencies per default.Here is the list of extras:settings.sources.cli: Create aclickCLI from apydanticmodelsettings.sources.toml: Loadpydantic settingsfromTOMLfiles [WIP]app: [WIP]InstallationInstall Cyto along withallextras:pip install cyto[all]Similar for poetry:poetry add cyto[all]Choose specific extrasIf you only want a specific extra, choose that when you install Cyto. E.g.:pip install cyto[settings.sources.cli]Similar for poetry:poetry add cyto[settings.sources.cli]DevelopmentPython VersionDevelopment requires Python 3.8 or later. Test your python version with:python3--versionIf you have multiple python installations, you can replacepython3with a specific version (e.g.,python3.8) in the steps below.Getting StartedDo the following:Clone this repositorygitclonegit@github.com:sbtinstruments/cyto.gitInstall poetry (for dependency management)curl-sSLhttps://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py|python3Optional: Use a local poetry virtual environmentpoetryconfig--localvirtualenvs.in-projecttrueThis integrates better with editors such as Visual Studio Code.Create poetry's virtual environment and get all dependencies
and all extra features.poetryinstall--extrasallOptional: Run the QA basic tools (e.g., isort, black, pylint, mypy) automatically before each commitpoetryrunpre-commitinstallQuality Assurance (QA) ToolsQA Basic ToolsAll QA basic tools automatically run in Jenkins for each commit pushed
to the remote repository. If you installed thepre-commithooks,
all QA basic tools automatically run before each commit too.The QA basic tools are:isort(for import ordering)black(for formatting)pylint(for linting)mypy(for type checking)You can run the QA basic tools manually. This is useful if you
don't want to install thepre-commithooks.Run the QA basic tools manually with:poetryruntaskisort
poetryruntaskblack
poetryruntaskpylint
poetryruntaskmypyRun all the basic QA tools manually with a single command:poetryruntaskpre-commitNote that this doesn't require you to install thepre-commithooks.QA Test ToolsAll of the tools below automatically run in Jenkins for each
commit pushed to the remote repository.The QA test tools are:tox(for automation across Python versions)pytest(the test framework itself)pytest-cov(for test coverage percentage)Run the tests manually:Installtoxpython3-mpipinstalltoxStart a tox run:toxNote thattoxinvokespytestin a set of virtual environments. Said
virtual environments have nothing to do with poetry's virtual environment. Poetry and tox runs in isolation of each other.Visual Studio CodeSettingsWe have a default settings file that you can use via the following command:cp.vscode/settings.json.default.vscode/settings.jsonThis is optional.Python InterpreterHopefully, you used the local poetry virtual environment during
installation (thepoetry config --local virtualenvs.in-project truepart). This way, Visual Studio Code automatically finds the
Python interpreter within poetry's virtual environment.Alternatively, you can point Visual Studio Code to poetry's
global virtual environments folder. Add the following entry
to your./vscode/settings.jsonfile:{"python.venvPath":"~/.cache/pypoetry/virtualenvs"}Then, you look for the poetry's currently active virtual environment:poetryenvlistLastly, you use the Visual Studio Code commandPython: Select Interpreterand choose the interpreter inside
poetry's currently active virtual environment.