Skip to main content

Koi fish

Koi fish

Python 3.X PyPI Downloads


Command line task runner & automation tool


How to use

  • Describe tasks as tables/dictionaries in a config file named 'koi.toml'.
[test]
description = "run tests"
pre_run = "uv sync --all-extras --dev"
commands = "uv run pytest -v ."
post_run = "rm -rf .pytest_cache/"
  • description, pre_run and post_run could be optional but not commands
  • post_run always runs as cleanup (even if pre_run or commands failed)
[no-deps]
commands = "echo 'Hello world'"
  • they can have long (full) or short names
[test]
info = "run tests"
pre = "uv sync --all-extras --dev"
cmd = "uv run pytest -v ."
post = "rm -rf .pytest_cache/"
  • pre_run, commands and post_run could be strings or (in case of more than one) a list of strings
commands = ["uv run ruff check", "uv run ruff format"]
  • You could provide an optional [run] table inside the config file with a 'main' flow - list of selected tasks to run, alongside with other flows
    (In this case the 'main' table is mandatory and will be executed by default unless explicitly specified otherwise)
[run]
main = ["lint", "format", "test"]
full = ["install", "lint", "format", "test", "teardown"]

Example koi.toml (used as a main automation tool during the development of this project)

[install]
description = "setup .venv and install dependencies"
commands = "uv sync --all-extras --dev"

[format]
description = "format code"
commands = ["uv run ruff check", "uv run ruff format"]

[lint]
description = "run mypy"
commands = "uv run mypy ."

[teardown]
description = "remove venv and cache"
commands = "rm -rf .venv/ .ruff_cache/ .mypy_cache/"

[run]
description = "tasks pipeline"
main = ["install", "format", "lint"]

  • Run the tool in the terminal with a simple 'koi' command and pass the directory path where the koi.toml file resides
    (if it is the current directory the path argument can be omitted)
$ koi ~/pyproj/foo/
(logs omitted...)
$ All tasks succeeded! ['lint', 'format', 'test']
Run took: 14.088007061000098
  • In case of failing tasks you get general stats
(logs omitted...)
$ Unsuccessful run took: 13.532951637999759
Failed tasks: ['format']
Successful tasks: ['lint', 'test']

or

$ Unsuccessful run took: 8.48367640699962
Failed tasks: ['format']
Successful tasks: ['lint']
Skipped tasks: ['test']

Running 'koi <path>' executes the 'main' flow from the [run] table.
If no such table is present, koi_fish will execute all tasks specified in the config file


  • You could run specific tasks in the command line
$ koi --task format

or a list of tasks

$ koi -t format test

NB: If there is a 'run' table in the config file tasks specified in the command line take precedence

  • other available options
# run all tasks from the config file
$ koi --run-all  # short form: -r
# hide output logs from running commands
$ koi --silent  # -s
# don't print shell commands - similar to @<command> in Makefile
$ koi --mute-commands  # -m
# skip task(s) from config file - can be combined e.g. with --run-all
$ koi -r --skip test  # -S
# cancel flow if a task fails
$ koi --fail-fast  # -F
# task(s) to run at the end if the flow fails
$ koi -rF --finally teardown
# allow duplicate tasks in flow
$ koi --allow-duplicates  # -A
# disable colored output in logs
$ koi --no-color  # -n
# run task(s) from given 'flow' table
$ koi --flow bar  # -f
  • commands showing data
# display all tasks from the config file
$ koi --all  # -a
# ['install', 'format', 'test', 'teardown', 'run']
# display 'run' table
$ koi --config  # -c
# display all tasks from a flow inside 'run' table
$ koi --describe-flow main # -D
# ['install', 'format', 'test']
# display config for given task(s)
$ koi --describe format  # -d
# FORMAT
#         description: format code
#         commands:    uv run ruff check
#                      uv run ruff format

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

koi_fish-2.1.0.tar.gz (425.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

koi_fish-2.1.0-py3-none-any.whl (517.2 kB view details)

Uploaded Python 3

File details

Details for the file koi_fish-2.1.0.tar.gz.

File metadata

  • Download URL: koi_fish-2.1.0.tar.gz
  • Upload date:
  • Size: 425.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.12

File hashes

Hashes for koi_fish-2.1.0.tar.gz
Algorithm Hash digest
SHA256 00597c536f38f2af3f580f168868e8bc18236067d69bfffcf9411359fecfd870
MD5 bb07c5c5ea70af3ab36421bbcfb09101
BLAKE2b-256 2724f59012495293fdf99b2fecaf7d2917a837e75982348a6a4e4fcb5619b105

See more details on using hashes here.

File details

Details for the file koi_fish-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: koi_fish-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 517.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.12

File hashes

Hashes for koi_fish-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7a5453942970d87cbc4ec01326c13ae7cc26955b12e77a04e9e325c177e057e5
MD5 0c3067952e1fb2830a2870c57d5b4df3
BLAKE2b-256 ab030132f8cbfeffa7326b75a09438ba60e13a765deaeda100b41116dce8b045

See more details on using hashes here.

Release history Release notifications | RSS feed

2.1.1

2 files

This release

2.1.0 This release

2 files

2.0.1

2 files

2.0.0

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page