Skip to main content

Common invoke tasks wrapper/library

Project description


A wrapper for common invoke tasks to make repos extra pretty.

pipeline status PyPI version coverage report docs


All of the functionality as invoke with a smidge more flexibility (maybe just for me?) than something like invocations.

In general, this project (as well as invoke), give an OS-agnostic solution for automating common commands during development (cleaning build files, running unit tests, etc.). Similar to how a Makefile might be used, prettyrepo makes it so that with a small set of commands you can run any typical task. Furthermore, you can have configurable arguments for each of those tasks being run (see example).

This project introduces a TaskManager so every available task can be tweaked as desired and persistent for a project. Reference for this project's own tasks file.


from invoke import task

from prettyrepo import TaskManager
from prettyrepo.utils import run_unittest
from prettyrepo.utils import get_python_cleans

# Create a TaskManager that knows the root of your project
mgr = TaskManager(source_root='prettyrepo', tasks_module=__name__)

# Add tasks from the "task library" or a simple command (by specifying the cmd kwarg)
mgr.add_task('clean', cleans=get_python_cleans())
mgr.add_task('test', lib='unittest', dir_='tests')
mgr.add_task('cov', aliases=['cover'], lib='coverage', func=run_unittest, dir_='tests')
mgr.add_task('lint', aliases=['flake8'], cmd='flake8 prettyrepo', doc='Run flake8 lints.')

# You can use the normal invoke task decorator in conjunction with prettyrepo tasks.
@task(name='bleh', help={'times': 'number of times to say blah'})
def blah(_, times=1):
    """Say blah."""

ns = mgr.namespace

With this in your file in the root of your repository, you can run

inv <command> [-h] [<command options...>]

Where -h is available to show the help message. For example, running inv clean -h yields:

  Clean unnecessary files.

  -l INT, --level=INT       the level of "cleanliness" [0-2], default 1
  -v INT, --verbosity=INT   how verbose information to log to the console [0-3], default 1

Where -l and -v can be used to specify what the clean task does (the higher the level, the more files it removes - i.e. venv, dist files; the higher the verbosity, the more info it logs):

command line screenshot

Documentation available in the repository wiki.

Project details

Download files

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

Files for prettyrepo, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size prettyrepo-0.1.0-py3-none-any.whl (10.6 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size prettyrepo-0.1.0.tar.gz (9.4 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page