When we develop a program for the end user, we put entry points in the code and get modules or packages ready to run.
But even if you do everything correctly, the user still has to write a very long command, python3 -m FULL_NAME_MODULE
.
To simplify this, developers design their packages so users can enter short commands. Poetry calls these commands scripts.
Entry point in the example project
The entry point to the program can be any function located in any module. Let's place the entry point in the hello.scripts.say_hello
module to keep things in order:
tree hello
hello/
├── __init__.py
└── scripts
├── __init__.py
└── say_hello.py
cat hello/scripts/say_hello.py
def main():
print("Hello!")