$ tree hello-package/
hello-package/
├── hello
│ ├── app.py
│ └── __main__.py
└── setup.py
examples/hello-package/hello/app.py
def say_it():
print("Hello World!")
examples/hello-package/hello/main.py
from .app import say_it
say_it()
examples/hello-package/setup.py
from setuptools import setup
setup(
name="hello",
version="0.1.0",
packages=["hello"],
entry_points={
"console_scripts": [
"hello=hello.app:say_it",
]
}
)
cd
into the hello-package
folder and we can run the code using python -m hello