Skip to main content

A make-like build utility for Python.

Project description

kumade

A make-like build utility for Python.

Features:

  • You can define tasks, such as executing commands, creating files, or invoking functions, in Kumadefile.py, with standard Python code.
  • You can run tasks from shell with kumade command.
  • Any task can have its dependencies and kumade considers the dependency graph to determin the task execution order.
  • Kumade decides whether or not to perform a file creation task with considering the file existence and whether its timestamp is older than its dependencies.
  • You can add configuration items in Kumadefile.py, and specify the values from command line when executing tasks. (v0.2.0 ~)
  • Kumade can execute tasks concurrently using the -j option. (v0.3.0 ~)

Kumade means rake in Japanese, and it is regarded as a lucky charm because it collects happiness.

Getting started

Install

To install kumade, use pip:

pip install kumade

Write Kumadefile.py

To define tasks, write Kumadefile.py.

For example,

import kumade as ku

from pathlib import Path
import subprocess

ku.set_default("greet")

help_file = Path("help.txt")

@ku.task("greet")
@ku.depend(help_file)
def greeting() -> None:
    print("Hi, this is Kumade.")
    print(f"See {help_file}.")

@ku.file(help_file)
def create_help_file() -> None:
    with help_file.open("w") as outfile:
        subprocess.run(["kumade", "-h"], stdout=outfile)

This example defines two tasks and sets default task.

The task "greet" is defined by the decorator @ku.task("greet") and it will output a greeting when executed. This task depends on the file "help.txt" and kumade will execute the file creation task if it does not exist.

The file creation task for "help.txt" is defined by the decorator @ku.file(help_file) and it will create the file by capturing the standard output of command execution.

You can see more examples of task definition in the file Kumadefile.py in the kumade repository.

Run

To run tasks from shell, use kumade command:

kumade

kumade command loads task definitions from Kumadefile.py and runs the specified tasks (or the default task if no task is specified).

Run kumade --help to see available options.

For development

Install

You can install this package from GitHub directly:

pip install git+ssh://git@github.com/yamaimo/kumade.git

Or, to develop, install from a cloned repository as follows:

# clone repository
git clone git@github.com:yamaimo/kumade.git
cd kumade

# create venv and activate it
python3.11 -m venv venv
source venv/bin/activate

# install this package as editable with dependencies
pip install -e .[develop]

Format and Lint

To format, execute kumade format.

To lint, execute kumade lint.

Unit test

To run unit test, execute kumade test.

If you want verbose output, execute kumade test_verbose=true test.

If you want to run each test file, execute kumade test_each=true path/to/test_file.py

Coverage

To measure coverage and report it, execute kumade coverage.

Project details


Download files

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

Source Distribution

kumade-0.3.0.tar.gz (21.4 kB view details)

Uploaded Source

Built Distribution

kumade-0.3.0-py3-none-any.whl (19.1 kB view details)

Uploaded Python 3

File details

Details for the file kumade-0.3.0.tar.gz.

File metadata

  • Download URL: kumade-0.3.0.tar.gz
  • Upload date:
  • Size: 21.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for kumade-0.3.0.tar.gz
Algorithm Hash digest
SHA256 a60f474634b03d26015fac82c3b0b3a292b4f4cb552274134da70e08537d5545
MD5 0d33cada550c848b5ec33aa6c191aa9f
BLAKE2b-256 f258f0b699a6613ea429bf4cb7cc183ee4fd6fe1cc858ca089e44b8612c171a6

See more details on using hashes here.

File details

Details for the file kumade-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: kumade-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 19.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for kumade-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cde6604afc93bccaf7ca7ccb386912bf583f681fae4e12bce984c300d93038cc
MD5 9eccd3687481e82965108da894ff5517
BLAKE2b-256 70297ecbbf77837b4c30120c5124123dca056f5880b82a4c4b710f7238c69b12

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page