A collection of useful utilities
Project description
utilki
utils that are frequently used by me and might be useful for others
installation
pip install utilki
TaskMixin
Mixin class that adds create()
classmethod to dataclass you define as your task params. Useful when you have a lot of container based tasks executed on remote clusters (e.g. Kubernetes, Hashicorp Nomad, etc.). It reads task params from environment variables, parses, and validates them.
from utilki import TaskMixin
@dataclass
class Task(TaskMixin):
ayy: float = 69.69
lmao: str = "420"
os.environ["ayy"] = "42.42"
os.environ["lmao"] = "69"
t = Task.create()
print(f"ayy: {t.ayy}, type: {type(t.ayy)}")
# ayy: 42.42, type: <class 'float'>
print(f"lmao: {t.lmao}, type: {type(t.lmao)}")
# lmao: 69, type: <class 'str'>
Cli
Venv
$ utilki venv 3.8.10
$ Enter venv name: new_venv
$ Created venv `new_venv` with Python version 3.8.10
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
utilki-0.13.0.tar.gz
(9.1 kB
view hashes)
Built Distribution
utilki-0.13.0-py3-none-any.whl
(10.0 kB
view hashes)