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

Overview

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:

pip install 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

Comments
  • Drop simple-chalk dependency

    Drop simple-chalk dependency

    cleo library has built-in support for terminal colors, and already defines semantic styles, s.a, info, comment, question and error.

    Using self.line and self.line_error style argument we can drop the dependency on simple-chalk library, as it is only being used to display error messages in red, and info messages in dim.

    Tested locally by pulling the plugin with poetry self add https://github.com/ajcerejeira/poetry-exec-plugin.git.

    Here is how an info message is rendered under Gnome terminal:

    image

    And this is how an error message looks like: image

    opened by ajcerejeira 2
  • Fix arguments propagation to commands

    Fix arguments propagation to commands

    Hi, thanks for this utility, looks promising! I've found a bug that stucks me sometimes, so I've decided to submit a patch.

    If you create a command like:

    [tool.poetry-exec-plugin.commands]
    printf = "printf"
    

    You can't pass it strings with spaces because the words after the space are not properly passed to the command:

    $ poetry exec printf -- 'Hello world\n'
    Exec: printf Hello world\n
    
    Hello<my-user>@<myenv>
    

    This turns many commands unusable. For example is not possible to execute a pytest test that have spaces in their id:

    [tool.poetry-exec-plugin.commands]
    test = "pytest"
    
    [tool.poetry-exec-plugin.commands]
    $ poetry exec test -- -svv 'tests/path/to/test.py::test_name[my id]'
    Exec: poetry exec test -- -svv 'tests/path/to/test.py::test_name[my id]'
    ===== test session starts =====
    platform linux -- Python 3.7.13, pytest-7.1.2, pluggy-1.0.0 -- /my/python
    cachedir: .pytest_cache
    rootdir: ..., configfile: pyproject.toml
    plugins: cov-3.0.0
    collected 0 items                                                                                                                          
    
    ===== no tests ran in 0.01s =====
    ERROR: file or directory not found: id]
    

    So this fixes it using shlex.join, with a backport for Python3.7 that should be removed when that version reaches their EOL.

    I've rewritten the test suite to remove mocks and because cleo.testers.command_tester.CommandTester does not allow to pass arguments to commands.

    opened by mondeja 1
  • Bump certifi from 2022.6.15 to 2022.12.7

    Bump certifi from 2022.6.15 to 2022.12.7

    Bumps certifi from 2022.6.15 to 2022.12.7.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Suggest correct command if other command is very similar

    Suggest correct command if other command is very similar

    For example if I execute poetry exec docs and a doc command exists, instead of showing this error (current):

    $ poetry exec docs
    
    Unable to find the command 'docs'. To configure a command you must add it to your pyproject.toml under the path [tool.poetry-exec-plug
    in.commands]. For example:
    
    [tool.poetry-exec-plugin.commands]
    docs = "echo Hello World"
    

    It would show something like:

    $ poetry exec docs
    
    Unable to find the command 'docs'. Perhaps you wanted to run the 'doc' command?
    
    npm output
    $ npm run docs
    npm ERR! Missing script: "docs"
    npm ERR! 
    npm ERR! Did you mean one of these?
    npm ERR!     npm run doc
    npm ERR!     npm run doc:show
    npm ERR! 
    npm ERR! To see a list of scripts, run:
    npm ERR!   npm run
    
    opened by mondeja 0
  • Question : Specifying the plugin installation from the `pyproject.toml` file

    Question : Specifying the plugin installation from the `pyproject.toml` file

    Really cool and promising plugin!

    Is it possible to specify the plugin installation from the project's pyproject.toml file?

    That way, we wouldn't have to specify the plugin as a requirement in our CI builders and dev-machine setup, and simply be allowed to do (whether or not the plugin is installed) :

    poetry install
    poetry run test
    

    Thanks!

    opened by franknarf8 1
Releases(0.3.5)
  • 0.3.5(Aug 26, 2022)

    What's Changed

    • Small tweaks to prepare for poetry 1.2.0's imminent release by @keattang in https://github.com/keattang/poetry-exec-plugin/pull/10

    Full Changelog: https://github.com/keattang/poetry-exec-plugin/compare/0.3.4...0.3.5

    Source code(tar.gz)
    Source code(zip)
  • 0.3.4(Jul 6, 2022)

    What's Changed

    • Updated dependencies by @keattang in https://github.com/keattang/poetry-exec-plugin/pull/6
    • Drop simple-chalk dependency by @ajcerejeira in https://github.com/keattang/poetry-exec-plugin/pull/5

    New Contributors

    • @keattang made their first contribution in https://github.com/keattang/poetry-exec-plugin/pull/6
    • @ajcerejeira made their first contribution in https://github.com/keattang/poetry-exec-plugin/pull/5

    Full Changelog: https://github.com/keattang/poetry-exec-plugin/compare/0.3.3...0.3.4

    Source code(tar.gz)
    Source code(zip)
  • 0.3.3(Jun 25, 2022)

    What's Changed

    • Fix arguments propagation to commands by @mondeja in https://github.com/keattang/poetry-exec-plugin/pull/4

    New Contributors

    • @mondeja made their first contribution in https://github.com/keattang/poetry-exec-plugin/pull/4

    Full Changelog: https://github.com/keattang/poetry-exec-plugin/compare/0.3.2...0.3.3

    Source code(tar.gz)
    Source code(zip)
  • 0.3.2(Oct 18, 2021)

    What's Changed

    • End description with dot by @pkulev in https://github.com/keattang/poetry-exec-plugin/pull/2
    • Fix typo 'project_foler_path' -> 'project_folder_path' by @pkulev in https://github.com/keattang/poetry-exec-plugin/pull/1

    New Contributors

    • @pkulev made their first contribution in https://github.com/keattang/poetry-exec-plugin/pull/2

    Full Changelog: https://github.com/keattang/poetry-exec-plugin/compare/0.3.1...0.3.2

    Source code(tar.gz)
    Source code(zip)
  • 0.3.0(Sep 12, 2021)

  • 0.2.1(Aug 21, 2021)

  • 0.1.0(Aug 21, 2021)

