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.1.tar.gz (425.1 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.1-py3-none-any.whl (517.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for koi_fish-2.1.1.tar.gz
Algorithm Hash digest
SHA256 6f337ff44e348eb8bd9704d018c31202158105a48027785e204f035bf195deba
MD5 c62ac41b7b98d632fedfd7ae6fe39dcb
BLAKE2b-256 10bb522b8c85f309a48930643ca900f4e6c3c190a532150dbe2ef603726bf6e6

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for koi_fish-2.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3cfa7edc3a6f44d15e2f57fc97ae2bc7a96a85ddc7583b9d01885b05dc3c3e2a
MD5 d6e93aa387fe85dc1b2d7ffd40aa2308
BLAKE2b-256 2372faa28aac5cff12af88f41d2c17810ff6f5142438bd5ca44282b7882042a3

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2.1.1 This release

2 files

2.1.0

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