Xias Ideas

Setuptools Entry_points Console_scripts

Entry Points ¶ Entry points are a type of metadata that can be exposed by packages on installation.

Setuptools Entry_points Console_scripts
setuptools console_scripts entrypoints and buildout : r/Python
setuptools console_scripts entrypoints and buildout : r/Python
python - Conditional setuptools entry_points - Stack Overflow
python - Conditional setuptools entry_points - Stack Overflow

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.

setuptools - Explain Python entry points? - Stack Overflow
setuptools - Explain Python entry points? - Stack Overflow

This functionality is known as console scripts. One key difference between these two ways of creating command line executables is that with the setuptools approach (your first example), you have to call a function inside of the script -- in your case this is the func inside of your module. However, in the distutils approach (your second example) you call the script directly (which allows being listed with or without an extension).

使用console_scripts打包python代码
使用console_scripts打包python代码

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. It also provides a few itself, including the console_scripts entry point.

Setup Tool | PDF | Computer Architecture | Manufactured Goods
Setup Tool | PDF | Computer Architecture | Manufactured Goods

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. 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.

Demystefying Setuptools Entry Points - YouTube
Demystefying Setuptools Entry Points - YouTube

Advertising Behavior # Console scripts are one use of the more general concept of entry points. Entry points more generally allow a packager to advertise behavior for discovery by other libraries and applications. This feature enables "plug-in"-like functionality, where one library solicits entry points and any number of other libraries provide those entry points.

The Setup guide | Entry Point - YouTube
The Setup guide | Entry Point - YouTube

Dynamic scripts and gui-scripts are a special case. 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. The entry_points/console_scripts option is a feature provided by the setuptools package, which is commonly used for packaging and distributing Python projects.

PYTHON : How can I use setuptools to generate a console_scripts entry ...
PYTHON : How can I use setuptools to generate a console_scripts entry ...

It allows you to define command. Description setup.py wrapper shared above automatically creates executables for package from.py files. With setuptools >= 69 the installation doesn't return any errors.

Yet, the scripts are not being installed. All console script entry-points are defined to act as binaries on path and invoke the defined function using the command-line arguments passed. 2) Entry points.

Using setuptools entry points ¶ Tags: python, zestreleaser Entry points are a setuptools/distribute feature that's really handy in one specific case: register something under a specific key in package A that package B can query for. Setuptools itself uses it. If you're packaging your project up properly, you've probably used the console_scripts entry point.

Load Site Average 0,422 sec