Poethepoet: Python task execution tool
Poe the Poet is a plugin on top of Poetry that is used to manage and execute all the CLI commands required to interact with the project. It helps you define and run tasks within your Python project, simplifying automation and script execution. Other popular options are Makefile, Invoke, or shell scripts, but Poe the Poet eliminates the need to write separate shell scripts or Makefiles for managing project tasks, making it an elegant way to manage tasks using the same configuration file that Poetry already uses for dependencies.
When working with Poe the Poet, instead of having all your commands documented in a README file or other document, you can add them directly to your pyproject.toml file and execute them in the command line with an alias. For example, using Poe the Poet, we can define the following tasks in a pyproject.toml file:
[tool.poe.tasks]
test = "pytest"
format = "black ."
start = "python main.py"
You can then run these tasks using the poe command:
poetry poe test
poetry poe format
poetry poe start
You can install Poe the Poet as a Poetry plugin, as follows:
poetry self add 'poethepoet[poetry_plugin]'
Using a tool as a façade over all your CLI commands is necessary to run your application. It significantly simplifies the application’s complexity and enhances collaboration as it acts as out-of-the-box documentation.
Back to code!