This is a Poetry plugin that will make it possible to build projects using custom TOML files

Poetry Multiproject Plugin This is a Poetry plugin that will make it possible to build projects using custom TOML files. This is especially useful whe

David Vujic 69 Dec 25, 2022
Run python scripts and pass data between multiple python and node processes using this npm module

Run python scripts and pass data between multiple python and node processes using this npm module. process-communication has a event based architecture for interacting with python data and errors inside nodejs.

Tyler Laceby 2 Aug 6, 2021
Poetry plugin to bundle projects into various formats

Poetry bundle plugin This package is a plugin that allows the bundling of Poetry projects into various formats. Installation The easiest way to instal

Poetry 54 Jan 2, 2023
Poetry workspace plugin for Python monorepos.

poetry-workspace-plugin Poetry workspace plugin for Python monorepos. Inspired by Yarn Workspaces. Adds a new subcommand group, poetry workspace, whic

Jack Smith 74 Jan 1, 2023
🛠️ Plugin to integrate Chuy with Poetry

Archived This is bundled with Chuy since v1.3.0. Poetry Chuy Plugin This plugin integrates Chuy with Poetry. Note: This only works in Poetry 1.2.0 or

Eliaz Bobadilla 4 Sep 24, 2021
A script where you execute a script that generates a base project for your gdextension

GDExtension Project Creator this is a script (currently only for linux) where you execute a script that generates a base project for your gdextension,

Unknown 11 Nov 17, 2022
Demo Python project using Conda and Poetry

Conda Poetry This is a demonstration of how Conda and Poetry can be used in a Python project for dev dependency management and production deployment.

Ryan Allen 2 Apr 26, 2022
poetry2nix turns Poetry projects into Nix derivations without the need to actually write Nix expressions

poetry2nix poetry2nix turns Poetry projects into Nix derivations without the need to actually write Nix expressions. It does so by parsing pyproject.t

Nix community projects 405 Dec 29, 2022
Bazel rules to install Python dependencies with Poetry

rules_python_poetry Bazel rules to install Python dependencies from a Poetry project. Works with native Python rules for Bazel. Getting started Add th

Martin Liu 7 Dec 15, 2021
Canim1 - Simple python tool to search for packages without m1 wheels in poetry lockfiles

canim1 Usage Clone the repo. Run poetry install. Then you can use the tool: ❯ po

Korijn van Golen 1 Jan 25, 2022
You can easily send campaigns, e-marketing have actually account using cash will thank you for using our tools, and you can support our Vodafone Cash +201090788026

*** Welcome User Sorry I Mean Hello Brother ✓ Devolper and Design : Mokhtar Abdelkreem ========================================== You Can Follow Us O

Mo Code 1 Nov 3, 2021
Just imagine normal bancho, but you can have multiple profiles and funorange speed up maps ranked

Local osu! server Just imagine normal bancho, but you can have multiple profiles and funorange speed up maps ranked (coming soon)! Windows Setup Insta

Cover 25 Nov 15, 2022
A discord group chat creator just made it because i saw people selling this stuff for like up to 40 bucks

gccreator some discord group chat tools just made it because i saw people selling this stuff for like up to 40 bucks (im currently working on a faster

baum1810 6 Oct 3, 2022
A simple program to recolour simple png icon-like pictures with just one colour + transparent or white background. Resulting images all have transparent background and a new colour.

A simple program to recolour simple png icon-like pictures with just one colour + transparent or white background. Resulting images all have transparent background and a new colour.

Anna Tůmová 0 Jan 30, 2022
Dev-meme - A repository that contains memes just for people like us

A repository that contains memes just for people like us. Coders are constantly

Padmashree Jha 4 Oct 31, 2022
Simple rofi script to choose player for playerctl to execute its command

rofi-playerctl-switcher simple rofi script to choose player for playerctl to execute its command Usage copy playerSwitch.py and playerctl.sh to ~/.con

null 2 Jan 3, 2022
NotesToCommands - a fully customizable notes / command template program, allowing users to instantly execute terminal commands

NotesToCommands is a fully customizable notes / command template program, allowing users to instantly execute terminal commands with dynamic arguments grouped into sections in their notes/files. It was originally created for pentesting uses, to avoid the needed remembrance and retyping of sets of commands for various attacks.

zxro 5 Jul 2, 2022
🤖️ Plugin for Sentry which allows sending notification via DingTalk robot.

Sentry DingTalk Sentry 集成钉钉机器人通知 Requirments sentry >= 21.5.1 特性 发送异常通知到钉钉 支持钉钉机器人webhook设置关键字 配置环境变量 DINGTALK_WEBHOOK: Optional(string) DINGTALK_CUST

null 1 Nov 4, 2021
python scripts - mostly automation scripts

python python scripts - mostly automation scripts You can set your environment in various ways bash #!/bin/bash python - locally on remote host #!/bi

Enyi 1 Jan 5, 2022