Your faithful sidekick
Project description
Zrb (WIP)
Your faithful sidekick
How to install
pip install zrb
How to use
To run a task, you can invoke the following command:
zrb <task> [arguments]
How to define tasks
Zrb will automatically load:
zrb.py
in your current directory.- or any Python file defined in
ZRB_SCRIPTS
environment.
You can use a colon separator (:
) to define multiple scripts in ZRB_SCRIPTS
. For example:
ZRB_SCRIPTS=~/personal/zrb.py:~/work/zrb.py
Your Zrb script should contain your tak definitions. For example:
from zrb import runner
install_venv = CmdTask(
name='install-venv',
inputs=[
StrInput(name='dir', default='venv', prompt='Venv directory'),
BooleanInput(
name='installrequirements',
default=True,
prompt='Install requirements (y/n)'
)
],
command='''
pip -m venv {{ input.dir }}
source {{ input.dir}}/bin/activate
{% if input.installrequirements %}pip install -r requirements.txt{% endif %}
'''
)
run_fastapi = CmdProcess(
name='run-fastapi',
directory='./fastapi',
envs=[
Env(name='PORT', global_name='FASTAPI_PORT', default='3000')
],
inputs=[
BooleanInput(name='reload', default=False, prompt='Auto reload (y/n)')
],
upstream=[install_venv],
command='uvicorn main:app {% if input.reload %}--reload{% endif %}',
check=[
HttpPortCheck('{{env.PORT}}'),
]
)
runner.register(install_venv)
runner.register(run_fastapi)
Once you register your tasks, they will be accessible from the terminal:
# Invoke `run-fastapi` and make sure `install-venv` has been already performed
export FASTAPI_PORT=8080
zrb run-fastapi -reload=yes -installrequirements=yes
For developer
There is a toolkit to help you manage zrb
source ./toolkit.sh
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
zrb-0.0.2.tar.gz
(3.3 kB
view details)
Built Distribution
zrb-0.0.2-py3-none-any.whl
(3.4 kB
view details)
File details
Details for the file zrb-0.0.2.tar.gz
.
File metadata
- Download URL: zrb-0.0.2.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.28.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2af56ba0f11ed2bad72c976250bea65b3abbd9d25d5f40758690cb9e039d64b |
|
MD5 | ca6d0d54442937244ccafd847e03871f |
|
BLAKE2b-256 | 80e1690fd69888e4ce7153410fe2f6014c567c62789caaea58c8f3e7d318e07b |
File details
Details for the file zrb-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: zrb-0.0.2-py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.28.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 19c2f0027dee7a946f182235f227c7208aa406887fe1e66616b7e4dcbb070d85 |
|
MD5 | 5bafd1e0da3beda9b919005a926952b3 |
|
BLAKE2b-256 | 0e209e3047f2cc3cffea79409472afd0480c4cd3836536bfb81760a71b534c23 |