I am working on a standalone Python-GUI-program. When I run
python3 setup.py sdist
I get the following warning:
package init file 'main-application-folder/__init__.py' not found (or not a regular file)
Is this warning only meant for packages or should a standalone Python program also have an __init__.py
instead of something like main-window.py
or my-first-program.py
?
Should I rename my main file (in my case ìbk-st.py
to __init__.py
) or would it be good to retain a certain structure in the __init__.py
(i.e. make a separate file that calls the ibk-st.py
file)
Link to project:
You should rename the ibk-st
into a valid package identifier for python (ibk_st
maybe); then ibk-st.py
into something like main_ui.py
; then have an __init__.py
for that whole package (alternatively you can rename ibk-st.py
to __init__.py
).
Do note that setup.py
can install command line scripts; you can provide a thin wrapper as file bin/ibk-st-ui
with contents
#!/usr/bin/env python
from ibk_st.main_ui import main
main()
The module installation will ensure that the script is runnable on whatever platform the user is using.
Then in your setup.py
you should have
...
packages = [ 'ibk_st' ],
scripts=[ 'bin/ibk-st-ui' ],
...
Now when you run the setup.py install
or install the package, the modules can be embedded into other programs and the command ibk-st-ui
will be installed in the the bin
folder (be it the bin
of a virtualenv or the system /usr/local/bin
), that can run the UI.