It depends
If you are writing a
script (i.e. a
program that will be run directly by a user) it's not super important
(as it's just for you, not production code). Just follow the
basic advice from PEP8(https://peps.python.org/pep-0008/#naming-conventions):
names should reflect usage rather than implementation.
and regarding modules and packages (...and scripts):
Modules should have short, all-lowercase names. Underscores can be used in the module name if it improves readability. Python packages should also have short, all-lowercase names, although the use of underscores is discouraged.
What I would suggest is have a script with a descriptive name or
just main (I lean toward a descriptive one to convey more information)
then just make sure as your program grow, adjust accordingly. If you
start having a bunch of classes and function, create a
package
and put them in it.
Further Reading:
What is the difference between a module and a script?
Real Python offers an excellent delineation between scripts and modules in Python:
So, long story short: scripts are intended to be run directly, whereas modules are meant to be imported. Scripts often contain statements outside of the scope of any class or function, whereas modules define classes, functions, variables, and other members for use in scripts that import it.
A real-life example
Let's look at the open-source project pipenv this
gives us a good idea of how to structure a Python project. At the top
level, we have a directory named pipenv
which includes a __init__.py
file for when it is used as a package and a
__main__.py
file for when it's executed directly.
Wrapping up
Familiarize yourself with PEP8 it
contains almost all current Python style standards
See also:
https://docs.python.org/3/tutorial/modules.html
https://realpython.com/python-main-function/
main.py
? – Penhallmain
has no special meaning in Python - which is addressed by the linked duplicate.) – Coyne