question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`pipenv run` consumes flags anywhere in command line

See original GitHub issue
0 $ pipenv run foo
The command (/home/josh/.local/share/virtualenvs/[redacted]/bin/foo) was not found within the virtualenv!
0 $ pipenv run foo --bar
The command (/home/josh/.local/share/virtualenvs/[redacted]/bin/foo) was not found within the virtualenv!
0 $ pipenv run foo --help
Usage: pipenv run [OPTIONS] COMMAND [ARGS]...

  Spawns a command installed into the virtualenv.

Options:
  --three / --two  Use Python 3/2 when creating virtualenv.
  --python TEXT    Specify which version of Python virtualenv should use.
  --help           Show this message and exit.

Instead, help text should only be printed if invoked with --help as first argument to run (i.e. pipenv run --help) – even if a flag after the first argument to run is recognised as a pipenv flag, it should be passed to the program being run. IOW, pipenv run my_program --my-flag should always run my_program --my-flag, even if pipenv someday learns to recognise --my-flag.

Similarly with other options, not just --help:

$ pipenv run foo --python
Error: --python option requires an argument

(message is from pipenv, since foo binary doesn’t exist)

Finally, pipenv run foo --three (or --two) removes the virtualenv automatically and creates a new one!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
nonylenecommented, Aug 10, 2017

You can use -- to signify the end of the options and pass arguments to the spawned command.

$ pipenv run -- foo --help
$ pipenv run -- foo --python
$ pipenv run -- my_program --my-flag

cf. http://click.pocoo.org/5/arguments/#option-like-arguments

1reaction
tammersalehcommented, Dec 8, 2017

@techalchemy oh, thanks! Sorry for the noise 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Advanced Usage of Pipenv - Read the Docs
To reuse Conda–installed Python packages, use the --site-packages flag: ... You can then run pipenv run <shortcut name> in your terminal to run...
Read more >
pipenv Documentation - Read the Docs
Pipenv uses a set of commands to manage your Project's dependencies and custom ... Command line flags (e.g. --python and --three) are prioritized...
Read more >
Advanced Usage of Pipenv — pipenv 11.7.2 documentation
To reuse Conda–installed Python packages, use the --site-packages flag: ... command to install dependencies install: "make" # command to run tests script: ...
Read more >
Pipenv: A Guide to the New Python Packaging Tool
lock (which enables deterministic builds). Pipenv uses pip and virtualenv under the hood but simplifies their usage with a single command line interface....
Read more >
pipenv Documentation - manpages.ubuntu!
Managing a requirements.txt file can be problematic, so Pipenv uses the ... because this command is intended to be run in a shell...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found