LinuxCommandLibrary

poetry-run

Execute commands in virtual environment

TLDR

Run command in virtual environment

$ poetry run [command]
copy
Run Python script
$ poetry run python [script.py]
copy
Run installed tool
$ poetry run pytest
copy
Run with arguments
$ poetry run python -m [module] [args]
copy

SYNOPSIS

poetry run command [args]

DESCRIPTION

poetry run executes a command within the project's virtual environment without requiring manual activation. It automatically locates and uses the correct virtual environment for the current project.
This is the recommended way to run project scripts, test suites, and installed tools. For example, `poetry run pytest` runs tests using the project's dependencies, and `poetry run python script.py` executes a script with the project's Python interpreter. An alternative is poetry shell for an interactive session.

PARAMETERS

COMMAND

Command to execute.
ARGS
Arguments to pass.

CAVEATS

Creates venv if not exists. Alternative to poetry shell.

HISTORY

poetry run provides virtual environment command execution.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community