Skip to content

Home

CI Codecov
Documentation
Ruff
PYPI version Python BSD-3-Clause

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 ruff
  • format.check-docstrings / format.fix-docstrings: check or format docstrings with docformatter
  • format.check-shell / format.fix-shell: check shell scripts with shellcheck, or format them with shfmt
  • lint.check-lint: check linting with ruff

Learn more โ†’

๐Ÿ” Cyclic Imports

  • imports.check-cycles: check for cyclic import dependencies

Learn more โ†’

๐Ÿ”ฌ Type Checking

  • types.check: check type hints with pyright

Learn more โ†’

๐Ÿงช Testing

  • test.doctest, test.doctest-src, test.doctest-markdown, test.unit, test.integration, test.functional, test.all, test.benchmark

Learn more โ†’

๐Ÿ Environment Management

  • env.create-venv, env.install, env.update, env.show-installed-packages, env.show-python-config

Learn more โ†’

๐Ÿ“ฆ Release

  • release.build, release.pypi

Learn more โ†’

๐Ÿ“š Documentation

  • doc.publish-dev, doc.publish-latest

Learn more โ†’

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.