console_scripts are not created or removed on subsequent package installations
See original GitHub issueEnvironment
- pip version: 20.2.4
- Python version: 3.7.6
- OS: Solus 4.1 Fortitude
Description
If a user had previously installed a package that had no console_scripts entrypoints, then installs the package again without uninstalling it first, pip will not create (or remove) any console_scripts.
This happens when installing in development mode (-e) or when not in development mode.
Expected behavior
pip checks if console_scripts entrypoints have changed on each install and creates (or removes) console scripts as needed.
How to Reproduce
- Create a new package without any
console_scripts - Install the package
- Add a
console_scriptsentrypoint - Install the package again
- Observe lack of wrapper script for entrypoint
- Uninstall the package
- Install the package
- Observe presence of wrapper script for entrypoint
$ cd $(mktemp -d)
$ python -m venv .venv
$ source .venv/bin/activate
$ python -m pip install -U pip setuptools wheel
Collecting pip
Using cached https://files.pythonhosted.org/packages/cb/28/91f26bd088ce8e22169032100d4260614fc3da435025ff389ef1d396a433/pip-20.2.4-py2.py3-none-any.whl
Collecting setuptools
Using cached https://files.pythonhosted.org/packages/6d/38/c21ef5034684ffc0412deefbb07d66678332290c14bb5269c85145fbd55e/setuptools-50.3.2-py3-none-any.whl
Collecting wheel
Using cached https://files.pythonhosted.org/packages/a7/00/3df031b3ecd5444d572141321537080b40c1c25e1caa3d86cdd12e5e919c/wheel-0.35.1-py2.py3-none-any.whl
Installing collected packages: pip, setuptools, wheel
Found existing installation: pip 19.2.3
Uninstalling pip-19.2.3:
Successfully uninstalled pip-19.2.3
Found existing installation: setuptools 41.2.0
Uninstalling setuptools-41.2.0:
Successfully uninstalled setuptools-41.2.0
Successfully installed pip-20.2.4 setuptools-50.3.2 wheel-0.35.1
$ mkdir testpkg
$ cat > setup.py <<'EOF'
from setuptools import setup, find_packages
setup(
name="testpkg",
version="0.0.1",
description="My test package",
long_description="# testpkg\nMy test package",
long_description_content_type="text/markdown",
author="test",
author_email="test@example.com",
maintainer="test",
maintainer_email="test@example.com",
url=f"https://git.example.com/test/testpkg/blob/master/README.md",
license="MIT",
classifiers=[
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: Implementation :: CPython",
],
packages=find_packages(),
)
EOF
$ cat > testpkg/cli.py <<'EOF'
def main():
print("Hello World")
EOF
$ find $VIRTUAL_ENV -name testpkgcli
$ python -m pip install --use-feature=2020-resolver -e .
Obtaining file:///tmp/tmp.pYPp8bLmjq
Installing collected packages: testpkg
Running setup.py develop for testpkg
Successfully installed testpkg
$ find $VIRTUAL_ENV -name testpkgcli
$ patch -p1 <<'EOF'
--- ./setup.py 2020-11-07 15:59:04.823235435 -0800
+++ ./setup.py 2020-11-07 15:59:20.927199879 -0800
@@ -23,4 +23,9 @@
"Programming Language :: Python :: Implementation :: CPython",
],
packages=find_packages(),
+ entry_points={
+ "console_scripts": [
+ "testpkgcli = testpkg.cli:main"
+ ],
+ }
)
EOF
patching file setup.py
$ python -m pip install --use-feature=2020-resolver -e .
Obtaining file:///tmp/tmp.pYPp8bLmjq
$ find $VIRTUAL_ENV -name testpkgcli
$ python -m pip uninstall -y testpkg
Found existing installation: testpkg 0.0.1
Uninstalling testpkg-0.0.1:
Successfully uninstalled testpkg-0.0.1
$ python -m pip install --use-feature=2020-resolver -e .
Obtaining file:///tmp/tmp.pYPp8bLmjq
Installing collected packages: testpkg
Running setup.py develop for testpkg
Successfully installed testpkg
$ find $VIRTUAL_ENV -name testpkgcli
/tmp/tmp.pYPp8bLmjq/.venv/bin/testpkgcli
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Python Entry point 'console_scripts' not found - Stack Overflow
It appears that command_line is not being added to the relevant site_packages folder. grant@DevBox2:/opt/anaconda2/lib/python2.7/site-packages/ ...
Read more >Manage NuGet packages with the Visual Studio Package ...
This article describes how to find, install, update, and uninstall NuGet packages with PowerShell commands in the Package Manager Console.
Read more >Install or update packages - AWS Systems Manager
Scheduling a package installation or update (console) · Uninstall and reinstall: The package is completely uninstalled, and then reinstalled. · In-place update: ...
Read more >Managing packages - Tanium Documentation
Consequently, even if signed in users do not have administrative rights, a Tanium Console user can deploy actions to the endpoint that install, ......
Read more >Troubleshooting | Apps Script - Google Developers
Server not available. or Server error occurred, please try again. Authorization is required to perform that action. Access denied: DriveApp or ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Oh BTW I forgot to mention, pip has a shorthand for the uninstall-install combination:
pip install --force-reinstall.Very true.
So to summarize
uninstalland theninstallif they want changes toentry_points(or anything else) to take effectpython setup.py egg_infoto update theentry_pointsandconsole_scripts