Pipenv: Multiple shell commands in pipenv script

Created on 8 May 2018  路  5Comments  路  Source: pypa/pipenv

Scripts should allow multiple shell commands to be run as one "script". Both Yarn and npm allow this. Currently, if you try to do this:

[scripts]
foo = "echo 'bar' && echo 'baz'"

it will result in bar && echo baz. You can sidestep this issue by doing something like

[scripts]
foo = "bash -c \"echo 'bar' && echo 'baz'\""

but

  1. that's a bit inconvenient
  2. it isn't a cross-platform solution (it won't work on Windows)

The use case that I have is running coverage report after running coverage, but it's definitely something that would have many general uses.


Expected result

Running pipenv run foo should result in:

baz
Actual result

Running pipenv run foo results in:

bar && echo baz
Steps to replicate

Create a Pipfile with the following:

[scripts]
foo = "bash -c \"echo 'bar' && echo 'baz'\""
Duplicate

Most helpful comment

Oh, I know - I didn't mean sound annoyed or brash in my response, it was just a note for future travellers.

All 5 comments

This has been discussed before. The bottom line is this is to difficult to get right, especially since Pipenv needs to support a cross-platform experience. Use a task runner for this, or shell scripts.

Sorry, should鈥檝e mentioned I鈥檓 not closing because we don鈥檛 want to accept this, but because this is a duplicate.

Finally found what this duplicates - https://github.com/pypa/pipenv/issues/2038

@stevenhair as a FYI the duplicate tag isn't really a criticism or a dismissal it's more for internal note and as a note to other maintainers that we have already hashed this out. Nothing personal, the request is legitimate -- it just carries a lot of complexity that we can't afford to support. Thanks for filing the issue and digging up the reference!

Oh, I know - I didn't mean sound annoyed or brash in my response, it was just a note for future travellers.

Was this page helpful?
0 / 5 - 0 ratings