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)

Possible solutions to Wordscapes, a mobile game for the android operating system, downloadable from the play store

Possible solutions to Wordscapes, a mobile game for the android operating system, downloadable from the play store

Clifford Onyonka 2 Feb 23, 2022
Generate Openbox Menus from a easy to write configuration file.

openbox-menu-generator Generate Openbox Menus from a easy to write configuration file. Example Configuration: ('#' indicate comments but not implement

3 Jul 14, 2022
Nextstrain build targeted to Omicron

About This repository analyzes viral genomes using Nextstrain to understand how SARS-CoV-2, the virus that is responsible for the COVID-19 pandemic, e

Bedford Lab 9 May 25, 2022
Import modules and files straight from URLs.

Import Python code from modules straight from the internet.

Nate 2 Jan 15, 2022
libvcs - abstraction layer for vcs, powers vcspull.

libvcs - abstraction layer for vcs, powers vcspull. Setup $ pip install libvcs Open up python: $ python # or for nice autocomplete and syntax highlig

python utilities for version control 46 Dec 14, 2022
Density is a open-sourced multi-purpose tool for ROBLOX with some cool

Density is a open-sourced multi-purpose tool for ROBLOX with some cool

ssl 5 Jul 16, 2022
A python script to get your activity

activities A python script to get your activity Not complete Requirements Python (=3.7) Pip (for python = 3.7) Git Pip packages psutil asyncio aioht

StarNumber 3 Nov 07, 2021
Convert .1pux to .csv

1PasswordConverter Convert .1pux to .csv 1Password uses this new export format .1pux, I assume stands for 1 Password User eXport. As of right now, 1Pa

Shayne Hartford 7 Dec 16, 2022
A framework that let's you compose websites in Python with ease!

Perry Perry = A framework that let's you compose websites in Python with ease! Perry works similar to Qt and Flutter, allowing you to create componen

Linkus 13 Oct 09, 2022
HiQ - A Modern Observability System

🦉 A Modern Observability System HiQ is a declarative, non-intrusive, dynamic and transparent tracking system for both monolithic application and dist

Oracle Sample Code 40 Aug 21, 2022
An advanced NFT Generator

NFT Generator An advanced NFT Generator Free software: GNU General Public License v3 Documentation: https://nft-generator.readthedocs.io. Features TOD

NFT Generator 5 Apr 21, 2022
The worst and slowest programming language you have ever seen

VenumLang this is a complete joke EXAMPLE: fizzbuzz in venumlang x = 0

Venum 7 Mar 12, 2022
My custom Fedora ostree build with sway/wayland.

Ramblurr's Sway Desktop This is an rpm-ostree based minimal Fedora developer desktop with the sway window manager and podman/toolbox for doing develop

Casey Link 1 Nov 28, 2021
python's memory-saving dictionary data structure

ConstDict python代替的Dict数据结构 若字典不会增加字段,只读/原字段修改 使用ConstDict可节省内存 Dict()内存主要消耗的地方: 1、Dict扩容机制,预留内存空间 2、Dict也是一个对象,内部会动态维护__dict__,增加slot类属性可以节省内容 节省内存大小

Grenter 1 Nov 03, 2021
This is sample project needed for security course to connect web service to database

secufaku This is sample project needed for security course to "connect web service to database". Why it suits alignment purpose It connects to postgre

Mark Nicholson 6 May 15, 2022
Step by step development of a vending coffee machine project, including tkinter, sqlite3, simulation, etc.

Step by step development of a vending coffee machine project, including tkinter, sqlite3, simulation, etc.

Nikolaos Avouris 2 Dec 05, 2021
tool to automate exploitation of android degubg bridge vulnerability

DISCLAIMER DISCLAIMER: ANY MALICIOUS USE OF THE CONTENTS FROM THIS ARTICLE WILL NOT HOLD THE AUTHOR RESPONSIBLE HE CONTENTS ARE SOLELY FOR EDUCATIONAL

6 Feb 12, 2022
Coronavirus Tracker API

Coronavirus Tracker API Provides up-to-date data about Coronavirus outbreak. Includes numbers about confirmed cases, deaths and recovered. Support mul

Francisco Laguna 1 Oct 31, 2020
🥦 Send and receive nano with 2 simple functions

easy_nano Send and receive nano (without having to understand the nano protocol).

1 Feb 14, 2022
laTEX is awesome but we are lazy -> groff with markdown syntax and inline code execution

pyGroff A wrapper for groff using python to have a nicer syntax for groff documents DOCUMENTATION Very similar to markdown. So if you know what that i

Subhaditya Mukherjee 27 Jul 23, 2022