0

I have the following sample python application:

- testapp
-- __init__.py
-- main.py
-- hello
---- __init.py
---- hello.py
-- world
---- __init__.py
---- world.py

main.py

from testapp.hello import hello
from testapp.world import world

if __name__ == "__main__":
    hello.say()
    world.say()

world.py

def say():
    print('world')

hello.py

def say():
    print('hello')

then, I can go into testapp folder and run python -m main I get the print of 'Hello world'

Fine, but what I would like to do is to build a package with this and install the package elsewhere to execute it. I'm using poetry to build the whl package. My question is, how to install the package somewhere else (on a server i.e.) and run it? I would like to setup a distribution flow, where packages are build and stored on a private pypi repo, and servers can update and run the whole app.

I tried to make a poetry add on a folder on the server, it is working as the package is now installed but I don't know how to launch the main module inside the package.

Seanny123
  • 8,776
  • 13
  • 68
  • 124
bAN
  • 13,375
  • 16
  • 60
  • 93

1 Answers1

1

super easy in fact.. after the package installation,

python -m testapp.main

that's it

bAN
  • 13,375
  • 16
  • 60
  • 93