Search code examples
pipenv

How do I run two commands with pipenv scripts using &&?


This is fairly easy to do with cargo and npm.

When I run it from the shell $ pylint src && pylint tests, I have no problems.

But when I run it as a pipenv script

[scripts]
lint = "pylint  src  && pylint tests"
$ pipenv run lint
************* Module &&
&&:1:0: F0001: No module named && (fatal)

Pylint thinks && is another module.
Is the pipenv runtime not just the terminal?


Solution

  • As pointed on this issue of their GitHub tracker, this is caused by the fact that:

    this is to difficult to get right, especially since Pipenv needs to support a cross-platform experience

    Source: https://github.com/pypa/pipenv/issues/2038#issuecomment-387506323

    There is a work around pointed in the issue report itself that could be a good fit for you:

    [scripts]
    lint = "bash -c 'pylint src && pylint tests'"
    

    pipenv relevant issues on their tracker: