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:
- The method has no implementation
...
- We are chaining a series of
@task
s in thepre=[...]
argument - The
default=True
on this root tasks means we could run eitherinvoke dev
or simplyinvoke
.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file invoke-common-tasks-0.1.0.tar.gz
.
File metadata
- Download URL: invoke-common-tasks-0.1.0.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9febbfad485d2972d03945fc164b5bd2498010036d59a5f7a61857cf0567a59d |
|
MD5 | bd8d7977ff570484affc3621ad7c6d1e |
|
BLAKE2b-256 | f93f7752126261b0efab8a55d97db863da97fccf0765b0a0170642a4754b7659 |
File details
Details for the file invoke_common_tasks-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: invoke_common_tasks-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.10.2 Linux/5.11.0-1028-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c7093979bbd098b37e41548124be5b9edc9eb65ab1b03db3a2e439ce18645ac |
|
MD5 | e4409ae75c939517e669676eb0d23826 |
|
BLAKE2b-256 | b5391f6e89f3173fb8039631ddf8539c9e25a94019d1d616711bc2612fca9867 |