Skip to main content

Some common tasks for PyInvoke to bootstrap your code quality and testing workflows.

Project description

Invoke Common Tasks

Some common tasks for PyInvoke to bootstrap your code quality and testing workflows.

Getting Started

pip install invoke-common-tasks

Invoke Setup

tasks.py

from invoke_common_tasks import *

Once your tasks.py is setup like this invoke will have the extra commands:

λ invoke --list
Available tasks:

  build    Build wheel.
  ci       Run linting and test suite for Continuous Integration.
  format   Autoformat code for code style.
  lint     Linting and style checking.
  test     Run test suite.

The Tasks

build

Assuming you are using poetry this will build a wheel.

format

This will apply code formatting tools black and isort.

These are only triggers for these commands, the specifics of configuration are up to you.

lint

This will run checks for black, isort and flake8.

Up to you to specify your preferences of plugins for flake8 and its configuration.

test

This will simply run python3 -m pytest. This is important to run as a module instead of pytest since it resolves a lot of import issues.

You can simply not import this task if you prefer something else. But all config and plugins are left flexible for your own desires, this simply triggers the entrypoint.

ci

This is a task with no commands but chains together lint and test.

TODO

  • typechecking
  • test coverage

Also auto-initialisations of some default config.

All Together

Once all the tasks are imported, you can create a custom task as your default task with runs a few tasks chained together.

from invoke import task
from invoke_common_tasks import *

@task(pre=[format, lint, test], default=True)
def all(c):
  """Default development loop."""
  ...

You will notice a few things here:

  1. The method has no implementation ...
  2. We are chaining a series of @tasks in the pre=[...] argument
  3. The default=True on this root tasks means we could run either invoke all or simply invoke.

How cool is that?

Contributing

Open an issue and lets have a chat to triage needs or concerns before you sink too much effort on a PR.

Or if you're pretty confident your change is inline with the direction of this project then go ahead and open that PR.

Or feel free to fork this project and rename it to your own variant. It's cool, I don't mind.

Resources

Prior Art

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

invoke-common-tasks-0.1.1.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

invoke_common_tasks-0.1.1-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file invoke-common-tasks-0.1.1.tar.gz.

File metadata

  • Download URL: invoke-common-tasks-0.1.1.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.2 Linux/5.11.0-1028-azure

File hashes

Hashes for invoke-common-tasks-0.1.1.tar.gz
Algorithm Hash digest
SHA256 cd57d21362259291a0d112c1d95ac82f4c12a2fd6c64a6055c7bcb7ef117f6ad
MD5 bffb7ae4409bd4af27fe49f3501eef5e
BLAKE2b-256 a831cf39c412324b1eb0935dba1e4f9c34591a8b6051c9e00f8ea9c5bb6e320e

See more details on using hashes here.

File details

Details for the file invoke_common_tasks-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for invoke_common_tasks-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b4fee96c5746c11b76e209b866a8782cfb16c2151acaff34188631127c70d30a
MD5 7a6cd5de30148afbe58c68546099767b
BLAKE2b-256 183a6fedf05a2c59aa50a45d8f5ed351c413ce465f3d7964e6cb86590333ac51

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