Load services as submodules

This commit is contained in:
Benjamin Bohard 2020-03-25 14:35:05 +01:00
parent b2151c41bc
commit e475dffc95
4 changed files with 23 additions and 3 deletions

1
debian/control vendored
View File

@ -11,3 +11,4 @@ Architecture: any
Pre-Depends: dpkg, python3, ${misc:Pre-Depends} Pre-Depends: dpkg, python3, ${misc:Pre-Depends}
Depends: ${python:Depends}, ${misc:Depends} Depends: ${python:Depends}, ${misc:Depends}
Description: configuration manager Description: configuration manager

View File

@ -1,3 +1,4 @@
#!/usr/bin/env python3
from asyncio import get_event_loop from asyncio import get_event_loop
from risotto import get_app from risotto import get_app

9
setup.py Normal file
View File

@ -0,0 +1,9 @@
from setuptools import setup, find_packages
setup(
name='risotto',
version='0.1',
packages=['risotto' ],
scripts=['script/risotto.py'],
package_dir={"": "src"},
)

View File

@ -1,4 +1,13 @@
from pkg_resources import iter_entry_points
class Service:
pass
services = Service()
for ep in iter_entry_points(group='risotto_services'):
setattr(services, ep.name, ep.load())
def list_modules():
return services
from .http import get_app from .http import get_app
__ALL__ = ('get_app', 'services')
__ALL__ = ('get_app',)