paolorechia / pyleiter

Yet another way to manage project commands

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pyleiter

Simple task manager for a Python project.

Installation

Use your favorite virtualenv and python package manager. For instance, using pip:

pip install pyleiter

Configuration and usage

Make sure your project has a 'pyproject.toml' file and add a section like the one below:

[tool.pyleiter.commands]
format = { command = "ruff format src", help = "Applies ruff format to project"}
lint = { command = "ruff check src", help = "Runs project formatter and linter" }

Where each line corresponds to a command you want to register for your program.

After that, you can use pyleiter with the registered commands:

pyleiter format

Autocompletion Bash

Add this to your favorite shell (only tested in bash) configuration file. For instance, in ~/.bashrc:

_pyleiter_completions()
{
  OPTIONS=$(pyleiter 2>&1 >/dev/null | grep -Po '{.*}' | tr -d '[{}]' | tr ',' ' ')
  SUGGESTIONS=$(compgen -W "$OPTIONS" "${COMP_WORDS[1]}")
  if [[ "$SUGGESTIONS" != "${COMP_WORDS[1]}" ]]; then
      COMPREPLY=($(compgen -W "$OPTIONS" "${COMP_WORDS[1]}"))
  fi
}

complete -F _pyleiter_completions pyleiter

Why use it?

Simply because every project requires simple maintenance scripts, and it is often done without a standardized way for Python projects. By using a tool that leverages pyproject.toml, we can keep the configuration centralized.

Similar (and better) projects

About

Yet another way to manage project commands

License:MIT License


Languages

Language:Python 98.9%Language:Shell 1.1%