Skip to main content

A task runner that works well with poetry.

Project description

A task runner that works well with poetry.

Features

  • Straight foward declaration of project tasks in your pyproject.toml (kind of like npm scripts)

  • Task are run in poetry’s virtualenv by default

  • Short and sweet commands with extra arguments passed to the task poe [options] task [task_args]

  • tasks can reference environmental variables as if they were evaluated by a shell

Installation

Into your project (so it works inside poetry shell):

poetry add --dev poethepoet

And into your default python environment (so it works outside of poetry shell)

pip install poethepoet

Basic Usage

Define tasks in your pyproject.toml

See a real example

[tool.poe.tasks]
test = "pytest --cov=poethepoet"

Run tasks with the poe cli

poe test

Additional argument are passed to the task so

poe test -v tests/favorite_test.py

results in the following be run inside poetry’s virtualenv

pytest --cov=poethepoet -v tests/favorite_test.py

You can also run it like so if you fancy

python -m poethepoet [options] task [task_args]

Or install it as a dev dependency with poetry and run it like

poetry add --dev poethepoet
poetry run poe [options] task [task_args]

Though it that case you might like to do alias poe='poetry run poe'.

Advanced usage

Run poe from anywhere

By default poe will detect when you’re inside a project with a pyproject.toml in the root. However if you want to run it from elsewhere that is supported too by using the –root option to specify an alternate location for the toml file.

By default poe will set the working directory to run tasks. If you want tasks to inherit the working directory from the environment that you disable this by setting the following in your pyproject.toml.

[tool.poe]
run_in_project_root = false

In all cases the path to project root (where the pyproject.toml resides) is be available as $POE_ROOT within the command line and process.

Contributing

Don’t delay, create an issue today!

TODO

  • support “script” tasks defined as references to python functions

  • task composition/aliases

  • support declaring specific arguments for a task

  • support documenting tasks

  • support running tasks outside of poetry’s virtualenv (or in another?)

  • maybe try work well without poetry too

Licence

MIT. Go nuts.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

poethepoet-0.2.0.tar.gz (11.0 kB view hashes)

Uploaded Source

Built Distribution

poethepoet-0.2.0-py3-none-any.whl (11.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page