Skip to main content

Klak provides the ergonoics of a project Makefile with the ease of Python and power of Click.

Project description

Klak

pypi standard-readme compliant travis-ci docs docs

Klak provides the ergonoics of a project Makefile with the ease of Python and power of Click.

Table of Contents

Background

Makefiles provide a simple interface, make <command>, that is great for automating repetitive project tasks. Makefile syntax, however, is archaic, error-prone, and ill-suited for constructing modern, useful command-line interfaces.

Python, on the other hand, has wonderful syntax and is great for scripting. When Python is paired with Click constructing modern, useful command-line interfaces is easy!

Is there a way we can combine the power of Python and Click into a "Makefile like" experience?

Enter Klak.

Klak exposes a single entry-point—klak—which auto-loads a 100%, vanilla Python file called a Clickfile. All CLI is built using standard Python and Click, and all commands are available via: klak <command> (see Usage).

What is it good for?

Klak's purpose is to provide a convenient, single-file experince for automating repetitive project tasks. It does not, nor will it ever, intend to replace Make or Makefiles.

Install

Stable Release

# NOTE: This is the recommended method of installation.
pip install klak

From Source

Klak uses Poetry to manage depdencies and distribution (in lieu of setuptools).

# NOTE: Clone the public repository
git clone git://github.com/aubricus/klak

# NOTE: or download the tarball
curl  -OL https://github.com/aubricus/klak/tarball/master

# NOTE: Once the source is downloaded
poetry install

Usage

To get started with Klak create a Clickfile. Here's an example Clickfile to get started:

"""
Example Clickfile.

NOTE: Set your editor's language mode to Python to
      enable syntax highlighting! :^)
"""

import logging
import click
from klak.cli import cli


log = logging.getLogger("Clickfile")


# -------------------------------------
# Examples
# -------------------------------------


# Example: Add a command.
@cli.command()
@click.argument("name")
def greet(name):
    """Greet someone."""
    click.secho(f"Hello, {name}")


# Example: Add a group and sub-command.
@cli.group()
def humans():
    """Humans command group."""
    pass


@humans.command(name="count")
def humans_count():
    """Count all the humans."""
    click.secho("Over 9000!!!")

Once your Clickfile is ready, access commands through klak.

$ klak --help

Support

This project is a hobby/passion project which I maintain in my own time.

Python

  • Python 3.5+

OS

  • Linux ✓
  • MacOS ✓
  • Windows ✘ (any volunteers?)

Maintainers

@aubricus

Contributing

See the contributing file!

PRs accepted!

Please note, if editing the README, please conform to the standard-readme specification.

License

MIT © 2018, 2019 aubricus@gmail.com

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

klak-0.4.2.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

klak-0.4.2-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file klak-0.4.2.tar.gz.

File metadata

  • Download URL: klak-0.4.2.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.16 CPython/3.7.3 Darwin/18.6.0

File hashes

Hashes for klak-0.4.2.tar.gz
Algorithm Hash digest
SHA256 da78373838a83c6766c5ee0c00fd9fc8275a9f9e64d0f5a077a1f25e629c258f
MD5 d62009cbcf139d5eb77225e66ff49b72
BLAKE2b-256 d25ce69bbf8495cae7c004a8631c323f5cf1e34870e4df4d46029e9e6246943d

See more details on using hashes here.

File details

Details for the file klak-0.4.2-py3-none-any.whl.

File metadata

  • Download URL: klak-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.16 CPython/3.7.3 Darwin/18.6.0

File hashes

Hashes for klak-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 61bd4c505334cb6ca3154ffa0ec930f9e61af407af041ad22bf34297ade3d24e
MD5 4f8ca56ebd83faa5fb6dbdcb5286f874
BLAKE2b-256 036a6639393cbaa9c0e6859f0f3ac37e96e3bd8feaa7dff553c7a69d6479a9f9

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