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)

A python script based on OpenCV-Python, you can automatically hang up the Destiny 2 Throne to get the Dawning Essence.

A python script based on OpenCV-Python, you can automatically hang up the Destiny 2 Throne to get the Dawning Essence.

1 Dec 19, 2021
Catalogue CRUD Application

This Python program creates a relational SQL database hosted on the Snowflake platform, then opens a CRUD GUI to manipulate and view the data. In this application, it is used as a book catalogue. CUR

0 Dec 13, 2022
Never get kicked for inactivity ever again!

FFXIV AFK Bot Tired of getting kicked from games due to inactivity? This Bot will make random movements in random intervals to prevent you from gettin

5 Jan 12, 2022
Automatically remove user join messages when the user leaves the server.

CleanLeave Automatically remove user join messages when the user leaves the server. Installation You will need to install poetry to run this bot local

11 Sep 19, 2022
Impf Bot.py 🐍⚡ automation for the German

Impf Bot.py 🐍⚡ automation for the German "ImpfterminService - 116117"

251 Dec 13, 2022
A collection of existing KGQA datasets in the form of the huggingface datasets library, aiming to provide an easy-to-use access to them.

KGQA Datasets Brief Introduction This repository is a collection of existing KGQA datasets in the form of the huggingface datasets library, aiming to

Semantic Systems research group 21 Jan 06, 2023
Digdata presented 'BrandX' as a clothing brand that wants to know the best places to set up a 'pop up' store.

Digdata presented 'BrandX' as a clothing brand that wants to know the best places to set up a 'pop up' store. I used the dataset given to write a program that ranks these places.

Mahmoud 1 Dec 11, 2021
A ULauncher/Albert extension that supports currency, units and date time conversion, as well as a calculator that supports complex numbers and functions.

Ulauncher/Albert Calculate Anything Ulauncher/Albert Calculate Anything is an extension for Ulauncher and Albert to calculate things like currency, ti

tchar 67 Jan 01, 2023
GUI for the Gammu library.

Wammu GUI for the Gammu library. Homepage https://wammu.eu/ License GNU GPL version 3 or later. First start On first start you will be asked for set

Gammu 60 Dec 14, 2022
An html wrapper for python

MessySoup What is it? MessySoup is a python wrapper for html elements. While still a ways away, the main goal is to be able to build a wesbite straigh

4 Jan 05, 2022
Heads Down Application for Mac OSX

Heads Down A Mac app that lives in your ribbon—with a click of the mouse, temporarily block distracting websites and applications to encourage "heads

20 Mar 10, 2021
Small C-like language compiler for the Uxn assembly language

Pyuxncle is a single-pass compiler for a small subset of C (albeit without the std library). This compiler targets Uxntal, the assembly language of the Uxn virtual computer. The output Uxntal is not

CPunch 13 Jun 28, 2022
SimBiber - A tool for simplifying bibtex with official info

SimBiber: A tool for simplifying bibtex with official info. We often need to sim

336 Jan 02, 2023
Model synchronization from dbt to Metabase.

dbt-metabase Model synchronization from dbt to Metabase. If dbt is your source of truth for database schemas and you use Metabase as your analytics to

Mike Gouline 270 Jan 08, 2023
Repositorio com arquivos processados da CPI da COVID para facilitar analise

cpi4all Repositorio com arquivos processados da CPI da COVID para facilitar analise Organização No site do senado é possivel encontrar a lista de todo

Breno Rodrigues Guimarães 12 Aug 16, 2021
GDSC UIET KUK 📍 , welcomes you all to this amazing event where you will be introduced to the world of coding 💻 .

GDSC UIET KUK 📍 , welcomes you all to this amazing event where you will be introduced to the world of coding 💻 .

Google Developer Student Club UIET KUK 9 Mar 24, 2022
A simple solution for water overflow problem in Python

Water Overflow problem There is a stack of water glasses in a form of triangle as illustrated. Each glass has a 250ml capacity. When a liquid is poure

Kris 2 Oct 22, 2021
We want to check several batch of web URLs (1~100 K) and find the phishing website/URL among them.

We want to check several batch of web URLs (1~100 K) and find the phishing website/URL among them. This module is designed to do the URL/web attestation by using the API from NUS-Phishperida-Project.

3 Dec 28, 2022
Hitchhikers-guide - The Hitchhiker's Guide to Data Science for Social Good

Welcome to the Hitchhiker's Guide to Data Science for Social Good. What is the Data Science for Social Good Fellowship? The Data Science for Social Go

Data Science for Social Good 907 Jan 01, 2023
Mixtaper - Web app to make mixtapes

Mixtaper A web app which allows you to input songs in the form of youtube links

suryansh 1 Feb 14, 2022