"do i need an __init__.py if i want to build a standalone program and not a package?" Code Answer

2

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.

By brennie on July 22 2022

Answers related to “do i need an __init__.py if i want to build a standalone program and not a package?”

Only authorized users can answer the Search term. Please sign in first, or register a free account.