github.com
github.com
Entry Points ¶ 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.
docs.cloud.oracle.com
This functionality is known as console scripts. The console_scripts Entry Point ¶ The second approach is called an 'entry point'. Setuptools allows modules to register entrypoints which other packages can hook into to provide certain functionality.
stoic.software
It also provides a few itself, including the console_scripts entry point. The docs for the (awesome) Click package suggest a few reasons to use entry points instead of scripts, including cross-platform compatibility and 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. Entry points specification ¶ Entry points are a mechanism for an installed distribution to advertise components it provides to be discovered and used by other code.
www.youtube.com
For example: Distributions can specify console_scripts entry points, each referring to a function. When pip (or another console_scripts aware installer) installs the distribution, it will create a command. Adding a console script entry point allows the package to define a user-friendly name for installers of the package to execute.
stackoverflow.com
Installers like pip will create wrapper scripts to execute a function. In the above example, to create a command hello-world that invokes timmins.hello_world, add a console script entry point to setup.cfg: [options.entry_points]console_scripts=hello-world=timmins. In the above example, console_scripts is a keyword that indicates the type of entry point, followed by the name of the command that users will use to execute the script.
blog.csdn.net
The package.module:function specifies the function or class that will be executed when the command is invoked. For instance, if you have a project called my_project with a module called analysis and a function called run. When resolving these metadata keys, setuptools will look for tool.setuptools.dynamic.entry-points, and use the values of the console_scripts and gui_scripts entry.
github.com
The entry points for the hangman package are scanned and the hangman key from the console_scripts group is found and then called (again, calling hangman.main(). The return value of this function is used as the exit code of the sys.exit call. And, as an added bonus, you get to delete the bin/ directory from your project.
github.com
Cool, I love deleting code! The scripts option is an alternative to entry_points/console_scripts that is provided by the distutils package, which is included in the Python standard library. Entry points If you have any functions in your package that you would like to expose to be used as a command-line utility, you can add them to the console_scripts entry points.
rbxscript.com
For example, if you have a function called main in example_module.py, then adding this to your setup.cfg will allow users to run my-example-utility as a shell command.
www.tutorialspoint.com
github.com
www.ge.com
www.geeksforgeeks.org
support.docusign.com