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.

Parse 'pipx run' input and infer the app name like 'pipx install'

See original GitHub issue

How would this feature be useful?

This would make pipx run immensely more user friendly and easier to type without resorting to a readme or scanning the --help for the correct run syntax.

Background

Given an app called tap-mysql currently, pipx run tap-mysql --help works great! It knows that the plugin’s name is tap-mysql and it attempts to run a command with that same name (tap-mysql --help in this example),

Given an a more complex pip_url (like tap-mysql==1.4 or git+https://github.com/singer-io/tap-mysql.git), could pipx doesn’t use the detected package name to attempt the same. Instead, the package is installed and then the command will immediately fail.

$ pipx run tap-mysql --help
usage: tap-mysql [-h] -c CONFIG...
... # works perfectly
$ pipx run tap-mysql==1.17.5 --help
'tap-mysql==1.17.5' executable script not found in package 'tap-mysql==1.17.5'. Available executable scripts: tap-mysql

So in theory, we could put those two things together and let this work out of box?: pipx run <any_pip_url> --help

Describe the solution you’d like

The requested feature improvement would be to use the detected package name as the app name if --spec is not detected and if the argument passed to pipx run was a complex pip_url, such as a git ref or a version-pinned ref.

Already pipx does have the logic to detect package name, and pipx run already accepts simple package names without having to separately pass the app name.

pipx run tap-mysql --help                                              # already works today
pipx run tap-mysql==1.17.5 --help                                      # would be new
pipx run git+https://github.com/singer-io/tap-mysql@main.git --help    # would be new

Describe alternatives you’ve considered

The workaround is to explicitly send the executable name and pip URL separately using pipx run --spec <pip_url> <app_name>. However, this is not very portable and since most pipx commands do not require remembering the --spec.

Instead of running like this:

pipx run git+https://github.com/singer-io/tap-mysql.git --help

or

pipx run tap-mysql==1.0.5 --help

We would need to add tap-mysql at the end also.

pipx run --spec=git+https://github.com/singer-io/tap-mysql.git tap-mysql --help

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
aaronsteerscommented, Oct 18, 2022

Based on the comments from @meowmeowmeowcat and others, I’ve confirmed that this issue seems specific to git refs.

aj@ajs-macbook-pro ~ % pipx --version
1.1.0
aj@ajs-macbook-pro ~ % pipx run git+https://github.com/ansible/ansible-lint.git --version
pipx will only execute apps from the internet directly if they end with '.py'. To run from an SVN, try pipx
--spec URL BINARY
aj@ajs-macbook-pro ~ %

Version-pinned refs seem to resolve the app name without issue.

0reactions
meowmeowmeowcatcommented, Oct 19, 2022

We should allow users to run the app without --spec if the app name provided is an SVN URL, so a command like pipx run git+https://github.com/ansible/ansible-lint.git --version can be run successfully. After auto name inferring, it should get ansible-lint and use this name to run the app.

Read more comments on GitHub >

github_iconTop Results From Across the Web

pipx — Install and Run Python Applications in Isolated ...
pipx is a tool to help you install and run end-user applications written in Python. It's roughly similar to macOS's brew , JavaScript's...
Read more >
Installation - HTTPie 3.2.1 (latest) docs
It is a work-in-progress of a future stable release so the experience might be not as smooth. You can install it on Linux,...
Read more >
Changelog - pip documentation v22.3.1
X , pipX. ... Add an option to run the test suite with pip built as a zipapp. ... pip config now normalizes...
Read more >
homebrew-core - Homebrew Formulae
a2ps 4.14 Any‑to‑PostScript filter aacgain 1.8 AAC‑supporting version of mp3gain aalib 1.4rc5 Portable ASCII art graphics library aamath 0.3 Renders mathematical expressions as ASCII art
Read more >
scikit-build Documentation - Read the Docs
Adding cmake as building requirement only if not installed or too low a ... -w /src quay.io/pypa/manylinux_2_24_x86_64:latest pipx run nox.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

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