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)

Black-Scholes library implemented as a Cairo smart contract

Cairo Black-Scholes Library Black-Scholes library implemented as a Cairo smart contract. All inputs, outputs, and internal calculations use 27-digit f

Aditya Raghavan 47 Dec 19, 2022
OpenTracing API for Python

OpenTracing API for Python This library is a Python platform API for OpenTracing. Required Reading In order to understand the Python platform API, one

OpenTracing API 767 Dec 16, 2022
Simple script to match riders with drivers.

theBestPooler Simple script to match riders with drivers. It's a greedy, unoptimised search, so no guarantees that it works. It just seems to work (ve

Devansh 1 Nov 22, 2021
Daily knowledge pills to get better in Python.

Python daily pills Daily knowledge pills to get better Python code. Why Does your Python code suffers of any of this symptoms? Incorrect Indentation I

Jeferson Vaz dos Santos 35 Sep 19, 2022
Zeus - Advanced Punishments with Embeds.

Zeus Advanced Punishments with Embeds. Make sure to put the Discord Bot Token in the " TOKEN = '' " Language Python Features Ban Kick Mute Unmute Warn

2 Jan 05, 2022
PyWorkflow(PyWF) - A Python Binding of C++ Workflow

PyWorkflow(PyWF) - A Python Binding of C++ Workflow 概览 C++ Workflow是一个高性能的异步引擎,本项目着力于实现一个Python版的Workflow,让Python用户也能享受Workflow带来的绝佳体验。

Sogou-inc 108 Dec 01, 2022
Explore related sequences in the OEIS

OEIS explorer This is a tool for exploring two different kinds of relationships between sequences in the OEIS: mentions (links) of other sequences on

Alex Hall 6 Mar 15, 2022
Create standalone, installable R Shiny apps using Electron

Create standalone, installable R Shiny apps using Electron

Chase Clark 5 Dec 24, 2021
Hy - A dialect of Lisp that's embedded in Python

Hy Lisp and Python should love each other. Let's make it happen. Hy is a Lisp dialect that's embedded in Python. Since Hy transforms its Lisp code int

Hy Society 4.4k Jan 02, 2023
Update your Nintendo Switch cheats with one click, or a bit more~

Interactive-ASM-Cheats-Updater This updater unlocks your ability of updating most of the ASM cheats for Nintendo Switch. Table of Contents Functions Q

zzpong 63 Dec 27, 2022
Collection of script & resources for Foundry's Nuke software.

Author: Liam Collod. Collections of scripting stuff I wrote for Foundry's Nuke software. Utilisation You can have a look at the README.md file in each

Liam Collod 1 May 14, 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
Master Duel Card Translator Project

Master Duel Card Translator Project A tool for translating card effects in Yu-Gi-Oh! Master Duel. Quick Start (for Chinese version only) Download the

67 Dec 23, 2022
Hacking and Learning consistently for 100 days straight af.

#100DaysOfHacking Hacking and Learning consistently for 100 days straight af. [yes, no breaks except mental-break ones, Obviously.] This Repo is one s

FENIL SHAH 17 Sep 09, 2022
使用京东cookie一键生成所有退会链接

JDMemberCloseLinks 本项目旨在使用京东cookie一键生成所有退会链接

hyzaw 68 Jun 10, 2022
Coderslab Workshop Projects

Workshop Coderslab workshop projects that include: Guessing Game Lotto simulator Guessing Game vol.2 Guessing Game vol.3 Dice 2001 Game Technologies P

Szymon Połczyński 1 Nov 06, 2021
0CD - BinaryNinja plugin to introduce some quality of life utilities for obsessive compulsive CTF enthusiasts

0CD Author: b0bb Quality of life utilities for obsessive compulsive CTF enthusia

12 Sep 14, 2022
1 May 12, 2022
A program to generate random numbers b/w 0 to 10 using time

random-num-using-time A program to generate random numbers b/w 0 to 10 using time it uses python's in-built module datetime and an equation which retu

Atul Kushwaha 1 Oct 01, 2022
Converts a base copy of Pokemon BDSP's masterdatas into a more readable and editable Pokemon Showdown Format.

Showdown-BDSP-Converter Converts a base copy of Pokemon BDSP's masterdatas into a more readable and editable Pokemon Showdown Format. Download the lat

Alden Mo 2 Jan 02, 2022