pyinvoke
What it is and what it does
pyinvoke is a lightweight module launcher that runs a Python function specified by a full module path (e.g., `module.main:main`), ensuring the target loads as its proper module rather than as `__main__`. This solves a specific problem: when you run a module directly with `python -m module.main`, relative imports within that module fail because Python doesn't recognize the parent package context. pyinvoke becomes `__main__` instead, allowing the target to load correctly and perform relative imports.
The package has no runtime dependencies and is simple to use: invoke it with `python -m pyinvoke <module>:<function>`. However, it has been abandoned since September 2018 with no updates or maintenance activity since then, and there is no indication of ongoing support or compatibility testing with modern Python versions.
Use it for:
- Running a module that uses relative imports when direct invocation with `python -m` fails due to parent module loading issues.
- Launching Python applications from scripts or automation tools that need to preserve module context and relative import behavior.
- Workaround for packages that cannot be restructured to avoid relative import problems in their entry points.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Invokes Python functions by full module path specifier, loading the target as a proper module rather than as __main__, which enables relative imports to work correctly.
No. The package is abandoned (last release 2018-09-20, no maintenance since) with high install friction and no clear evidence of ongoing compatibility with modern Python. Before adopting it, verify whether the original relative-import problem it solves is still relevant to your use case, and explore whether standard Python tooling or modern alternatives now handle this scenario better.
Install
pyinvoke on PyPI
pip
pip install pyinvokeuv
uv add pyinvokepoetry
poetry add pyinvokeInstalling pyinvoke
Before you install
High install friction and abandoned maintenance status (last release 2018-09-20, no activity since). No runtime dependencies, but the package has received no updates in years and shows no active development.
License in practice
MIT license permits free use, modification, and distribution with minimal restrictions, making it legally safe to adopt from a licensing perspective.
Quickstart
pip install pyinvoke
python -m pyinvoke module.main:main
Requires Python to be invoked with -m pyinvoke; the target module must be importable and the function must exist at the specified path.
Verify before relying
- Whether the package works reliably with modern Python versions (last tested/released in 2018).
- Whether relative import handling remains compatible with current Python semantics.
- Active alternatives or whether this problem is now solved by standard Python tooling.
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | high — source build required |
| Runtime dependencies | none |
| Maintenance | abandoned — 2,885 days since the last release |
| First released | |
| Downloads | 208,218/month — #9,533 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pyinvoke-1.0.4.tar.gz
Tags
More Build Tools packages
Provides reusable utilities for Python…
permissive · top 100 on PyPI
tqdmWraps any iterable to display a real-time…
copyleft · top 100 on PyPI
pippip is the standard installer for Python…
permissive · top 100 on PyPI
hatchlingHatchling is a standards-compliant Python build…
permissive · top 100 on PyPI
grpcio-toolsGenerates Python gRPC service stubs and message…
permissive · top 1,000 on PyPI
pre-commitpre-commit is a framework for installing and…
permissive · top 1,000 on PyPI
emportEmport provides a single function to import…
permissive · top 15,000 on PyPI
locateProvides utilities to locate the current Python…
unclear · top 5,000 on PyPI
tracebackturbo3A drop-in replacement for Python's traceback…
permissive · top 15,000 on PyPI
rootpathDetects a Python project or package root…
permissive · top 15,000 on PyPI
pyproject-hooksCalls build-backend hooks defined in…
permissive · top 1,000 on PyPI
ipynbImports Jupyter Notebook (.ipynb) files as…
permissive · top 15,000 on PyPI
pystrayPystray creates a system tray icon with an…
copyleft · top 5,000 on PyPI
import-depsAnalyzes Python module imports statically using…
permissive · top 5,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI