Home¶
Overview¶
invoke-tasklib is a reusable library of Invoke tasks shared across
Python projects. Instead of copy-pasting the same tasks.py boilerplate (formatting, linting,
type-checking, testing, environment setup, releasing, and documentation) into every repository, a
project imports one namespace and gets a consistent set of invoke commands.
Quick Links:
Why invoke-tasklib?¶
Most Python projects end up with a tasks.py that wraps the same handful of tools: ruff,
pyright, pytest, docformatter, uv, mike. Keeping those wrappers in sync across many
repositories is tedious, and small inconsistencies (a missing --xdoctest flag, a different
coverage flag) creep in over time.
invoke-tasklib centralizes these tasks in one importable package:
from invoke_tasklib import ns
invoke --list
A single invoke.yaml at the project root configures the package name and, optionally, the paths
used by the tasks:
tasklib:
package:
name: my_package
See the user guide for the full config schema.
Features¶
invoke-tasklib provides a comprehensive set of tasks organized into namespaces:
๐จ Format and Lint¶
format.check-python/format.fix-python: check or format code with ruffformat.check-docstrings/format.fix-docstrings: check or format docstrings with docformatterformat.check-shell/format.fix-shell: check shell scripts with shellcheck, or format them with shfmtlint.check-lint: check linting with ruff
๐ Cyclic Imports¶
imports.check-cycles: check for cyclic import dependencies
๐ฌ Type Checking¶
types.check: check type hints with pyright
๐งช Testing¶
test.doctest,test.doctest-src,test.doctest-markdown,test.unit,test.integration,test.functional,test.all,test.benchmark
๐ Environment Management¶
env.create-venv,env.install,env.update,env.show-installed-packages,env.show-python-config
๐ฆ Release¶
release.build,release.pypi
๐ Documentation¶
doc.publish-dev,doc.publish-latest
Contributing¶
Contributions are welcome! Please open an issue first to discuss significant changes. See the developer guide for how to set up a development environment and the project's conventions.
API Stability¶
Important: As
invoke-tasklib is under active development, its API is not yet
stable and may change between releases. We recommend pinning a specific version in your project's
dependencies to ensure consistent behavior.
License¶
invoke-tasklib is licensed under the BSD 3-Clause "New" or "Revised" license available in
LICENSE.