Skip to main content

@flowwright/plugin-python

The Python equivalent of plugin-node, across three package managers. It is deliberately smaller — read the differences below before assuming parity.

npm install --save-dev @flowwright/plugin-python

API

ExportKindSignature
pythonStagesstage builder(options?) => StageDefinition[]
pythonServicePipelinepipeline(options?: PythonPipelineOptions) => PipelineDefinition
OptionDefaultMeaning
packageManager"pip"pip, uv or poetry
cachetrueCache .venvignored for pip
installtruefalse skips it; a string replaces the command
lint, testtrueruff check . / pytest
format, typecheckfalseruff format --check . / mypy .
buildfalseOff by default, unlike node
artifactPath"dist"Only meaningful when build is on
publishfalse{ credential }, default "pypi-token"
name"python-service"pythonServicePipeline only

Example

pipeline.ts
import { pipeline, group } from "@flowwright/core";
import { pythonStages } from "@flowwright/plugin-python";

export default pipeline({
name: "acme-svc",
concurrency: 3,
stages: [
...group(
"ci",
pythonStages({
packageManager: "uv",
typecheck: true,
build: true,
artifactPath: "dist",
}),
),
],
});

What it composes down to

Defaults with pip — note there is no build stage:

install
$ pip install -r requirements.txt
lint ← install
$ ruff check .
test ← install
$ pytest

With uv, tools are prefixed and the install caches .venv under uv-deps-<hash of uv.lock>:

install
$ uv sync --frozen
lint ← install
$ uv run ruff check .
test ← install
$ uv run pytest
Package managerInstallLockfileTool prefix
pippip install -r requirements.txtrequirements.txtnone
uvuv sync --frozenuv.lockuv run
poetrypoetry installpoetry.lockpoetry run

Poetry stages also carry POETRY_VIRTUALENVS_IN_PROJECT=true, so the venv lands in the project and is cacheable.

Publish binds the token to the variable each tool expects:

Package managerCommandEnv
piptwine upload dist/*TWINE_PASSWORD (+ TWINE_USERNAME=__token__)
uvuv publishUV_PUBLISH_TOKEN
poetrypoetry publishPOETRY_PYPI_TOKEN_PYPI

Gotchas

build defaults to false — the opposite of plugin-node. A pipeline that looks like it should produce a wheel produces nothing until you pass build: true.

pip never caches. There's no in-project venv to cache, so cache is narrowed away for pip. Passing cache: true explicitly with pip throws, so the setting can't silently do nothing; leaving it at the default is fine.

No container support and no version matrix. There is no pythonVersion or pythonVersions — set container on the stages yourself if you need a pinned interpreter, or build them with a .map(). See Containers.

No audit stage, unlike node.

Some combinations throw: artifactPath without build, cache: true with install: false, and name passed to pythonStages(). See the overview.