Skip to main content

Poetry Run Actions Plugin

A Poetry plugin that runs declarative shell actions immediately before poetry run <name>, gated by the active environment.

Use it to attach side effects (e.g. docker compose up -d redis) to a package or script without baking them into the entry point itself, so the same pyproject.toml can be deployed in production without firing dev-only setup.

Install

Install via Poetry:

poetry self add poetry-run-actions

To uninstall:

poetry self remove poetry-run-actions

Configure

Actions attach to a package declared in [tool.poetry] packages or a script declared in [project.scripts] / [tool.poetry.scripts]. Configure them under separate subtables:

[tool.poetry]
packages = [{include = "api"}, {include = "worker"}]

[project.scripts]
migrate = "myapp.db:migrate"

# Package target: fires on `poetry run python -m api` because `api` is in [tool.poetry] packages
[tool.poetry-run-actions.dev.packages.api]
setup-commands = ["docker compose up -d redis"]
pre-start-commands = ["echo 'starting api'"]

# Script target: fires on `poetry run migrate` because `migrate` is in [project.scripts]
[tool.poetry-run-actions.dev.scripts.migrate]
pre-start-commands = "echo 'about to migrate'"

Each entry under packages.<name> or scripts.<name> can take one of three shapes:

# 1. Shorthand: a single shell command (treated as `pre-start-commands`)
[tool.poetry-run-actions.dev.packages]
worker = "docker compose up -d postgres"

# 2. Shorthand: a list of shell commands (treated as `pre-start-commands`)
[tool.poetry-run-actions.dev.packages]
cli = ["docker compose up -d redis", "docker compose up -d postgres"]

# 3. Full form: a table with `setup-commands` and/or `pre-start-commands`
[tool.poetry-run-actions.dev.packages.api]
setup-commands = ["docker compose up -d redis"]
pre-start-commands = ["echo 'starting api'"]

setup-commands vs. pre-start-commands

Both are optional and accept either a single string or a list of strings. On every matching poetry run python -m <name> (for packages) or poetry run <name> (for scripts) invocation, the plugin runs:

Setup commands should be idempotent and run before the pre-start commands. This can be used to install dependencies. Pre-start commands are for application dependencies, such as Redis.

Environment Selection

The active environment is read from POETRY_ENVIRONMENT, defaulting to dev.

Example:

POETRY_ENVIRONMENT Behavior
unset (default) Looks up tool.poetry-run-actions.dev.{packages,scripts}.<name>
dev Same as default
production Looks up tool.poetry-run-actions.production.{packages,scripts}.<name>
any other value Looks up tool.poetry-run-actions.<value>.{packages,scripts}.<name>

Run Tests

Install development dependencies:

poetry install -E dev

Run tests:

poetry run pytest .

Metadata

Release files for poetry-run-actions 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for poetry-run-actions 0.0.2
File Size Uploaded Provenance
poetry_run_actions-0.0.2.tar.gz 5.0 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for poetry-run-actions 0.0.2
File Interpreter ABI Platform
poetry_run_actions-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 11.6 kB

Release files / poetry_run_actions-0.0.2.tar.gz

Download URL poetry_run_actions-0.0.2.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a90cf3d58888c55f29a5e7a8824b6a9c5bd4d670928891193f46fa550ee65e56
BLAKE2b-256 checksum
How to use checksums
7f5de27dc1108daf8151df1439d36f09579d522c8fa1a78136741532d2a1bbc9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 4, 2026.

Transparency log

Release files / poetry_run_actions-0.0.2-py3-none-any.whl

Download URL poetry_run_actions-0.0.2-py3-none-any.whl
Size 6.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7bb08c14a54b5a1f3a7b7a438249e6f4904abf0c19f1a48e2b4606d3af42a1a9
BLAKE2b-256 checksum
How to use checksums
465f0cfb531466f2b1b7b97816a85cd10325209a847aa9f7323eddbdbd7800ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 4, 2026.

Transparency log

Security for poetry-run-actions 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for poetry_run_actions-0.0.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 4, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page