Skip to main content

A plugin for poetry that allows you to execute scripts defined in your pyproject.toml, just like you can in npm or pipenv.

Project description

poetry-exec-plugin

A plugin for poetry that allows you to execute scripts defined in your pyproject.toml, just like you can in npm or pipenv

Installation

Installation requires poetry 2.0.0+. To install this plugin run:

poetry self add poetry-exec-plugin

For other methods of installing plugins see the poetry documentation.

Usage

To use this plugin, first define the scripts that you wish to be able to execute in your pyproject.toml file under a section called tool.poetry-exec-plugin.commands. For example:

[tool.poetry-exec-plugin.commands]
hello-world = "TEXT=hello-world; echo $TEXT"
lint = "flake8"

This will define a script that you can then execute with the poetry exec <script> command. This will execute your script inside of the environment that poetry creates for you, allowing you to access the dependencies installed for your project. The script will also always run from the same directory as your pyproject.toml file. This mimics the behaviour of npm/yarn. For example:

$ poetry exec hello-world
hello-world

$ poetry exec lint
./my_file.py:29:25: E222 multiple spaces after operator

Anything that you append to your exec command will be appended to the script. You can use this to pass extra flags and arguments to the commands in your scripts. For example:

$ poetry exec hello-world one two three
hello-world one two three

$ poetry exec lint --version
3.9.2 (mccabe: 0.6.1, pycodestyle: 2.7.0, pyflakes: 2.3.1) CPython 3.9.0 on Darwin

Publishing

To publish a new version,first bump the package version in pyproject.toml and commit your changes to the main branch (via pull request). Then in GitHub create a new release with the new version as the tag and name. You can use the handy auto release notes feature to populate the release description.

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

poetry_exec_plugin-1.0.1.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

poetry_exec_plugin-1.0.1-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file poetry_exec_plugin-1.0.1.tar.gz.

File metadata

  • Download URL: poetry_exec_plugin-1.0.1.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.13.2 Linux/6.8.0-1021-azure

File hashes

Hashes for poetry_exec_plugin-1.0.1.tar.gz
Algorithm Hash digest
SHA256 7813b965b0a621de63bbb323c038c4388a139363113d13b9ec1f694bb29ecf13
MD5 f5d784eb998ad8f9fa633b8775a5e0b7
BLAKE2b-256 8df902cd54522952e9c12dfb078c4a2d1582adee0a69578a7d5a6d9272aec0e3

See more details on using hashes here.

File details

Details for the file poetry_exec_plugin-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: poetry_exec_plugin-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.13.2 Linux/6.8.0-1021-azure

File hashes

Hashes for poetry_exec_plugin-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4b087b2fd111efce435f03e050e2caeb57ec76ac112de89438532c44ea85ec7c
MD5 789a91ce8bccb030f0fcc899729995fa
BLAKE2b-256 404e13e6e48b7358a1a4a479f93c7f20774c1ab5de24065c1bff1d77e53c382b

See more details on using hashes here.

Supported by

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