The docs for the (awesome) Click package suggest a few reasons to use entry points instead of scripts, including

  1. cross-platform compatibility and
  2. avoiding having the interpreter assign __name__ to __main__, which could cause code to be imported twice (if another module imports your script)

Click is a nice way to implement functions for use as entry_points, btw.

Answer from jfeala on Stack Overflow
🌐
Readthedocs
python-packaging.readthedocs.io › en › latest › command-line-scripts.html
Command Line Scripts — Python Packaging Tutorial
This allows Python functions (not scripts!) to be directly registered as command-line accessible tools. In this case, we’ll add a new file and function to support the command line tool: funniest/ funniest/ __init__.py command_line.py ... setup.py ... The command_line.py submodule exists only to service the command line tool (which is a convenient organization method): ... setup( ... entry_points = { 'console_scripts': ['funniest-joke=funniest.command_line:main'], } ...
Discussions

python console scripts + venv
This has already been automated very well by pipx More on reddit.com
🌐 r/Python
10
5
May 31, 2021
Using a Python Package with 'console_scripts'
I have a Python package that generate console script as entry-point. More on github.com
🌐 github.com
6
May 26, 2020
Packaging console scripts with interpreter options - Packaging - Discussions on Python.org
Hi, This originally started in Packaging Python script with UTF-8 mode - #7 by jeanas. It would be great if there were a way to distribute CLI applications on PyPI that can use it regardless of what PYTHONUTF8 is set to in the user’s environment. Think of this as from __future__ import ... More on discuss.python.org
🌐 discuss.python.org
0
February 13, 2023
Should console_scripts entry points exclude the scripts directory from sys.path? - Packaging - Discussions on Python.org
Hello packaging folks. I assume that a script that is created in /usr/bin or a similar directory (called scripts in the sysconfig installation scheme) from a console_script entry point would never need to import Python modules from /usr/bin itself. A pip-installed script looks like this: ... More on discuss.python.org
🌐 discuss.python.org
0
February 23, 2022
🌐
Python Packaging
packaging.python.org › specifications › entry-points
Entry points specification - Python Packaging User Guide
For instance, the entry point mycmd = mymod:main would create a command mycmd launching a script like this: import sys from mymod import main sys.exit(main()) The difference between console_scripts and gui_scripts only affects Windows systems. console_scripts are wrapped in a console executable, so they are attached to a console and can use sys.stdin, sys.stdout and sys.stderr for input and output.
🌐
PyPA
setuptools.pypa.io › en › latest › userguide › entry_point.html
Entry Points - setuptools 84.0.0 documentation
Entry points are a type of metadata that can be exposed by packages on installation. They are a very useful feature of the Python ecosystem, and come specially handy in two scenarios: 1. The package would like to provide commands to be run at the terminal. This functionality is known as console ...
🌐
PyPI
pypi.org › project › pytest-console-scripts
pytest-console-scripts · PyPI
Pytest-console-scripts is a pytest plugin for running python scripts from within tests.
🌐
Sixfeetup
sixfeetup.com › blog › python-command-line-tools-console_scripts
Building Python Command Line Tools, Part 2: Console Scripts
entry_points = """\ [paste.app_factory] main = myapp:main [console_scripts] import_sessions = myapp.scripts:import_sessions """, This allows your Python function to be registered as a command line tool.
Find elsewhere
🌐
Medium
medium.com › @SrvZ › en-rich-your-python-console-scripts-37926d8cd5bf
How to en”Rich” your Python console scripts | by Sourav De | Medium
January 24, 2023 - In such scenarios, we actually don’t need a GUI however we do need to monitor the output of our scripts so some level of visual feedback is still required. Now looking at a long-running stream of log messages or errors can be a daunting and boring task · So how about we make our gloomy wall of text a fresh look 😎. Textualize released a new Python module Rich which helps us create some great-looking Command Line Interfaces which previously would require a lot of effort and thus en”rich”ing our console experience 😀. Here is the demo image showing all the features supported by rich:
🌐
YouTube
youtube.com › watch
How to create Python scripts you can invoke as console commands - YouTube
Ever wanted to write a script and automatically deploy it so you can invoke it by just typing a simple command at the console? Python's setuptools library le...
Published: November 8, 2022
🌐
Datacadamia
datacadamia.com › lang › python › engine › script
Python - Script
August 30, 2024 - When a console_scripts aware installer such as pip installs the distribution, it will create a command-line wrapper for each entry point. Example: declaration of two console scripts called foo and bar,
🌐
CodeRivers
coderivers.org › blog › run-script-from-python-console
Running Scripts from the Python Console - CodeRivers
August 8, 2026 - You can run it from the console using the command python hello.py in the terminal. To run a simple Python script from the console, first, create a Python file with a .py extension.
🌐
Bouzekri
blog.bouzekri.net › 2017-10-08-bundle-cli-in-python-project.html
Bundle a CLI script in your Python project | Jonathan Bouzekri’s blog
October 8, 2017 - Each console script is defined with a string that follows this convention : <name of the executable> = <fullpath to a python module>:<name of the function to execute in the module>
🌐
Reddit
reddit.com › r/python › python console scripts + venv
r/Python on Reddit: python console scripts + venv
May 31, 2021 -

hi
So there are a lot of tools that are practically python scripts. Which is great.
You know, all of those "console_scripts" or "scripts" that you see in the setup.

But the thing is, that they don't use the amazing things called virtual environment out of the box. All of their requirements are just installed in the same default environment.

Now usually I just create a virtual environment and manually add a bash script that runs the tool in its own venv. No collisions that way.
But I do it manually. Now before I automate it, I wanted to ask. What do you do? How do you solve this problem?

🌐
GitHub
github.com › bazelbuild › rules_python › issues › 318
Using a Python Package with 'console_scripts' · Issue #318 · bazel-contrib/rules_python
May 26, 2020 - Hi, I have a Python package that generate console script as entry-point. The setup.py looks like so: entry_points={"console_scripts": ["my_package" = "my_package.cli:main&q...
Author: bazel-contrib
🌐
JetBrains
jetbrains.com › help › pycharm › using-consoles.html
Python console | PyCharm Documentation
February 15, 2024 - Python console enables executing Python commands and scripts line by line, similar to your experience with Python Shell.
🌐
Chriswarrick
chriswarrick.com › blog › 2014 › 09 › 15 › python-apps-the-right-way-entry_points-and-scripts
Python Apps the Right Way: entry points and scripts | Chris Warrick
September 15, 2014 - If you are developing a GUI application (in Tkinter, PyQt/PySide, wxPython, PyGTK, PyGame…), you should change the declaration to gui_scripts. On *nix, this makes no difference, but on Windows, it means that running your script by opening the created .exe files does not show a console window.
🌐
Rachum
amir.rachum.com › amir rachum's blog › python entry points explained
Python Entry Points Explained - Amir Rachum's
July 28, 2017 - console_scripts, they say, is a special type of entry point. setuptools reads its content as "<console script name> = <python object path>" and creates an appropriate script when your package is installed.
🌐
Python.org
discuss.python.org › packaging
Packaging console scripts with interpreter options - Packaging - Discussions on Python.org
February 13, 2023 - Hi, This originally started in Packaging Python script with UTF-8 mode - #7 by jeanas. It would be great if there were a way to distribute CLI applications on PyPI that can use it regardless of what PYTHONUTF8 is set to in the user’s environment. Think of this as from __future__ import utf_8_mode, except that since UTF-8 mode can’t be turned on after launching Python, it has to be done on the CLI invocation (or from the environment).
🌐
Python.org
discuss.python.org › packaging
Should console_scripts entry points exclude the scripts directory from sys.path? - Packaging - Discussions on Python.org
February 23, 2022 - Hello packaging folks. I assume that a script that is created in /usr/bin or a similar directory (called scripts in the sysconfig installation scheme) from a console_script entry point would never need to import Python modules from /usr/bin itself. A pip-installed script looks like this: #!/usr/bin/python3 # -*- coding: utf-8 -*- import re import sys from yyy import xxx if __name__ == '__main__': sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) sys.exit(xxx()) Would it...
🌐
Real Python
realpython.com › run-python-scripts
How to Run Your Python Scripts and Code – Real Python
July 16, 2026 - Running Python scripts is essential for executing your code. You can run Python scripts from the command line using python script.py, directly by making files executable with shebangs on Unix systems, or through IDEs and code editors.