You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I created some CLI tools for myself a while back where I defined the command I'll invoke as , or something prefixed with a , such as ,docker to make it easier to find the when tab completing(Idea I got from one of Brandon Rhodes' talks). Since I make updates often and want it to be available globally, I installed my package as I use pipx I installed my package with pipx install --editable . and it always worked and got used it.
I recently noticed that if I install the package without the --editable flag it now fails with the following error
TypeError: expected str, bytes or os.PathLike object, not NoneType
Doing some digging around I found the following:
When installing normally (ie : pip install package) which uses a regex and capture groups to parse the console_script specification. Since , is not part of the capture group name is now None and therefore causing the error above when getting to ScriptMaker._make_script . For the ,docker command it now becomes docker since the , was not captured.
Documentation mentionsname may contain any characters except =, but it cannot start or end with any whitespace character, or start with [. which suggest , should be valid.
The name may contain any characters except =, but it cannot start or end with any whitespace character, or start with [. For new entry points, it is recommended to use only letters, numbers, underscores, dots and dashes (regex [\w.-]+).
Expected behavior
Comma should be capture in the ENTRY_RE regex name capture group to allow for , to become a valid command.
pip version
23.0.1
Python version
3.11
OS
Mac
How to Reproduce
git clone https://github.com/FlavioAmurrioCS/commabug.git /tmp/comma
virtuealenv /tmp/venv
/tmp/venv/bin/pip install /tmp/comma/ # Will show error
uranusjr
changed the title
console_scripts gets parse differently when pip installing with --editable flag
The distlib script maker does not parse entry points correctly
Jul 17, 2023
Description
I created some CLI tools for myself a while back where I defined the command I'll invoke as
,
or something prefixed with a,
such as,docker
to make it easier to find the when tab completing(Idea I got from one of Brandon Rhodes' talks). Since I make updates often and want it to be available globally, I installed my package as I use pipx I installed my package withpipx install --editable .
and it always worked and got used it.I recently noticed that if I install the package without the
--editable
flag it now fails with the following errorDoing some digging around I found the following:
When installing normally (ie :
pip install package
) which uses a regex and capture groups to parse the console_script specification. Since,
is not part of the capture group name is now None and therefore causing the error above when getting toScriptMaker._make_script
. For the,docker
command it now becomesdocker
since the , was not captured.pip/src/pip/_vendor/distlib/util.py
Lines 710 to 743 in b252ad8
When installing as editable(ie :
pip install --editable package
), the following snippet is in charge parsing the console_scriptspip/src/pip/_internal/metadata/pkg_resources.py
Lines 185 to 189 in b252ad8
Example Entry Point
Documentation mentions
name may contain any characters except =, but it cannot start or end with any whitespace character, or start with [.
which suggest,
should be valid.Expected behavior
Comma should be capture in the ENTRY_RE regex name capture group to allow for
,
to become a valid command.pip version
23.0.1
Python version
3.11
OS
Mac
How to Reproduce
git clone https://github.com/FlavioAmurrioCS/commabug.git /tmp/comma virtuealenv /tmp/venv /tmp/venv/bin/pip install /tmp/comma/ # Will show error
Output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: