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 1.2.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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file poetry-exec-plugin-0.3.6.tar.gz
.
File metadata
- Download URL: poetry-exec-plugin-0.3.6.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.0rc2 CPython/3.11.3 Linux/5.15.0-1038-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7a379e575095e78db946dd578941b0dd73f8f112dad5ddd62aaf41bfe6439bf |
|
MD5 | fb1cdb55914a868153eee0e125658e77 |
|
BLAKE2b-256 | 9a27cb8c6223e6f33d4465a340acbcd7b3d96b3e94547c1f5d9f5eda36351055 |
File details
Details for the file poetry_exec_plugin-0.3.6-py3-none-any.whl
.
File metadata
- Download URL: poetry_exec_plugin-0.3.6-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.0rc2 CPython/3.11.3 Linux/5.15.0-1038-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a0d427faddcf71aa2f97eff1f42bb9736c69b84bf23105076849898a582fb0a5 |
|
MD5 | 2a5b32f3a1d359dfe45d12f5880ebcef |
|
BLAKE2b-256 | 4792af7e5033088c618ba2d694d0a626ff1dd44092d25b04f5d27df39b123224 |