GxMMx Flow core functionality
Project description
Flow Core
GxMMx Flow Core is a Python package for Flow's core functionality.
Flow Core is the building block used and extended by Flow images for workflows.
It consists of basic configuration, validation and management of Flow parameters.
Information
Requirements
Python 3.11+
Installation
Package is available on PyPI and installable via pip:
pip install gxmmx-flow-core
Usage
from gxmmx_flow_core import Flow, FlowLog, FlowCodeQuality, FlowValidationError
# Add config_param decorator to function
# Declares validation for a config parameter.
# This value must be an integer.
# In this case if the value is not present in the config,
# the value gets a default of 15.
# If it is greater than 30 it is invalid, and an exception is raised.
@Flow.config_param()
def param_some_int(value):
if value is None:
value = 15
if not isinstance(value, int):
raise FlowValidationError("some_int must be an integer")
if value > 30:
raise FlowValidationError("some_int must be 30 or less")
return value
# Creates directory and parent directories
# under the root dir that the program is called from.
Flow.ensure_directory("my_build_dir")
# Creates a code quality report that logs errors
# to stdout as well as creates a report.
cq_report = FlowCodeQuality("my_report")
# Looks for and loads flow.yml config file.
# Can be specified by 'FLOW_CONFIG_PATH' env variable.
Flow.start()
# dummy logic
something_failed_in_file_txt = True
if something_failed_in_file_txt:
cq_report.critical(name="my-error",
desc="description of error",
path="file.txt", begin=14)
FlowLog.msg("This is a normal message")
FlowLog.wrn("This is a warning message")
# Finish report and write it out.
# If there are errors, the program will exit with error.
cq_report.write()
Development
Development documentation can be found under the projects
docs
.
Changes
Version history with features and bugfixes, as well as upcoming features and roadmap
depicted in CHANGELOG.md
Contributing
Any contributions are greatly appreciated. See CONTRIBUTING.md
for more information.
Contributors
License
Distributed under the MIT License. See LICENSE
for more information.
Contact
Guðmundur Guðmundsson - gummigudm@gmail.com
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file gxmmx_flow_core-0.1.0.tar.gz
.
File metadata
- Download URL: gxmmx_flow_core-0.1.0.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: poetry/1.8.3 CPython/3.12.6 Linux/5.15.154+
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4578e4c7c86a6bf21304b4b376f7b7b34c0a5add747ab259dc6806ae550074b |
|
MD5 | d7db05a61e4e5ccccacc85f8736ebac3 |
|
BLAKE2b-256 | 82c42304bd582c8540bd71a4af7aceee1eb5050c03d334805885a9a812575653 |
File details
Details for the file gxmmx_flow_core-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: gxmmx_flow_core-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: poetry/1.8.3 CPython/3.12.6 Linux/5.15.154+
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d805b499fa86e766161f44256193286d90be0623fa2e7d26a849b882d6a4b6e |
|
MD5 | 33de7ff6f95bf9be911803b99ef1690c |
|
BLAKE2b-256 | e981be69a545556063f42cb2e7773ff714a3cd62b903c00662a5e90fe5f059cb |