2021.10.2 #48
@ -1,16 +1,16 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
if [ $1 == "-prod" ]; then
|
if [ $1 == "-prod" ]; then
|
||||||
twine upload -r pip.sh-edraft.de ../dist/sh_cpl-cli/publish/setup/*
|
twine upload -r pip.sh-edraft.de dist/sh_cpl-cli/publish/setup/*
|
||||||
twine upload -r pip.sh-edraft.de ../dist/sh_cpl-core/publish/setup/*
|
twine upload -r pip.sh-edraft.de dist/sh_cpl-core/publish/setup/*
|
||||||
twine upload -r pip.sh-edraft.de ../dist/sh_cpl-query/publish/setup/*
|
twine upload -r pip.sh-edraft.de dist/sh_cpl-query/publish/setup/*
|
||||||
elif [ $1 == "-prod" ]; then
|
elif [ $1 == "-prod" ]; then
|
||||||
twine upload -r pip-exp.sh-edraft.de ../dist/sh_cpl-cli/publish/setup/*
|
twine upload -r pip-exp.sh-edraft.de dist/sh_cpl-cli/publish/setup/*
|
||||||
twine upload -r pip-exp.sh-edraft.de ../dist/sh_cpl-core/publish/setup/*
|
twine upload -r pip-exp.sh-edraft.de dist/sh_cpl-core/publish/setup/*
|
||||||
twine upload -r pip-.sh-edraft.de ../dist/sh_cpl-query/publish/setup/*
|
twine upload -r pip-.sh-edraft.de dist/sh_cpl-query/publish/setup/*
|
||||||
|
|
||||||
else
|
else
|
||||||
twine upload -r pip-dev.sh-edraft.de ../dist/sh_cpl-cli/publish/setup/*
|
twine upload -r pip-dev.sh-edraft.de dist/sh_cpl-cli/publish/setup/*
|
||||||
twine upload -r pip-dev.sh-edraft.de ../dist/sh_cpl-core/publish/setup/*
|
twine upload -r pip-dev.sh-edraft.de dist/sh_cpl-core/publish/setup/*
|
||||||
twine upload -r pip-dev.sh-edraft.de ../dist/sh_cpl-query/publish/setup/*
|
twine upload -r pip-dev.sh-edraft.de dist/sh_cpl-query/publish/setup/*
|
||||||
fi
|
fi
|
||||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_cli'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.10.2'
|
__version__ = '2021.10.3'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@ -29,4 +29,4 @@ from .main import main
|
|||||||
from .startup import Startup
|
from .startup import Startup
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='10', micro='2')
|
version_info = VersionInfo(major='2021', minor='10', micro='3')
|
||||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.10.2'
|
__version__ = '2021.10.3'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='10', micro='2')
|
version_info = VersionInfo(major='2021', minor='10', micro='3')
|
||||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.build'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.10.2'
|
__version__ = '2021.10.3'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='10', micro='2')
|
version_info = VersionInfo(major='2021', minor='10', micro='3')
|
||||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.generate'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.10.2'
|
__version__ = '2021.10.3'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='10', micro='2')
|
version_info = VersionInfo(major='2021', minor='10', micro='3')
|
||||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.10.2'
|
__version__ = '2021.10.3'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='10', micro='2')
|
version_info = VersionInfo(major='2021', minor='10', micro='3')
|
||||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.console'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.10.2'
|
__version__ = '2021.10.3'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='10', micro='2')
|
version_info = VersionInfo(major='2021', minor='10', micro='3')
|
||||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.console.source'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.10.2'
|
__version__ = '2021.10.3'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='10', micro='2')
|
version_info = VersionInfo(major='2021', minor='10', micro='3')
|
||||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.console.source.name'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.10.2'
|
__version__ = '2021.10.3'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='10', micro='2')
|
version_info = VersionInfo(major='2021', minor='10', micro='3')
|
||||||
|
@ -12,12 +12,13 @@ class MainWithApplicationHostAndStartupTemplate(TemplateFileABC):
|
|||||||
name = String.convert_to_snake_case(name)
|
name = String.convert_to_snake_case(name)
|
||||||
self._name = 'main.py'
|
self._name = 'main.py'
|
||||||
self._path = path
|
self._path = path
|
||||||
self._use_async = use_async
|
|
||||||
|
|
||||||
import_pkg = f'{name}.'
|
import_pkg = f'{name}.'
|
||||||
|
|
||||||
if use_async:
|
if use_async:
|
||||||
self._value = textwrap.dedent(f"""\
|
self._value = textwrap.dedent(f"""\
|
||||||
|
import asyncio
|
||||||
|
|
||||||
from cpl_core.application import ApplicationBuilder
|
from cpl_core.application import ApplicationBuilder
|
||||||
|
|
||||||
from {import_pkg}application import Application
|
from {import_pkg}application import Application
|
||||||
@ -28,7 +29,7 @@ class MainWithApplicationHostAndStartupTemplate(TemplateFileABC):
|
|||||||
app_builder = ApplicationBuilder(Application)
|
app_builder = ApplicationBuilder(Application)
|
||||||
app_builder.use_startup(Startup)
|
app_builder.use_startup(Startup)
|
||||||
app: Application = await app_builder.build_async()
|
app: Application = await app_builder.build_async()
|
||||||
await app.run()
|
await app.run_async()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
@ -74,12 +75,13 @@ class MainWithApplicationBaseTemplate(TemplateFileABC):
|
|||||||
name = String.convert_to_snake_case(name)
|
name = String.convert_to_snake_case(name)
|
||||||
self._name = 'main.py'
|
self._name = 'main.py'
|
||||||
self._path = path
|
self._path = path
|
||||||
self._use_async = use_async
|
|
||||||
|
|
||||||
import_pkg = f'{name}.'
|
import_pkg = f'{name}.'
|
||||||
|
|
||||||
if use_async:
|
if use_async:
|
||||||
self._value = textwrap.dedent(f"""\
|
self._value = textwrap.dedent(f"""\
|
||||||
|
import asyncio
|
||||||
|
|
||||||
from cpl_core.application import ApplicationBuilder
|
from cpl_core.application import ApplicationBuilder
|
||||||
|
|
||||||
from {import_pkg}application import Application
|
from {import_pkg}application import Application
|
||||||
@ -88,7 +90,7 @@ class MainWithApplicationBaseTemplate(TemplateFileABC):
|
|||||||
async def main():
|
async def main():
|
||||||
app_builder = ApplicationBuilder(Application)
|
app_builder = ApplicationBuilder(Application)
|
||||||
app: Application = await app_builder.build_async()
|
app: Application = await app_builder.build_async()
|
||||||
await app.run()
|
await app.run_async()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
@ -132,12 +134,13 @@ class MainWithoutApplicationBaseTemplate(TemplateFileABC):
|
|||||||
name = String.convert_to_snake_case(name)
|
name = String.convert_to_snake_case(name)
|
||||||
self._name = 'main.py'
|
self._name = 'main.py'
|
||||||
self._path = path
|
self._path = path
|
||||||
self._use_async = use_async
|
|
||||||
|
|
||||||
import_pkg = f'{name}.'
|
import_pkg = f'{name}.'
|
||||||
|
|
||||||
if use_async:
|
if use_async:
|
||||||
self._value = textwrap.dedent("""\
|
self._value = textwrap.dedent("""\
|
||||||
|
import asyncio
|
||||||
|
|
||||||
from cpl_core.console import Console
|
from cpl_core.console import Console
|
||||||
|
|
||||||
|
|
||||||
@ -183,12 +186,13 @@ class MainWithDependencyInjection(TemplateFileABC):
|
|||||||
name = String.convert_to_snake_case(name)
|
name = String.convert_to_snake_case(name)
|
||||||
self._name = 'main.py'
|
self._name = 'main.py'
|
||||||
self._path = path
|
self._path = path
|
||||||
self._use_async = use_async
|
|
||||||
|
|
||||||
import_pkg = f'{name}.'
|
import_pkg = f'{name}.'
|
||||||
|
|
||||||
if use_async:
|
if use_async:
|
||||||
self._value = textwrap.dedent("""\
|
self._value = textwrap.dedent("""\
|
||||||
|
import asyncio
|
||||||
|
|
||||||
from cpl_core.configuration import Configuration, ConfigurationABC
|
from cpl_core.configuration import Configuration, ConfigurationABC
|
||||||
from cpl_core.console import Console
|
from cpl_core.console import Console
|
||||||
from cpl_core.dependency_injection import ServiceCollection, ServiceProviderABC
|
from cpl_core.dependency_injection import ServiceCollection, ServiceProviderABC
|
||||||
@ -205,8 +209,8 @@ class MainWithDependencyInjection(TemplateFileABC):
|
|||||||
|
|
||||||
|
|
||||||
async def main():
|
async def main():
|
||||||
await config = configure_configuration()
|
config = await configure_configuration()
|
||||||
await provider = configure_services(config)
|
provider = await configure_services(config)
|
||||||
Console.write_line('Hello World')
|
Console.write_line('Hello World')
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.console.source.tests'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.10.2'
|
__version__ = '2021.10.3'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='10', micro='2')
|
version_info = VersionInfo(major='2021', minor='10', micro='3')
|
||||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.library'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.10.2'
|
__version__ = '2021.10.3'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='10', micro='2')
|
version_info = VersionInfo(major='2021', minor='10', micro='3')
|
||||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.library.source'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.10.2'
|
__version__ = '2021.10.3'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='10', micro='2')
|
version_info = VersionInfo(major='2021', minor='10', micro='3')
|
||||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.library.source.name'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.10.2'
|
__version__ = '2021.10.3'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='10', micro='2')
|
version_info = VersionInfo(major='2021', minor='10', micro='3')
|
||||||
|
@ -5,29 +5,50 @@ from cpl_cli._templates.template_file_abc import TemplateFileABC
|
|||||||
|
|
||||||
class ApplicationTemplate(TemplateFileABC):
|
class ApplicationTemplate(TemplateFileABC):
|
||||||
|
|
||||||
def __init__(self, name: str, path: str):
|
def __init__(self, name: str, path: str, use_async: bool):
|
||||||
TemplateFileABC.__init__(self)
|
TemplateFileABC.__init__(self)
|
||||||
|
|
||||||
self._name = 'application.py'
|
self._name = 'application.py'
|
||||||
self._path = path
|
self._path = path
|
||||||
self._value = textwrap.dedent("""\
|
|
||||||
from cpl_core.application import ApplicationABC
|
if use_async:
|
||||||
from cpl_core.configuration import ConfigurationABC
|
self._value = textwrap.dedent("""\
|
||||||
from cpl_core.console import Console
|
from cpl_core.application import ApplicationABC
|
||||||
from cpl_core.dependency_injection import ServiceProviderABC
|
from cpl_core.configuration import ConfigurationABC
|
||||||
|
from cpl_core.console import Console
|
||||||
|
from cpl_core.dependency_injection import ServiceProviderABC
|
||||||
|
|
||||||
|
|
||||||
|
class Application(ApplicationABC):
|
||||||
|
|
||||||
|
def __init__(self, config: ConfigurationABC, services: ServiceProviderABC):
|
||||||
|
ApplicationABC.__init__(self, config, services)
|
||||||
|
|
||||||
class Application(ApplicationABC):
|
async def configure(self):
|
||||||
|
pass
|
||||||
def __init__(self, config: ConfigurationABC, services: ServiceProviderABC):
|
|
||||||
ApplicationABC.__init__(self, config, services)
|
async def main(self):
|
||||||
|
Console.write_line('Hello World')
|
||||||
def configure(self):
|
""")
|
||||||
pass
|
else:
|
||||||
|
self._value = textwrap.dedent("""\
|
||||||
def main(self):
|
from cpl_core.application import ApplicationABC
|
||||||
Console.write_line('Hello World')
|
from cpl_core.configuration import ConfigurationABC
|
||||||
""")
|
from cpl_core.console import Console
|
||||||
|
from cpl_core.dependency_injection import ServiceProviderABC
|
||||||
|
|
||||||
|
|
||||||
|
class Application(ApplicationABC):
|
||||||
|
|
||||||
|
def __init__(self, config: ConfigurationABC, services: ServiceProviderABC):
|
||||||
|
ApplicationABC.__init__(self, config, services)
|
||||||
|
|
||||||
|
def configure(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def main(self):
|
||||||
|
Console.write_line('Hello World')
|
||||||
|
""")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self) -> str:
|
def name(self) -> str:
|
||||||
|
@ -5,7 +5,7 @@ from cpl_cli._templates.template_file_abc import TemplateFileABC
|
|||||||
|
|
||||||
class MainWithApplicationHostAndStartupTemplate(TemplateFileABC):
|
class MainWithApplicationHostAndStartupTemplate(TemplateFileABC):
|
||||||
|
|
||||||
def __init__(self, name: str, path: str):
|
def __init__(self, name: str, path: str, use_async: bool):
|
||||||
TemplateFileABC.__init__(self)
|
TemplateFileABC.__init__(self)
|
||||||
|
|
||||||
self._name = 'main.py'
|
self._name = 'main.py'
|
||||||
@ -15,22 +15,44 @@ class MainWithApplicationHostAndStartupTemplate(TemplateFileABC):
|
|||||||
if name == '':
|
if name == '':
|
||||||
import_pkg = ''
|
import_pkg = ''
|
||||||
|
|
||||||
self._value = textwrap.dedent(f"""\
|
if use_async:
|
||||||
from cpl_core.application import ApplicationBuilder
|
self._value = textwrap.dedent(f"""\
|
||||||
|
import asyncio
|
||||||
from {import_pkg}application import Application
|
|
||||||
from {import_pkg}startup import Startup
|
from cpl_core.application import ApplicationBuilder
|
||||||
|
|
||||||
|
from {import_pkg}application import Application
|
||||||
def main():
|
from {import_pkg}startup import Startup
|
||||||
app_builder = ApplicationBuilder(Application)
|
|
||||||
app_builder.use_startup(Startup)
|
|
||||||
app_builder.build().run()
|
async def main():
|
||||||
|
app_builder = ApplicationBuilder(Application)
|
||||||
|
app_builder.use_startup(Startup)
|
||||||
if __name__ == '__main__':
|
app: Application = await app_builder.build_async()
|
||||||
main()
|
await app.run_async()
|
||||||
""")
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
ml = asyncio.get_event_loop()
|
||||||
|
ml.run_until_complete(main())
|
||||||
|
""")
|
||||||
|
else:
|
||||||
|
self._value = textwrap.dedent(f"""\
|
||||||
|
from cpl_core.application import ApplicationBuilder
|
||||||
|
|
||||||
|
from {import_pkg}application import Application
|
||||||
|
from {import_pkg}startup import Startup
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
app_builder = ApplicationBuilder(Application)
|
||||||
|
app_builder.use_startup(Startup)
|
||||||
|
app_builder.build().run()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
|
""")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self) -> str:
|
def name(self) -> str:
|
||||||
@ -47,7 +69,7 @@ class MainWithApplicationHostAndStartupTemplate(TemplateFileABC):
|
|||||||
|
|
||||||
class MainWithApplicationBaseTemplate(TemplateFileABC):
|
class MainWithApplicationBaseTemplate(TemplateFileABC):
|
||||||
|
|
||||||
def __init__(self, name: str, path: str):
|
def __init__(self, name: str, path: str, use_async: bool):
|
||||||
TemplateFileABC.__init__(self)
|
TemplateFileABC.__init__(self)
|
||||||
|
|
||||||
self._name = 'main.py'
|
self._name = 'main.py'
|
||||||
@ -57,20 +79,40 @@ class MainWithApplicationBaseTemplate(TemplateFileABC):
|
|||||||
if name == '':
|
if name == '':
|
||||||
import_pkg = ''
|
import_pkg = ''
|
||||||
|
|
||||||
self._value = textwrap.dedent(f"""\
|
if use_async:
|
||||||
from cpl_core.application import ApplicationBuilder
|
self._value = textwrap.dedent(f"""\
|
||||||
|
import asyncio
|
||||||
from {import_pkg}application import Application
|
|
||||||
|
from cpl_core.application import ApplicationBuilder
|
||||||
|
|
||||||
def main():
|
from {import_pkg}application import Application
|
||||||
app_builder = ApplicationBuilder(Application)
|
|
||||||
app_builder.build().run()
|
|
||||||
|
async def main():
|
||||||
|
app_builder = ApplicationBuilder(Application)
|
||||||
if __name__ == '__main__':
|
app: Application = await app_builder.build_async()
|
||||||
main()
|
await app.run_async()
|
||||||
""")
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
ml = asyncio.get_event_loop()
|
||||||
|
ml.run_until_complete(main())
|
||||||
|
""")
|
||||||
|
else:
|
||||||
|
self._value = textwrap.dedent(f"""\
|
||||||
|
from cpl_core.application import ApplicationBuilder
|
||||||
|
|
||||||
|
from {import_pkg}application import Application
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
app_builder = ApplicationBuilder(Application)
|
||||||
|
app_builder.build().run()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
|
""")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self) -> str:
|
def name(self) -> str:
|
||||||
@ -87,23 +129,39 @@ class MainWithApplicationBaseTemplate(TemplateFileABC):
|
|||||||
|
|
||||||
class MainWithoutApplicationBaseTemplate(TemplateFileABC):
|
class MainWithoutApplicationBaseTemplate(TemplateFileABC):
|
||||||
|
|
||||||
def __init__(self, name: str, path: str):
|
def __init__(self, name: str, path: str, use_async: bool):
|
||||||
TemplateFileABC.__init__(self)
|
TemplateFileABC.__init__(self)
|
||||||
|
|
||||||
self._name = 'main.py'
|
self._name = 'main.py'
|
||||||
self._path = path
|
self._path = path
|
||||||
|
|
||||||
self._value = textwrap.dedent("""\
|
if use_async:
|
||||||
from cpl_core.console import Console
|
self._value = textwrap.dedent("""\
|
||||||
|
import asyncio
|
||||||
|
|
||||||
def main():
|
from cpl_core.console import Console
|
||||||
Console.write_line('Hello World')
|
|
||||||
|
|
||||||
|
async def main():
|
||||||
if __name__ == '__main__':
|
Console.write_line('Hello World')
|
||||||
main()
|
|
||||||
""")
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
ml = asyncio.get_event_loop()
|
||||||
|
ml.run_until_complete(main())
|
||||||
|
""")
|
||||||
|
else:
|
||||||
|
self._value = textwrap.dedent("""\
|
||||||
|
from cpl_core.console import Console
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
Console.write_line('Hello World')
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
|
""")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self) -> str:
|
def name(self) -> str:
|
||||||
@ -120,37 +178,67 @@ class MainWithoutApplicationBaseTemplate(TemplateFileABC):
|
|||||||
|
|
||||||
class MainWithDependencyInjection(TemplateFileABC):
|
class MainWithDependencyInjection(TemplateFileABC):
|
||||||
|
|
||||||
def __init__(self, name: str, path: str):
|
def __init__(self, name: str, path: str, use_async: bool):
|
||||||
TemplateFileABC.__init__(self)
|
TemplateFileABC.__init__(self)
|
||||||
|
|
||||||
self._name = 'main.py'
|
self._name = 'main.py'
|
||||||
self._path = path
|
self._path = path
|
||||||
|
|
||||||
self._value = textwrap.dedent("""\
|
if use_async:
|
||||||
from cpl_core.configuration import Configuration, ConfigurationABC
|
self._value = textwrap.dedent("""\
|
||||||
from cpl_core.console import Console
|
import asyncio
|
||||||
from cpl_core.dependency_injection import ServiceCollection, ServiceProviderABC
|
|
||||||
|
from cpl_core.configuration import Configuration, ConfigurationABC
|
||||||
|
from cpl_core.console import Console
|
||||||
def configure_configuration() -> ConfigurationABC:
|
from cpl_core.dependency_injection import ServiceCollection, ServiceProviderABC
|
||||||
config = Configuration()
|
|
||||||
return config
|
|
||||||
|
async def configure_configuration() -> ConfigurationABC:
|
||||||
|
config = Configuration()
|
||||||
def configure_services(config: ConfigurationABC) -> ServiceProviderABC:
|
return config
|
||||||
services = ServiceCollection(config)
|
|
||||||
return services.build_service_provider()
|
|
||||||
|
async def configure_services(config: ConfigurationABC) -> ServiceProviderABC:
|
||||||
|
services = ServiceCollection(config)
|
||||||
def main():
|
return services.build_service_provider()
|
||||||
config = configure_configuration()
|
|
||||||
provider = configure_services(config)
|
|
||||||
Console.write_line('Hello World')
|
async def main():
|
||||||
|
config = await configure_configuration()
|
||||||
|
provider = await configure_services(config)
|
||||||
if __name__ == '__main__':
|
Console.write_line('Hello World')
|
||||||
main()
|
|
||||||
""")
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
ml = asyncio.get_event_loop()
|
||||||
|
ml.run_until_complete(main())
|
||||||
|
""")
|
||||||
|
else:
|
||||||
|
self._value = textwrap.dedent("""\
|
||||||
|
from cpl_core.configuration import Configuration, ConfigurationABC
|
||||||
|
from cpl_core.console import Console
|
||||||
|
from cpl_core.dependency_injection import ServiceCollection, ServiceProviderABC
|
||||||
|
|
||||||
|
|
||||||
|
def configure_configuration() -> ConfigurationABC:
|
||||||
|
config = Configuration()
|
||||||
|
return config
|
||||||
|
|
||||||
|
|
||||||
|
def configure_services(config: ConfigurationABC) -> ServiceProviderABC:
|
||||||
|
services = ServiceCollection(config)
|
||||||
|
return services.build_service_provider()
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
config = configure_configuration()
|
||||||
|
provider = configure_services(config)
|
||||||
|
Console.write_line('Hello World')
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
|
""")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self) -> str:
|
def name(self) -> str:
|
||||||
|
@ -5,29 +5,50 @@ from cpl_cli._templates.template_file_abc import TemplateFileABC
|
|||||||
|
|
||||||
class StartupTemplate(TemplateFileABC):
|
class StartupTemplate(TemplateFileABC):
|
||||||
|
|
||||||
def __init__(self, name: str, path: str):
|
def __init__(self, name: str, path: str, use_async: bool):
|
||||||
TemplateFileABC.__init__(self)
|
TemplateFileABC.__init__(self)
|
||||||
|
|
||||||
self._name = 'startup.py'
|
self._name = 'startup.py'
|
||||||
self._path = path
|
self._path = path
|
||||||
self._value = textwrap.dedent("""\
|
|
||||||
from cpl_core.application import StartupABC
|
if use_async:
|
||||||
from cpl_core.configuration import ConfigurationABC
|
self._value = textwrap.dedent("""\
|
||||||
from cpl_core.dependency_injection import ServiceProviderABC, ServiceCollectionABC
|
from cpl_core.application import StartupABC
|
||||||
from cpl_core.environment import ApplicationEnvironment
|
from cpl_core.configuration import ConfigurationABC
|
||||||
|
from cpl_core.dependency_injection import ServiceProviderABC, ServiceCollectionABC
|
||||||
|
from cpl_core.environment import ApplicationEnvironment
|
||||||
class Startup(StartupABC):
|
|
||||||
|
|
||||||
def __init__(self):
|
class Startup(StartupABC):
|
||||||
StartupABC.__init__(self)
|
|
||||||
|
def __init__(self):
|
||||||
def configure_configuration(self, configuration: ConfigurationABC, environment: ApplicationEnvironment) -> ConfigurationABC:
|
StartupABC.__init__(self)
|
||||||
return configuration
|
|
||||||
|
async def configure_configuration(self, configuration: ConfigurationABC, environment: ApplicationEnvironment) -> ConfigurationABC:
|
||||||
def configure_services(self, services: ServiceCollectionABC, environment: ApplicationEnvironment) -> ServiceProviderABC:
|
return configuration
|
||||||
return services.build_service_provider()
|
|
||||||
""")
|
async def configure_services(self, services: ServiceCollectionABC, environment: ApplicationEnvironment) -> ServiceProviderABC:
|
||||||
|
return services.build_service_provider()
|
||||||
|
""")
|
||||||
|
else:
|
||||||
|
self._value = textwrap.dedent("""\
|
||||||
|
from cpl_core.application import StartupABC
|
||||||
|
from cpl_core.configuration import ConfigurationABC
|
||||||
|
from cpl_core.dependency_injection import ServiceProviderABC, ServiceCollectionABC
|
||||||
|
from cpl_core.environment import ApplicationEnvironment
|
||||||
|
|
||||||
|
|
||||||
|
class Startup(StartupABC):
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
StartupABC.__init__(self)
|
||||||
|
|
||||||
|
def configure_configuration(self, configuration: ConfigurationABC, environment: ApplicationEnvironment) -> ConfigurationABC:
|
||||||
|
return configuration
|
||||||
|
|
||||||
|
def configure_services(self, services: ServiceCollectionABC, environment: ApplicationEnvironment) -> ServiceProviderABC:
|
||||||
|
return services.build_service_provider()
|
||||||
|
""")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self) -> str:
|
def name(self) -> str:
|
||||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.library.source.tests'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.10.2'
|
__version__ = '2021.10.3'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='10', micro='2')
|
version_info = VersionInfo(major='2021', minor='10', micro='3')
|
||||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.publish'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.10.2'
|
__version__ = '2021.10.3'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='10', micro='2')
|
version_info = VersionInfo(major='2021', minor='10', micro='3')
|
||||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_cli.command'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.10.2'
|
__version__ = '2021.10.3'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@ -28,4 +28,4 @@ from .publish_service import PublishService
|
|||||||
from .version_service import VersionService
|
from .version_service import VersionService
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='10', micro='2')
|
version_info = VersionInfo(major='2021', minor='10', micro='3')
|
||||||
|
@ -180,7 +180,7 @@ class NewService(CommandABC):
|
|||||||
self._use_service_providing = True
|
self._use_service_providing = True
|
||||||
|
|
||||||
result = Console.read('Do you want to use async? (y/n) ')
|
result = Console.read('Do you want to use async? (y/n) ')
|
||||||
if result.lower == 'y':
|
if result.lower() == 'y':
|
||||||
self._use_async = True
|
self._use_async = True
|
||||||
|
|
||||||
Console.set_foreground_color(ForegroundColorEnum.default)
|
Console.set_foreground_color(ForegroundColorEnum.default)
|
||||||
|
@ -52,7 +52,11 @@ class VersionService(CommandABC):
|
|||||||
]
|
]
|
||||||
packages = []
|
packages = []
|
||||||
for modname in cpl_packages:
|
for modname in cpl_packages:
|
||||||
module = pkgutil.find_loader(modname).load_module(modname)
|
module = pkgutil.find_loader(modname)
|
||||||
|
if module is None:
|
||||||
|
break
|
||||||
|
|
||||||
|
module = module.load_module(modname)
|
||||||
if '__version__' in dir(module):
|
if '__version__' in dir(module):
|
||||||
packages.append([f'{modname}', module.__version__])
|
packages.append([f'{modname}', module.__version__])
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_cli.configuration'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.10.2'
|
__version__ = '2021.10.3'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@ -30,4 +30,4 @@ from .workspace_settings import WorkspaceSettings
|
|||||||
from .workspace_settings_name_enum import WorkspaceSettingsNameEnum
|
from .workspace_settings_name_enum import WorkspaceSettingsNameEnum
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='10', micro='2')
|
version_info = VersionInfo(major='2021', minor='10', micro='3')
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"Version": {
|
"Version": {
|
||||||
"Major": "2021",
|
"Major": "2021",
|
||||||
"Minor": "10",
|
"Minor": "10",
|
||||||
"Micro": "2"
|
"Micro": "3"
|
||||||
},
|
},
|
||||||
"Author": "Sven Heidemann",
|
"Author": "Sven Heidemann",
|
||||||
"AuthorEmail": "sven.heidemann@sh-edraft.de",
|
"AuthorEmail": "sven.heidemann@sh-edraft.de",
|
||||||
@ -16,7 +16,7 @@
|
|||||||
"LicenseName": "MIT",
|
"LicenseName": "MIT",
|
||||||
"LicenseDescription": "MIT, see LICENSE for more details.",
|
"LicenseDescription": "MIT, see LICENSE for more details.",
|
||||||
"Dependencies": [
|
"Dependencies": [
|
||||||
"sh_cpl-core>=2021.10.0.post1"
|
"sh_cpl-core>=2021.10.2"
|
||||||
],
|
],
|
||||||
"PythonVersion": ">=3.8",
|
"PythonVersion": ">=3.8",
|
||||||
"PythonPath": {},
|
"PythonPath": {},
|
||||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli.live_server'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.10.2'
|
__version__ = '2021.10.3'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='10', micro='2')
|
version_info = VersionInfo(major='2021', minor='10', micro='3')
|
||||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_cli.publish'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.10.2'
|
__version__ = '2021.10.3'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@ -24,4 +24,4 @@ from .publisher_abc import PublisherABC
|
|||||||
from .publisher_service import PublisherService
|
from .publisher_service import PublisherService
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='10', micro='2')
|
version_info = VersionInfo(major='2021', minor='10', micro='3')
|
||||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli.source_creator'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.10.2'
|
__version__ = '2021.10.3'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='10', micro='2')
|
version_info = VersionInfo(major='2021', minor='10', micro='3')
|
||||||
|
@ -35,17 +35,6 @@ class ApplicationABC(ABC):
|
|||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
Console.close()
|
Console.close()
|
||||||
|
|
||||||
def run(self):
|
|
||||||
r"""Entry point
|
|
||||||
|
|
||||||
Called by custom Application.main
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
self.configure()
|
|
||||||
self.main()
|
|
||||||
except KeyboardInterrupt:
|
|
||||||
Console.close()
|
|
||||||
|
|
||||||
async def run_async(self):
|
async def run_async(self):
|
||||||
r"""Entry point
|
r"""Entry point
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user