Setup.Py Entrypoint Main

Setup.Py Entrypoint Main



Your main project package indeed doesn’t have a main attribute. project: main means: import main from the project module, and you don’t have such an object in __init__.py. You probably want to refer to project.script:function1 instead. That object does exist. Best practice is to define a main () function, and use that as an entry point:, 9/15/2014  · a setup.py file using setuptools. the following directory structure: entry_points_project/ my_project/ __init__.py; __main__.py; setup.py (entry_points_project is also where the README and other auxiliary files go, while my_project contains all the Python code.) When you’re done, you will have a project that can be executed by: python -m my_project. my_project, 4/10/2020  · The combination of console_scripts and entry_points in a project’s setup.py can help us achieve the same results as the previous sections, but without the need for the if __name__ == ‘__main__’ pattern. This is achieved by specifying a callable entry points in the setuptools config: Noting that we’re back to the original directory structure:, Python setup.py : Adding installation options. As seen in previous examples, basic use of this script is: python setup.py install. But there is even more options, like installing the package and have the possibility to change the code and test it without having to re-install it. This is done using: python setup.py develop, After installing the package, a user may invoke that function by simply calling hello-world on the command line. The syntax for entry points is specified as follows: where name is the name for the script you want to create, the left hand side of : is the module that contains your function and the right hand side is the object you want to invoke (e.g. a function).

12/15/2020  · 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-line wrapper for each …

Advertiser