pipx icon indicating copy to clipboard operation
pipx copied to clipboard

Normalise entry point and package name to make 'pip run' more permissive

Open uranusjr opened this issue 4 years ago • 3 comments

Continuing the discussion in https://github.com/pipxproject/pipx/pull/615#issuecomment-770336369

I'm assuming the following will not work:

pipx run bUiLd --help

It will download and install build properly from PyPI (I believe) but it won't match the likely pipx.run endpoint name of "build".

console scripts in conjunction with pipx run would face the same issue.

How can we improve this? I guess it’s not too controversial that the names should be case-insensitive. How about dashes, underscores, and dots? Do we use the same normalisation logic as PEP 503?

This change would also make the check here more difficult:

https://github.com/pipxproject/pipx/blob/25a227b2092f672c88622209d99953a758502f18/src/pipx/commands/run.py#L59-L69

Since now we will need to walk through PATH and make sure none of the variants exist on it?

uranusjr avatar Feb 01 '21 02:02 uranusjr

Is this affected by https://setuptools.readthedocs.io/en/latest/history.html#v53-1-0 ?

henryiii avatar Mar 03 '21 00:03 henryiii

Yeah maybe. There seems to be a policy difference between python package names which are permissive and python console script names which seem to want to be case sensitive.

itsayellow avatar Mar 03 '21 05:03 itsayellow

Pip uses distlib (most of the time) to look up entrypoints, and pipx.run uses importlib.metadata, both preserves case IIUC.

The only scenario I can think of the setuptools would cause a behavioural change (for pipx) is for packages that only distribute source dists and cannot be built as a wheel, in which case the entry points will be created by setuptools (via setup.py install).

uranusjr avatar Mar 03 '21 06:03 uranusjr