From 470e7ab2f44779054781d26a8eb454b0df718875 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Sun, 14 Nov 2021 09:52:07 +0100 Subject: [PATCH 1/7] Changed versions to new scheme --- src/cpl_cli/__init__.py | 4 ++-- src/cpl_cli/_templates/__init__.py | 4 ++-- src/cpl_cli/_templates/build/__init__.py | 4 ++-- src/cpl_cli/_templates/generate/__init__.py | 4 ++-- src/cpl_cli/_templates/new/__init__.py | 4 ++-- src/cpl_cli/_templates/new/console/__init__.py | 4 ++-- src/cpl_cli/_templates/new/console/source/__init__.py | 4 ++-- src/cpl_cli/_templates/new/console/source/name/__init__.py | 4 ++-- src/cpl_cli/_templates/new/console/source/tests/__init__.py | 4 ++-- src/cpl_cli/_templates/new/library/__init__.py | 4 ++-- src/cpl_cli/_templates/new/library/source/__init__.py | 4 ++-- src/cpl_cli/_templates/new/library/source/name/__init__.py | 4 ++-- src/cpl_cli/_templates/new/library/source/tests/__init__.py | 4 ++-- src/cpl_cli/_templates/publish/__init__.py | 4 ++-- src/cpl_cli/command/__init__.py | 4 ++-- src/cpl_cli/configuration/__init__.py | 4 ++-- src/cpl_cli/cpl_cli.json | 2 +- src/cpl_cli/live_server/__init__.py | 4 ++-- src/cpl_cli/publish/__init__.py | 4 ++-- src/cpl_cli/source_creator/__init__.py | 4 ++-- src/cpl_core/__init__.py | 4 ++-- src/cpl_core/application/__init__.py | 4 ++-- src/cpl_core/configuration/__init__.py | 4 ++-- src/cpl_core/console/__init__.py | 4 ++-- src/cpl_core/cpl_core.json | 2 +- src/cpl_core/database/__init__.py | 4 ++-- src/cpl_core/database/connection/__init__.py | 4 ++-- src/cpl_core/database/context/__init__.py | 4 ++-- src/cpl_core/dependency_injection/__init__.py | 4 ++-- src/cpl_core/environment/__init__.py | 4 ++-- src/cpl_core/logging/__init__.py | 4 ++-- src/cpl_core/mailing/__init__.py | 4 ++-- src/cpl_core/time/__init__.py | 4 ++-- src/cpl_core/utils/__init__.py | 4 ++-- src/cpl_query/__init__.py | 4 ++-- src/cpl_query/_query/__init__.py | 4 ++-- src/cpl_query/cpl_query.json | 2 +- src/cpl_query/extension/__init__.py | 4 ++-- 38 files changed, 73 insertions(+), 73 deletions(-) diff --git a/src/cpl_cli/__init__.py b/src/cpl_cli/__init__.py index a41f8aa4..7af49608 100644 --- a/src/cpl_cli/__init__.py +++ b/src/cpl_cli/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_cli' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.0.post2' +__version__ = '2021.10.2' from collections import namedtuple @@ -29,4 +29,4 @@ from .main import main from .startup import Startup VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='0.post2') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_cli/_templates/__init__.py b/src/cpl_cli/_templates/__init__.py index 23e26afd..b3432fda 100644 --- a/src/cpl_cli/_templates/__init__.py +++ b/src/cpl_cli/_templates/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.0.post2' +__version__ = '2021.10.2' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='0.post2') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_cli/_templates/build/__init__.py b/src/cpl_cli/_templates/build/__init__.py index 87ba591a..2f641018 100644 --- a/src/cpl_cli/_templates/build/__init__.py +++ b/src/cpl_cli/_templates/build/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.build' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.0.post2' +__version__ = '2021.10.2' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='0.post2') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_cli/_templates/generate/__init__.py b/src/cpl_cli/_templates/generate/__init__.py index 709468e6..a625e275 100644 --- a/src/cpl_cli/_templates/generate/__init__.py +++ b/src/cpl_cli/_templates/generate/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.generate' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.0.post2' +__version__ = '2021.10.2' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='0.post2') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_cli/_templates/new/__init__.py b/src/cpl_cli/_templates/new/__init__.py index 051fc98d..ded8c8ed 100644 --- a/src/cpl_cli/_templates/new/__init__.py +++ b/src/cpl_cli/_templates/new/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.0.post2' +__version__ = '2021.10.2' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='0.post2') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_cli/_templates/new/console/__init__.py b/src/cpl_cli/_templates/new/console/__init__.py index 59b3978e..2ed4ea3c 100644 --- a/src/cpl_cli/_templates/new/console/__init__.py +++ b/src/cpl_cli/_templates/new/console/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.console' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.0.post2' +__version__ = '2021.10.2' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='0.post2') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_cli/_templates/new/console/source/__init__.py b/src/cpl_cli/_templates/new/console/source/__init__.py index 902d06b6..a567a195 100644 --- a/src/cpl_cli/_templates/new/console/source/__init__.py +++ b/src/cpl_cli/_templates/new/console/source/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.console.source' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.0.post2' +__version__ = '2021.10.2' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='0.post2') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_cli/_templates/new/console/source/name/__init__.py b/src/cpl_cli/_templates/new/console/source/name/__init__.py index 3d600851..8200673b 100644 --- a/src/cpl_cli/_templates/new/console/source/name/__init__.py +++ b/src/cpl_cli/_templates/new/console/source/name/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.console.source.name' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.0.post2' +__version__ = '2021.10.2' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='0.post2') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_cli/_templates/new/console/source/tests/__init__.py b/src/cpl_cli/_templates/new/console/source/tests/__init__.py index 25a28712..551c83cb 100644 --- a/src/cpl_cli/_templates/new/console/source/tests/__init__.py +++ b/src/cpl_cli/_templates/new/console/source/tests/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.console.source.tests' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.0.post2' +__version__ = '2021.10.2' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='0.post2') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_cli/_templates/new/library/__init__.py b/src/cpl_cli/_templates/new/library/__init__.py index 1502f27a..2c3ea082 100644 --- a/src/cpl_cli/_templates/new/library/__init__.py +++ b/src/cpl_cli/_templates/new/library/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.library' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.0.post2' +__version__ = '2021.10.2' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='0.post2') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_cli/_templates/new/library/source/__init__.py b/src/cpl_cli/_templates/new/library/source/__init__.py index 481822a5..da92f04f 100644 --- a/src/cpl_cli/_templates/new/library/source/__init__.py +++ b/src/cpl_cli/_templates/new/library/source/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.library.source' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.0.post2' +__version__ = '2021.10.2' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='0.post2') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_cli/_templates/new/library/source/name/__init__.py b/src/cpl_cli/_templates/new/library/source/name/__init__.py index c8d298a9..f6edde16 100644 --- a/src/cpl_cli/_templates/new/library/source/name/__init__.py +++ b/src/cpl_cli/_templates/new/library/source/name/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.library.source.name' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.0.post2' +__version__ = '2021.10.2' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='0.post2') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_cli/_templates/new/library/source/tests/__init__.py b/src/cpl_cli/_templates/new/library/source/tests/__init__.py index a33f5636..509ba102 100644 --- a/src/cpl_cli/_templates/new/library/source/tests/__init__.py +++ b/src/cpl_cli/_templates/new/library/source/tests/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.library.source.tests' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.0.post2' +__version__ = '2021.10.2' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='0.post2') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_cli/_templates/publish/__init__.py b/src/cpl_cli/_templates/publish/__init__.py index da1ca6e5..ef3ffab3 100644 --- a/src/cpl_cli/_templates/publish/__init__.py +++ b/src/cpl_cli/_templates/publish/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.publish' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.0.post2' +__version__ = '2021.10.2' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='0.post2') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_cli/command/__init__.py b/src/cpl_cli/command/__init__.py index 9f98f2e9..ca2ad5c7 100644 --- a/src/cpl_cli/command/__init__.py +++ b/src/cpl_cli/command/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_cli.command' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.0.post2' +__version__ = '2021.10.2' from collections import namedtuple @@ -28,4 +28,4 @@ from .publish_service import PublishService from .version_service import VersionService VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='0.post2') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_cli/configuration/__init__.py b/src/cpl_cli/configuration/__init__.py index 5246ba36..856d8c5d 100644 --- a/src/cpl_cli/configuration/__init__.py +++ b/src/cpl_cli/configuration/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_cli.configuration' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.0.post2' +__version__ = '2021.10.2' from collections import namedtuple @@ -30,4 +30,4 @@ from .workspace_settings import WorkspaceSettings from .workspace_settings_name_enum import WorkspaceSettingsNameEnum VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='0.post2') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_cli/cpl_cli.json b/src/cpl_cli/cpl_cli.json index 46a24f73..aebc9fe6 100644 --- a/src/cpl_cli/cpl_cli.json +++ b/src/cpl_cli/cpl_cli.json @@ -4,7 +4,7 @@ "Version": { "Major": "2021", "Minor": "10", - "Micro": "0.post2" + "Micro": "2" }, "Author": "Sven Heidemann", "AuthorEmail": "sven.heidemann@sh-edraft.de", diff --git a/src/cpl_cli/live_server/__init__.py b/src/cpl_cli/live_server/__init__.py index b3702f3e..c414dac3 100644 --- a/src/cpl_cli/live_server/__init__.py +++ b/src/cpl_cli/live_server/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli.live_server' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.0.post2' +__version__ = '2021.10.2' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='0.post2') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_cli/publish/__init__.py b/src/cpl_cli/publish/__init__.py index 11e9de30..b62f9083 100644 --- a/src/cpl_cli/publish/__init__.py +++ b/src/cpl_cli/publish/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_cli.publish' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.0.post2' +__version__ = '2021.10.2' from collections import namedtuple @@ -24,4 +24,4 @@ from .publisher_abc import PublisherABC from .publisher_service import PublisherService VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='0.post2') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_cli/source_creator/__init__.py b/src/cpl_cli/source_creator/__init__.py index 49b7b6ad..4c8d75f1 100644 --- a/src/cpl_cli/source_creator/__init__.py +++ b/src/cpl_cli/source_creator/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli.source_creator' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.0.post2' +__version__ = '2021.10.2' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='0.post2') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_core/__init__.py b/src/cpl_core/__init__.py index c99c48d6..3ae3e50a 100644 --- a/src/cpl_core/__init__.py +++ b/src/cpl_core/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_core' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.0.post1' +__version__ = '2021.10.1' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='0.post1') +version_info = VersionInfo(major='2021', minor='10', micro='1') diff --git a/src/cpl_core/application/__init__.py b/src/cpl_core/application/__init__.py index 849c5f96..8e7ec3ae 100644 --- a/src/cpl_core/application/__init__.py +++ b/src/cpl_core/application/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.application' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.0.post1' +__version__ = '2021.10.1' from collections import namedtuple @@ -26,4 +26,4 @@ from .application_builder_abc import ApplicationBuilderABC from .startup_abc import StartupABC VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='0.post1') +version_info = VersionInfo(major='2021', minor='10', micro='1') diff --git a/src/cpl_core/configuration/__init__.py b/src/cpl_core/configuration/__init__.py index 1051f82e..69514d21 100644 --- a/src/cpl_core/configuration/__init__.py +++ b/src/cpl_core/configuration/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.configuration' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.0.post1' +__version__ = '2021.10.1' from collections import namedtuple @@ -27,4 +27,4 @@ from .configuration_variable_name_enum import ConfigurationVariableNameEnum from .console_argument import ConsoleArgument VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='0.post1') +version_info = VersionInfo(major='2021', minor='10', micro='1') diff --git a/src/cpl_core/console/__init__.py b/src/cpl_core/console/__init__.py index 80fa8c2c..82b6aaa2 100644 --- a/src/cpl_core/console/__init__.py +++ b/src/cpl_core/console/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.console' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.0.post1' +__version__ = '2021.10.1' from collections import namedtuple @@ -27,4 +27,4 @@ from .foreground_color_enum import ForegroundColorEnum from .spinner_thread import SpinnerThread VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='0.post1') +version_info = VersionInfo(major='2021', minor='10', micro='1') diff --git a/src/cpl_core/cpl_core.json b/src/cpl_core/cpl_core.json index ac7c4bc7..37d26d65 100644 --- a/src/cpl_core/cpl_core.json +++ b/src/cpl_core/cpl_core.json @@ -4,7 +4,7 @@ "Version": { "Major": "2021", "Minor": "10", - "Micro": "0.post1" + "Micro": "1" }, "Author": "Sven Heidemann", "AuthorEmail": "sven.heidemann@sh-edraft.de", diff --git a/src/cpl_core/database/__init__.py b/src/cpl_core/database/__init__.py index b1d37377..d31b033f 100644 --- a/src/cpl_core/database/__init__.py +++ b/src/cpl_core/database/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.database' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.0.post1' +__version__ = '2021.10.1' from collections import namedtuple @@ -25,4 +25,4 @@ from .database_settings import DatabaseSettings from .database_settings_name_enum import DatabaseSettingsNameEnum VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='0.post1') +version_info = VersionInfo(major='2021', minor='10', micro='1') diff --git a/src/cpl_core/database/connection/__init__.py b/src/cpl_core/database/connection/__init__.py index aad523aa..c4e4924c 100644 --- a/src/cpl_core/database/connection/__init__.py +++ b/src/cpl_core/database/connection/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.database.connection' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.0.post1' +__version__ = '2021.10.1' from collections import namedtuple @@ -24,4 +24,4 @@ from .database_connection import DatabaseConnection from .database_connection_abc import DatabaseConnectionABC VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='0.post1') +version_info = VersionInfo(major='2021', minor='10', micro='1') diff --git a/src/cpl_core/database/context/__init__.py b/src/cpl_core/database/context/__init__.py index ad43877e..b3971161 100644 --- a/src/cpl_core/database/context/__init__.py +++ b/src/cpl_core/database/context/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.database.context' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.0.post1' +__version__ = '2021.10.1' from collections import namedtuple @@ -24,4 +24,4 @@ from .database_context import DatabaseContext from .database_context_abc import DatabaseContextABC VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='0.post1') +version_info = VersionInfo(major='2021', minor='10', micro='1') diff --git a/src/cpl_core/dependency_injection/__init__.py b/src/cpl_core/dependency_injection/__init__.py index 4134e74e..d856e514 100644 --- a/src/cpl_core/dependency_injection/__init__.py +++ b/src/cpl_core/dependency_injection/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.dependency_injection' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.0.post1' +__version__ = '2021.10.1' from collections import namedtuple @@ -28,4 +28,4 @@ from .service_provider import ServiceProvider from .service_provider_abc import ServiceProviderABC VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='0.post1') +version_info = VersionInfo(major='2021', minor='10', micro='1') diff --git a/src/cpl_core/environment/__init__.py b/src/cpl_core/environment/__init__.py index 7ad5213f..41ac5dc8 100644 --- a/src/cpl_core/environment/__init__.py +++ b/src/cpl_core/environment/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.environment' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.0.post1' +__version__ = '2021.10.1' from collections import namedtuple @@ -25,4 +25,4 @@ from .environment_name_enum import EnvironmentNameEnum from .application_environment import ApplicationEnvironment VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='0.post1') +version_info = VersionInfo(major='2021', minor='10', micro='1') diff --git a/src/cpl_core/logging/__init__.py b/src/cpl_core/logging/__init__.py index 699b65be..7f7d1459 100644 --- a/src/cpl_core/logging/__init__.py +++ b/src/cpl_core/logging/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.logging' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.0.post1' +__version__ = '2021.10.1' from collections import namedtuple @@ -27,4 +27,4 @@ from .logging_settings import LoggingSettings from .logging_settings_name_enum import LoggingSettingsNameEnum VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='0.post1') +version_info = VersionInfo(major='2021', minor='10', micro='1') diff --git a/src/cpl_core/mailing/__init__.py b/src/cpl_core/mailing/__init__.py index 254418aa..213fae84 100644 --- a/src/cpl_core/mailing/__init__.py +++ b/src/cpl_core/mailing/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.mailing' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.0.post1' +__version__ = '2021.10.1' from collections import namedtuple @@ -27,4 +27,4 @@ from .email_client_settings import EMailClientSettings from .email_client_settings_name_enum import EMailClientSettingsNameEnum VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='0.post1') +version_info = VersionInfo(major='2021', minor='10', micro='1') diff --git a/src/cpl_core/time/__init__.py b/src/cpl_core/time/__init__.py index 17a7e074..27264ade 100644 --- a/src/cpl_core/time/__init__.py +++ b/src/cpl_core/time/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.time' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.0.post1' +__version__ = '2021.10.1' from collections import namedtuple @@ -24,4 +24,4 @@ from .time_format_settings import TimeFormatSettings from .time_format_settings_names_enum import TimeFormatSettingsNamesEnum VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='0.post1') +version_info = VersionInfo(major='2021', minor='10', micro='1') diff --git a/src/cpl_core/utils/__init__.py b/src/cpl_core/utils/__init__.py index fa6b1356..1211ab93 100644 --- a/src/cpl_core/utils/__init__.py +++ b/src/cpl_core/utils/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.utils' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.0.post1' +__version__ = '2021.10.1' from collections import namedtuple @@ -25,4 +25,4 @@ from .string import String from .pip import Pip VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='0.post1') +version_info = VersionInfo(major='2021', minor='10', micro='1') diff --git a/src/cpl_query/__init__.py b/src/cpl_query/__init__.py index d3ef1b09..ef54e889 100644 --- a/src/cpl_query/__init__.py +++ b/src/cpl_query/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_query' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.0.post2' +__version__ = '2021.10.2' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='0.post2') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_query/_query/__init__.py b/src/cpl_query/_query/__init__.py index 79724b22..3ee45ca0 100644 --- a/src/cpl_query/_query/__init__.py +++ b/src/cpl_query/_query/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_query._query' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.0.post2' +__version__ = '2021.10.2' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='0.post2') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_query/cpl_query.json b/src/cpl_query/cpl_query.json index 798e68cf..765673d5 100644 --- a/src/cpl_query/cpl_query.json +++ b/src/cpl_query/cpl_query.json @@ -4,7 +4,7 @@ "Version": { "Major": "2021", "Minor": "10", - "Micro": "0.post2" + "Micro": "2" }, "Author": "Sven Heidemann", "AuthorEmail": "sven.heidemann@sh-edraft.de", diff --git a/src/cpl_query/extension/__init__.py b/src/cpl_query/extension/__init__.py index 9c67140c..85829aa5 100644 --- a/src/cpl_query/extension/__init__.py +++ b/src/cpl_query/extension/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_query.extension' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.0.post2' +__version__ = '2021.10.2' from collections import namedtuple @@ -27,4 +27,4 @@ from .ordered_iterable_abc import OrderedIterableABC from .ordered_iterable import OrderedIterable VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='0.post2') +version_info = VersionInfo(major='2021', minor='10', micro='2') From c3b48bfa41480b9990b799f7c2710e572702f999 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Sun, 14 Nov 2021 09:55:27 +0100 Subject: [PATCH 2/7] Changed version --- src/cpl_core/__init__.py | 4 ++-- src/cpl_core/application/__init__.py | 4 ++-- src/cpl_core/configuration/__init__.py | 4 ++-- src/cpl_core/console/__init__.py | 4 ++-- src/cpl_core/cpl_core.json | 2 +- src/cpl_core/database/__init__.py | 4 ++-- src/cpl_core/database/connection/__init__.py | 4 ++-- src/cpl_core/database/context/__init__.py | 4 ++-- src/cpl_core/dependency_injection/__init__.py | 4 ++-- src/cpl_core/environment/__init__.py | 4 ++-- src/cpl_core/logging/__init__.py | 4 ++-- src/cpl_core/mailing/__init__.py | 4 ++-- src/cpl_core/time/__init__.py | 4 ++-- src/cpl_core/utils/__init__.py | 4 ++-- 14 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/cpl_core/__init__.py b/src/cpl_core/__init__.py index 3ae3e50a..cc2c14d4 100644 --- a/src/cpl_core/__init__.py +++ b/src/cpl_core/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_core' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.1' +__version__ = '2021.10.2' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='1') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_core/application/__init__.py b/src/cpl_core/application/__init__.py index 8e7ec3ae..5fff70e4 100644 --- a/src/cpl_core/application/__init__.py +++ b/src/cpl_core/application/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.application' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.1' +__version__ = '2021.10.2' from collections import namedtuple @@ -26,4 +26,4 @@ from .application_builder_abc import ApplicationBuilderABC from .startup_abc import StartupABC VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='1') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_core/configuration/__init__.py b/src/cpl_core/configuration/__init__.py index 69514d21..cdc6d8fb 100644 --- a/src/cpl_core/configuration/__init__.py +++ b/src/cpl_core/configuration/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.configuration' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.1' +__version__ = '2021.10.2' from collections import namedtuple @@ -27,4 +27,4 @@ from .configuration_variable_name_enum import ConfigurationVariableNameEnum from .console_argument import ConsoleArgument VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='1') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_core/console/__init__.py b/src/cpl_core/console/__init__.py index 82b6aaa2..1f58a666 100644 --- a/src/cpl_core/console/__init__.py +++ b/src/cpl_core/console/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.console' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.1' +__version__ = '2021.10.2' from collections import namedtuple @@ -27,4 +27,4 @@ from .foreground_color_enum import ForegroundColorEnum from .spinner_thread import SpinnerThread VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='1') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_core/cpl_core.json b/src/cpl_core/cpl_core.json index 37d26d65..281eade8 100644 --- a/src/cpl_core/cpl_core.json +++ b/src/cpl_core/cpl_core.json @@ -4,7 +4,7 @@ "Version": { "Major": "2021", "Minor": "10", - "Micro": "1" + "Micro": "2" }, "Author": "Sven Heidemann", "AuthorEmail": "sven.heidemann@sh-edraft.de", diff --git a/src/cpl_core/database/__init__.py b/src/cpl_core/database/__init__.py index d31b033f..ef74818f 100644 --- a/src/cpl_core/database/__init__.py +++ b/src/cpl_core/database/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.database' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.1' +__version__ = '2021.10.2' from collections import namedtuple @@ -25,4 +25,4 @@ from .database_settings import DatabaseSettings from .database_settings_name_enum import DatabaseSettingsNameEnum VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='1') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_core/database/connection/__init__.py b/src/cpl_core/database/connection/__init__.py index c4e4924c..79ce0bda 100644 --- a/src/cpl_core/database/connection/__init__.py +++ b/src/cpl_core/database/connection/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.database.connection' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.1' +__version__ = '2021.10.2' from collections import namedtuple @@ -24,4 +24,4 @@ from .database_connection import DatabaseConnection from .database_connection_abc import DatabaseConnectionABC VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='1') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_core/database/context/__init__.py b/src/cpl_core/database/context/__init__.py index b3971161..1e50ac49 100644 --- a/src/cpl_core/database/context/__init__.py +++ b/src/cpl_core/database/context/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.database.context' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.1' +__version__ = '2021.10.2' from collections import namedtuple @@ -24,4 +24,4 @@ from .database_context import DatabaseContext from .database_context_abc import DatabaseContextABC VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='1') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_core/dependency_injection/__init__.py b/src/cpl_core/dependency_injection/__init__.py index d856e514..8082ec47 100644 --- a/src/cpl_core/dependency_injection/__init__.py +++ b/src/cpl_core/dependency_injection/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.dependency_injection' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.1' +__version__ = '2021.10.2' from collections import namedtuple @@ -28,4 +28,4 @@ from .service_provider import ServiceProvider from .service_provider_abc import ServiceProviderABC VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='1') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_core/environment/__init__.py b/src/cpl_core/environment/__init__.py index 41ac5dc8..e6a4566b 100644 --- a/src/cpl_core/environment/__init__.py +++ b/src/cpl_core/environment/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.environment' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.1' +__version__ = '2021.10.2' from collections import namedtuple @@ -25,4 +25,4 @@ from .environment_name_enum import EnvironmentNameEnum from .application_environment import ApplicationEnvironment VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='1') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_core/logging/__init__.py b/src/cpl_core/logging/__init__.py index 7f7d1459..d83cf52e 100644 --- a/src/cpl_core/logging/__init__.py +++ b/src/cpl_core/logging/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.logging' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.1' +__version__ = '2021.10.2' from collections import namedtuple @@ -27,4 +27,4 @@ from .logging_settings import LoggingSettings from .logging_settings_name_enum import LoggingSettingsNameEnum VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='1') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_core/mailing/__init__.py b/src/cpl_core/mailing/__init__.py index 213fae84..796a331c 100644 --- a/src/cpl_core/mailing/__init__.py +++ b/src/cpl_core/mailing/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.mailing' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.1' +__version__ = '2021.10.2' from collections import namedtuple @@ -27,4 +27,4 @@ from .email_client_settings import EMailClientSettings from .email_client_settings_name_enum import EMailClientSettingsNameEnum VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='1') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_core/time/__init__.py b/src/cpl_core/time/__init__.py index 27264ade..59e79f3e 100644 --- a/src/cpl_core/time/__init__.py +++ b/src/cpl_core/time/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.time' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.1' +__version__ = '2021.10.2' from collections import namedtuple @@ -24,4 +24,4 @@ from .time_format_settings import TimeFormatSettings from .time_format_settings_names_enum import TimeFormatSettingsNamesEnum VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='1') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_core/utils/__init__.py b/src/cpl_core/utils/__init__.py index 1211ab93..15c224f2 100644 --- a/src/cpl_core/utils/__init__.py +++ b/src/cpl_core/utils/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.utils' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.1' +__version__ = '2021.10.2' from collections import namedtuple @@ -25,4 +25,4 @@ from .string import String from .pip import Pip VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='1') +version_info = VersionInfo(major='2021', minor='10', micro='2') From 7749d5a789ffa506520f3261873c594e82ad02c0 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Sun, 14 Nov 2021 10:04:32 +0100 Subject: [PATCH 3/7] Moved tests to src & added add scoped logic --- src/cpl_core/dependency_injection/service_collection.py | 8 ++++++-- src/cpl_core/dependency_injection/service_provider.py | 4 ++-- src/cpl_core/dependency_injection/service_provider_abc.py | 2 +- src/{cpl_cli => }/tests/__init__.py | 0 src/{cpl_cli => }/tests/custom/console/main.py | 0 src/{cpl_cli => }/tests/custom/database/LICENSE | 0 src/{cpl_cli => }/tests/custom/database/README.md | 0 .../tests/custom/database/appsettings.development.json | 0 .../tests/custom/database/appsettings.edrafts-lapi.json | 0 .../tests/custom/database/appsettings.edrafts-pc.json | 0 src/{cpl_cli => }/tests/custom/database/appsettings.json | 0 src/{cpl_cli => }/tests/custom/database/cpl.json | 0 .../tests/custom/database/src/application.py | 0 src/{cpl_cli => }/tests/custom/database/src/main.py | 0 .../tests/custom/database/src/model/__init__.py | 0 .../tests/custom/database/src/model/city_model.py | 0 .../tests/custom/database/src/model/db_context.py | 0 .../tests/custom/database/src/model/user_model.py | 0 .../tests/custom/database/src/model/user_repo.py | 0 .../tests/custom/database/src/model/user_repo_abc.py | 0 src/{cpl_cli => }/tests/custom/database/src/startup.py | 0 .../tests/custom/database/src/tests/__init__.py | 0 src/{cpl_cli => }/tests/custom/general/cpl-workspace.json | 0 .../tests/custom/general/src/general/application.py | 0 .../general/src/general/appsettings.development.json | 0 .../general/src/general/appsettings.edrafts-lapi.json | 0 .../general/src/general/appsettings.edrafts-pc.json | 0 .../tests/custom/general/src/general/appsettings.json | 0 .../tests/custom/general/src/general/db/__init__.py | 0 .../tests/custom/general/src/general/general.json | 0 .../tests/custom/general/src/general/main.py | 0 .../tests/custom/general/src/general/startup.py | 0 .../tests/custom/general/src/general/test_extension.py | 0 .../tests/custom/general/src/general/test_service.py | 0 src/{cpl_cli => }/tests/generated/simple-app/LICENSE | 0 src/{cpl_cli => }/tests/generated/simple-app/README.md | 0 .../tests/generated/simple-app/appsettings.json | 0 .../tests/generated/simple-app/cpl-workspace.json | 0 src/{cpl_cli => }/tests/generated/simple-app/cpl.json | 0 .../tests/generated/simple-app/src/application.py | 0 src/{cpl_cli => }/tests/generated/simple-app/src/main.py | 0 .../tests/generated/simple-app/src/simple_app/__init__.py | 0 .../generated/simple-app/src/simple_app/application.py | 0 .../tests/generated/simple-app/src/simple_app/main.py | 0 .../generated/simple-app/src/simple_app/simple-app.json | 0 .../tests/generated/simple-app/src/tests/__init__.py | 0 src/{cpl_cli => }/tests/generated/simple-console/LICENSE | 0 .../tests/generated/simple-console/README.md | 0 .../tests/generated/simple-console/appsettings.json | 0 .../tests/generated/simple-console/cpl-workspace.json | 0 src/{cpl_cli => }/tests/generated/simple-console/cpl.json | 0 .../tests/generated/simple-console/src/main.py | 0 .../simple-console/src/simple_console/__init__.py | 0 .../generated/simple-console/src/simple_console/main.py | 0 .../simple-console/src/simple_console/simple-console.json | 0 .../tests/generated/simple-console/src/tests/__init__.py | 0 src/{cpl_cli => }/tests/generated/simple-di/LICENSE | 0 src/{cpl_cli => }/tests/generated/simple-di/README.md | 0 .../tests/generated/simple-di/appsettings.json | 0 .../tests/generated/simple-di/cpl-workspace.json | 0 src/{cpl_cli => }/tests/generated/simple-di/cpl.json | 0 src/{cpl_cli => }/tests/generated/simple-di/src/main.py | 0 .../tests/generated/simple-di/src/simple_di/__init__.py | 0 .../tests/generated/simple-di/src/simple_di/main.py | 0 .../generated/simple-di/src/simple_di/simple-di.json | 0 .../tests/generated/simple-di/src/tests/__init__.py | 0 .../tests/generated/simple-startup-app/LICENSE | 0 .../tests/generated/simple-startup-app/README.md | 0 .../tests/generated/simple-startup-app/appsettings.json | 0 .../tests/generated/simple-startup-app/cpl-workspace.json | 0 .../simple-startup-app/src/simple_startup_app/__init__.py | 0 .../src/simple_startup_app/application.py | 0 .../simple-startup-app/src/simple_startup_app/main.py | 0 .../src/simple_startup_app/simple-startup-app.json | 0 .../simple-startup-app/src/simple_startup_app/startup.py | 0 .../generated/simple-startup-app/src/tests/__init__.py | 0 src/{cpl_cli => }/tests/generated/startup-app/LICENSE | 0 src/{cpl_cli => }/tests/generated/startup-app/README.md | 0 src/{cpl_cli => }/tests/generated/startup-app/cpl.json | 0 .../tests/generated/startup-app/src/application.py | 0 src/{cpl_cli => }/tests/generated/startup-app/src/main.py | 0 .../tests/generated/startup-app/src/startup.py | 0 .../tests/generated/startup-app/src/tests/__init__.py | 0 83 files changed, 9 insertions(+), 5 deletions(-) rename src/{cpl_cli => }/tests/__init__.py (100%) rename src/{cpl_cli => }/tests/custom/console/main.py (100%) rename src/{cpl_cli => }/tests/custom/database/LICENSE (100%) rename src/{cpl_cli => }/tests/custom/database/README.md (100%) rename src/{cpl_cli => }/tests/custom/database/appsettings.development.json (100%) rename src/{cpl_cli => }/tests/custom/database/appsettings.edrafts-lapi.json (100%) rename src/{cpl_cli => }/tests/custom/database/appsettings.edrafts-pc.json (100%) rename src/{cpl_cli => }/tests/custom/database/appsettings.json (100%) rename src/{cpl_cli => }/tests/custom/database/cpl.json (100%) rename src/{cpl_cli => }/tests/custom/database/src/application.py (100%) rename src/{cpl_cli => }/tests/custom/database/src/main.py (100%) rename src/{cpl_cli => }/tests/custom/database/src/model/__init__.py (100%) rename src/{cpl_cli => }/tests/custom/database/src/model/city_model.py (100%) rename src/{cpl_cli => }/tests/custom/database/src/model/db_context.py (100%) rename src/{cpl_cli => }/tests/custom/database/src/model/user_model.py (100%) rename src/{cpl_cli => }/tests/custom/database/src/model/user_repo.py (100%) rename src/{cpl_cli => }/tests/custom/database/src/model/user_repo_abc.py (100%) rename src/{cpl_cli => }/tests/custom/database/src/startup.py (100%) rename src/{cpl_cli => }/tests/custom/database/src/tests/__init__.py (100%) rename src/{cpl_cli => }/tests/custom/general/cpl-workspace.json (100%) rename src/{cpl_cli => }/tests/custom/general/src/general/application.py (100%) rename src/{cpl_cli => }/tests/custom/general/src/general/appsettings.development.json (100%) rename src/{cpl_cli => }/tests/custom/general/src/general/appsettings.edrafts-lapi.json (100%) rename src/{cpl_cli => }/tests/custom/general/src/general/appsettings.edrafts-pc.json (100%) rename src/{cpl_cli => }/tests/custom/general/src/general/appsettings.json (100%) rename src/{cpl_cli => }/tests/custom/general/src/general/db/__init__.py (100%) rename src/{cpl_cli => }/tests/custom/general/src/general/general.json (100%) rename src/{cpl_cli => }/tests/custom/general/src/general/main.py (100%) rename src/{cpl_cli => }/tests/custom/general/src/general/startup.py (100%) rename src/{cpl_cli => }/tests/custom/general/src/general/test_extension.py (100%) rename src/{cpl_cli => }/tests/custom/general/src/general/test_service.py (100%) rename src/{cpl_cli => }/tests/generated/simple-app/LICENSE (100%) rename src/{cpl_cli => }/tests/generated/simple-app/README.md (100%) rename src/{cpl_cli => }/tests/generated/simple-app/appsettings.json (100%) rename src/{cpl_cli => }/tests/generated/simple-app/cpl-workspace.json (100%) rename src/{cpl_cli => }/tests/generated/simple-app/cpl.json (100%) rename src/{cpl_cli => }/tests/generated/simple-app/src/application.py (100%) rename src/{cpl_cli => }/tests/generated/simple-app/src/main.py (100%) rename src/{cpl_cli => }/tests/generated/simple-app/src/simple_app/__init__.py (100%) rename src/{cpl_cli => }/tests/generated/simple-app/src/simple_app/application.py (100%) rename src/{cpl_cli => }/tests/generated/simple-app/src/simple_app/main.py (100%) rename src/{cpl_cli => }/tests/generated/simple-app/src/simple_app/simple-app.json (100%) rename src/{cpl_cli => }/tests/generated/simple-app/src/tests/__init__.py (100%) rename src/{cpl_cli => }/tests/generated/simple-console/LICENSE (100%) rename src/{cpl_cli => }/tests/generated/simple-console/README.md (100%) rename src/{cpl_cli => }/tests/generated/simple-console/appsettings.json (100%) rename src/{cpl_cli => }/tests/generated/simple-console/cpl-workspace.json (100%) rename src/{cpl_cli => }/tests/generated/simple-console/cpl.json (100%) rename src/{cpl_cli => }/tests/generated/simple-console/src/main.py (100%) rename src/{cpl_cli => }/tests/generated/simple-console/src/simple_console/__init__.py (100%) rename src/{cpl_cli => }/tests/generated/simple-console/src/simple_console/main.py (100%) rename src/{cpl_cli => }/tests/generated/simple-console/src/simple_console/simple-console.json (100%) rename src/{cpl_cli => }/tests/generated/simple-console/src/tests/__init__.py (100%) rename src/{cpl_cli => }/tests/generated/simple-di/LICENSE (100%) rename src/{cpl_cli => }/tests/generated/simple-di/README.md (100%) rename src/{cpl_cli => }/tests/generated/simple-di/appsettings.json (100%) rename src/{cpl_cli => }/tests/generated/simple-di/cpl-workspace.json (100%) rename src/{cpl_cli => }/tests/generated/simple-di/cpl.json (100%) rename src/{cpl_cli => }/tests/generated/simple-di/src/main.py (100%) rename src/{cpl_cli => }/tests/generated/simple-di/src/simple_di/__init__.py (100%) rename src/{cpl_cli => }/tests/generated/simple-di/src/simple_di/main.py (100%) rename src/{cpl_cli => }/tests/generated/simple-di/src/simple_di/simple-di.json (100%) rename src/{cpl_cli => }/tests/generated/simple-di/src/tests/__init__.py (100%) rename src/{cpl_cli => }/tests/generated/simple-startup-app/LICENSE (100%) rename src/{cpl_cli => }/tests/generated/simple-startup-app/README.md (100%) rename src/{cpl_cli => }/tests/generated/simple-startup-app/appsettings.json (100%) rename src/{cpl_cli => }/tests/generated/simple-startup-app/cpl-workspace.json (100%) rename src/{cpl_cli => }/tests/generated/simple-startup-app/src/simple_startup_app/__init__.py (100%) rename src/{cpl_cli => }/tests/generated/simple-startup-app/src/simple_startup_app/application.py (100%) rename src/{cpl_cli => }/tests/generated/simple-startup-app/src/simple_startup_app/main.py (100%) rename src/{cpl_cli => }/tests/generated/simple-startup-app/src/simple_startup_app/simple-startup-app.json (100%) rename src/{cpl_cli => }/tests/generated/simple-startup-app/src/simple_startup_app/startup.py (100%) rename src/{cpl_cli => }/tests/generated/simple-startup-app/src/tests/__init__.py (100%) rename src/{cpl_cli => }/tests/generated/startup-app/LICENSE (100%) rename src/{cpl_cli => }/tests/generated/startup-app/README.md (100%) rename src/{cpl_cli => }/tests/generated/startup-app/cpl.json (100%) rename src/{cpl_cli => }/tests/generated/startup-app/src/application.py (100%) rename src/{cpl_cli => }/tests/generated/startup-app/src/main.py (100%) rename src/{cpl_cli => }/tests/generated/startup-app/src/startup.py (100%) rename src/{cpl_cli => }/tests/generated/startup-app/src/tests/__init__.py (100%) diff --git a/src/cpl_core/dependency_injection/service_collection.py b/src/cpl_core/dependency_injection/service_collection.py index d5837f4b..55e00156 100644 --- a/src/cpl_core/dependency_injection/service_collection.py +++ b/src/cpl_core/dependency_injection/service_collection.py @@ -59,9 +59,13 @@ class ServiceCollection(ServiceCollectionABC): self._add_descriptor(impl, ServiceLifetimeEnum.singleton) def add_scoped(self, service_type: Type, service: Callable = None): - raise Exception('Not implemented') + if service is not None: + self._add_descriptor(service, ServiceLifetimeEnum.scoped) + else: + self._add_descriptor(service_type, ServiceLifetimeEnum.scoped) + - def add_transient(self, service_type: Union[type], service: Union[type] = None): + def add_transient(self, service_type: type, service: type = None): if service is not None: self._add_descriptor(service, ServiceLifetimeEnum.transient) else: diff --git a/src/cpl_core/dependency_injection/service_provider.py b/src/cpl_core/dependency_injection/service_provider.py index 6357716d..cf079d83 100644 --- a/src/cpl_core/dependency_injection/service_provider.py +++ b/src/cpl_core/dependency_injection/service_provider.py @@ -31,7 +31,7 @@ class ServiceProvider(ServiceProviderABC): self._configuration: ConfigurationABC = config self._database_context = db_context - def _find_service(self, service_type: type) -> [ServiceDescriptor]: + def _find_service(self, service_type: type) -> ServiceDescriptor: for descriptor in self._service_descriptors: if descriptor.service_type == service_type or issubclass(descriptor.service_type, service_type): return descriptor @@ -85,7 +85,7 @@ class ServiceProvider(ServiceProviderABC): return service_type(*params) - def get_service(self, service_type: type) -> Optional[Callable[object]]: + def get_service(self, service_type: type) -> Optional[Callable]: result = self._find_service(service_type) if result is None: diff --git a/src/cpl_core/dependency_injection/service_provider_abc.py b/src/cpl_core/dependency_injection/service_provider_abc.py index 507deb21..6c64a4e3 100644 --- a/src/cpl_core/dependency_injection/service_provider_abc.py +++ b/src/cpl_core/dependency_injection/service_provider_abc.py @@ -26,7 +26,7 @@ class ServiceProviderABC(ABC): pass @abstractmethod - def get_service(self, instance_type: Type) -> Optional[Callable[object]]: + def get_service(self, instance_type: Type) -> Optional[Callable]: r"""Returns instance of given type Parameter diff --git a/src/cpl_cli/tests/__init__.py b/src/tests/__init__.py similarity index 100% rename from src/cpl_cli/tests/__init__.py rename to src/tests/__init__.py diff --git a/src/cpl_cli/tests/custom/console/main.py b/src/tests/custom/console/main.py similarity index 100% rename from src/cpl_cli/tests/custom/console/main.py rename to src/tests/custom/console/main.py diff --git a/src/cpl_cli/tests/custom/database/LICENSE b/src/tests/custom/database/LICENSE similarity index 100% rename from src/cpl_cli/tests/custom/database/LICENSE rename to src/tests/custom/database/LICENSE diff --git a/src/cpl_cli/tests/custom/database/README.md b/src/tests/custom/database/README.md similarity index 100% rename from src/cpl_cli/tests/custom/database/README.md rename to src/tests/custom/database/README.md diff --git a/src/cpl_cli/tests/custom/database/appsettings.development.json b/src/tests/custom/database/appsettings.development.json similarity index 100% rename from src/cpl_cli/tests/custom/database/appsettings.development.json rename to src/tests/custom/database/appsettings.development.json diff --git a/src/cpl_cli/tests/custom/database/appsettings.edrafts-lapi.json b/src/tests/custom/database/appsettings.edrafts-lapi.json similarity index 100% rename from src/cpl_cli/tests/custom/database/appsettings.edrafts-lapi.json rename to src/tests/custom/database/appsettings.edrafts-lapi.json diff --git a/src/cpl_cli/tests/custom/database/appsettings.edrafts-pc.json b/src/tests/custom/database/appsettings.edrafts-pc.json similarity index 100% rename from src/cpl_cli/tests/custom/database/appsettings.edrafts-pc.json rename to src/tests/custom/database/appsettings.edrafts-pc.json diff --git a/src/cpl_cli/tests/custom/database/appsettings.json b/src/tests/custom/database/appsettings.json similarity index 100% rename from src/cpl_cli/tests/custom/database/appsettings.json rename to src/tests/custom/database/appsettings.json diff --git a/src/cpl_cli/tests/custom/database/cpl.json b/src/tests/custom/database/cpl.json similarity index 100% rename from src/cpl_cli/tests/custom/database/cpl.json rename to src/tests/custom/database/cpl.json diff --git a/src/cpl_cli/tests/custom/database/src/application.py b/src/tests/custom/database/src/application.py similarity index 100% rename from src/cpl_cli/tests/custom/database/src/application.py rename to src/tests/custom/database/src/application.py diff --git a/src/cpl_cli/tests/custom/database/src/main.py b/src/tests/custom/database/src/main.py similarity index 100% rename from src/cpl_cli/tests/custom/database/src/main.py rename to src/tests/custom/database/src/main.py diff --git a/src/cpl_cli/tests/custom/database/src/model/__init__.py b/src/tests/custom/database/src/model/__init__.py similarity index 100% rename from src/cpl_cli/tests/custom/database/src/model/__init__.py rename to src/tests/custom/database/src/model/__init__.py diff --git a/src/cpl_cli/tests/custom/database/src/model/city_model.py b/src/tests/custom/database/src/model/city_model.py similarity index 100% rename from src/cpl_cli/tests/custom/database/src/model/city_model.py rename to src/tests/custom/database/src/model/city_model.py diff --git a/src/cpl_cli/tests/custom/database/src/model/db_context.py b/src/tests/custom/database/src/model/db_context.py similarity index 100% rename from src/cpl_cli/tests/custom/database/src/model/db_context.py rename to src/tests/custom/database/src/model/db_context.py diff --git a/src/cpl_cli/tests/custom/database/src/model/user_model.py b/src/tests/custom/database/src/model/user_model.py similarity index 100% rename from src/cpl_cli/tests/custom/database/src/model/user_model.py rename to src/tests/custom/database/src/model/user_model.py diff --git a/src/cpl_cli/tests/custom/database/src/model/user_repo.py b/src/tests/custom/database/src/model/user_repo.py similarity index 100% rename from src/cpl_cli/tests/custom/database/src/model/user_repo.py rename to src/tests/custom/database/src/model/user_repo.py diff --git a/src/cpl_cli/tests/custom/database/src/model/user_repo_abc.py b/src/tests/custom/database/src/model/user_repo_abc.py similarity index 100% rename from src/cpl_cli/tests/custom/database/src/model/user_repo_abc.py rename to src/tests/custom/database/src/model/user_repo_abc.py diff --git a/src/cpl_cli/tests/custom/database/src/startup.py b/src/tests/custom/database/src/startup.py similarity index 100% rename from src/cpl_cli/tests/custom/database/src/startup.py rename to src/tests/custom/database/src/startup.py diff --git a/src/cpl_cli/tests/custom/database/src/tests/__init__.py b/src/tests/custom/database/src/tests/__init__.py similarity index 100% rename from src/cpl_cli/tests/custom/database/src/tests/__init__.py rename to src/tests/custom/database/src/tests/__init__.py diff --git a/src/cpl_cli/tests/custom/general/cpl-workspace.json b/src/tests/custom/general/cpl-workspace.json similarity index 100% rename from src/cpl_cli/tests/custom/general/cpl-workspace.json rename to src/tests/custom/general/cpl-workspace.json diff --git a/src/cpl_cli/tests/custom/general/src/general/application.py b/src/tests/custom/general/src/general/application.py similarity index 100% rename from src/cpl_cli/tests/custom/general/src/general/application.py rename to src/tests/custom/general/src/general/application.py diff --git a/src/cpl_cli/tests/custom/general/src/general/appsettings.development.json b/src/tests/custom/general/src/general/appsettings.development.json similarity index 100% rename from src/cpl_cli/tests/custom/general/src/general/appsettings.development.json rename to src/tests/custom/general/src/general/appsettings.development.json diff --git a/src/cpl_cli/tests/custom/general/src/general/appsettings.edrafts-lapi.json b/src/tests/custom/general/src/general/appsettings.edrafts-lapi.json similarity index 100% rename from src/cpl_cli/tests/custom/general/src/general/appsettings.edrafts-lapi.json rename to src/tests/custom/general/src/general/appsettings.edrafts-lapi.json diff --git a/src/cpl_cli/tests/custom/general/src/general/appsettings.edrafts-pc.json b/src/tests/custom/general/src/general/appsettings.edrafts-pc.json similarity index 100% rename from src/cpl_cli/tests/custom/general/src/general/appsettings.edrafts-pc.json rename to src/tests/custom/general/src/general/appsettings.edrafts-pc.json diff --git a/src/cpl_cli/tests/custom/general/src/general/appsettings.json b/src/tests/custom/general/src/general/appsettings.json similarity index 100% rename from src/cpl_cli/tests/custom/general/src/general/appsettings.json rename to src/tests/custom/general/src/general/appsettings.json diff --git a/src/cpl_cli/tests/custom/general/src/general/db/__init__.py b/src/tests/custom/general/src/general/db/__init__.py similarity index 100% rename from src/cpl_cli/tests/custom/general/src/general/db/__init__.py rename to src/tests/custom/general/src/general/db/__init__.py diff --git a/src/cpl_cli/tests/custom/general/src/general/general.json b/src/tests/custom/general/src/general/general.json similarity index 100% rename from src/cpl_cli/tests/custom/general/src/general/general.json rename to src/tests/custom/general/src/general/general.json diff --git a/src/cpl_cli/tests/custom/general/src/general/main.py b/src/tests/custom/general/src/general/main.py similarity index 100% rename from src/cpl_cli/tests/custom/general/src/general/main.py rename to src/tests/custom/general/src/general/main.py diff --git a/src/cpl_cli/tests/custom/general/src/general/startup.py b/src/tests/custom/general/src/general/startup.py similarity index 100% rename from src/cpl_cli/tests/custom/general/src/general/startup.py rename to src/tests/custom/general/src/general/startup.py diff --git a/src/cpl_cli/tests/custom/general/src/general/test_extension.py b/src/tests/custom/general/src/general/test_extension.py similarity index 100% rename from src/cpl_cli/tests/custom/general/src/general/test_extension.py rename to src/tests/custom/general/src/general/test_extension.py diff --git a/src/cpl_cli/tests/custom/general/src/general/test_service.py b/src/tests/custom/general/src/general/test_service.py similarity index 100% rename from src/cpl_cli/tests/custom/general/src/general/test_service.py rename to src/tests/custom/general/src/general/test_service.py diff --git a/src/cpl_cli/tests/generated/simple-app/LICENSE b/src/tests/generated/simple-app/LICENSE similarity index 100% rename from src/cpl_cli/tests/generated/simple-app/LICENSE rename to src/tests/generated/simple-app/LICENSE diff --git a/src/cpl_cli/tests/generated/simple-app/README.md b/src/tests/generated/simple-app/README.md similarity index 100% rename from src/cpl_cli/tests/generated/simple-app/README.md rename to src/tests/generated/simple-app/README.md diff --git a/src/cpl_cli/tests/generated/simple-app/appsettings.json b/src/tests/generated/simple-app/appsettings.json similarity index 100% rename from src/cpl_cli/tests/generated/simple-app/appsettings.json rename to src/tests/generated/simple-app/appsettings.json diff --git a/src/cpl_cli/tests/generated/simple-app/cpl-workspace.json b/src/tests/generated/simple-app/cpl-workspace.json similarity index 100% rename from src/cpl_cli/tests/generated/simple-app/cpl-workspace.json rename to src/tests/generated/simple-app/cpl-workspace.json diff --git a/src/cpl_cli/tests/generated/simple-app/cpl.json b/src/tests/generated/simple-app/cpl.json similarity index 100% rename from src/cpl_cli/tests/generated/simple-app/cpl.json rename to src/tests/generated/simple-app/cpl.json diff --git a/src/cpl_cli/tests/generated/simple-app/src/application.py b/src/tests/generated/simple-app/src/application.py similarity index 100% rename from src/cpl_cli/tests/generated/simple-app/src/application.py rename to src/tests/generated/simple-app/src/application.py diff --git a/src/cpl_cli/tests/generated/simple-app/src/main.py b/src/tests/generated/simple-app/src/main.py similarity index 100% rename from src/cpl_cli/tests/generated/simple-app/src/main.py rename to src/tests/generated/simple-app/src/main.py diff --git a/src/cpl_cli/tests/generated/simple-app/src/simple_app/__init__.py b/src/tests/generated/simple-app/src/simple_app/__init__.py similarity index 100% rename from src/cpl_cli/tests/generated/simple-app/src/simple_app/__init__.py rename to src/tests/generated/simple-app/src/simple_app/__init__.py diff --git a/src/cpl_cli/tests/generated/simple-app/src/simple_app/application.py b/src/tests/generated/simple-app/src/simple_app/application.py similarity index 100% rename from src/cpl_cli/tests/generated/simple-app/src/simple_app/application.py rename to src/tests/generated/simple-app/src/simple_app/application.py diff --git a/src/cpl_cli/tests/generated/simple-app/src/simple_app/main.py b/src/tests/generated/simple-app/src/simple_app/main.py similarity index 100% rename from src/cpl_cli/tests/generated/simple-app/src/simple_app/main.py rename to src/tests/generated/simple-app/src/simple_app/main.py diff --git a/src/cpl_cli/tests/generated/simple-app/src/simple_app/simple-app.json b/src/tests/generated/simple-app/src/simple_app/simple-app.json similarity index 100% rename from src/cpl_cli/tests/generated/simple-app/src/simple_app/simple-app.json rename to src/tests/generated/simple-app/src/simple_app/simple-app.json diff --git a/src/cpl_cli/tests/generated/simple-app/src/tests/__init__.py b/src/tests/generated/simple-app/src/tests/__init__.py similarity index 100% rename from src/cpl_cli/tests/generated/simple-app/src/tests/__init__.py rename to src/tests/generated/simple-app/src/tests/__init__.py diff --git a/src/cpl_cli/tests/generated/simple-console/LICENSE b/src/tests/generated/simple-console/LICENSE similarity index 100% rename from src/cpl_cli/tests/generated/simple-console/LICENSE rename to src/tests/generated/simple-console/LICENSE diff --git a/src/cpl_cli/tests/generated/simple-console/README.md b/src/tests/generated/simple-console/README.md similarity index 100% rename from src/cpl_cli/tests/generated/simple-console/README.md rename to src/tests/generated/simple-console/README.md diff --git a/src/cpl_cli/tests/generated/simple-console/appsettings.json b/src/tests/generated/simple-console/appsettings.json similarity index 100% rename from src/cpl_cli/tests/generated/simple-console/appsettings.json rename to src/tests/generated/simple-console/appsettings.json diff --git a/src/cpl_cli/tests/generated/simple-console/cpl-workspace.json b/src/tests/generated/simple-console/cpl-workspace.json similarity index 100% rename from src/cpl_cli/tests/generated/simple-console/cpl-workspace.json rename to src/tests/generated/simple-console/cpl-workspace.json diff --git a/src/cpl_cli/tests/generated/simple-console/cpl.json b/src/tests/generated/simple-console/cpl.json similarity index 100% rename from src/cpl_cli/tests/generated/simple-console/cpl.json rename to src/tests/generated/simple-console/cpl.json diff --git a/src/cpl_cli/tests/generated/simple-console/src/main.py b/src/tests/generated/simple-console/src/main.py similarity index 100% rename from src/cpl_cli/tests/generated/simple-console/src/main.py rename to src/tests/generated/simple-console/src/main.py diff --git a/src/cpl_cli/tests/generated/simple-console/src/simple_console/__init__.py b/src/tests/generated/simple-console/src/simple_console/__init__.py similarity index 100% rename from src/cpl_cli/tests/generated/simple-console/src/simple_console/__init__.py rename to src/tests/generated/simple-console/src/simple_console/__init__.py diff --git a/src/cpl_cli/tests/generated/simple-console/src/simple_console/main.py b/src/tests/generated/simple-console/src/simple_console/main.py similarity index 100% rename from src/cpl_cli/tests/generated/simple-console/src/simple_console/main.py rename to src/tests/generated/simple-console/src/simple_console/main.py diff --git a/src/cpl_cli/tests/generated/simple-console/src/simple_console/simple-console.json b/src/tests/generated/simple-console/src/simple_console/simple-console.json similarity index 100% rename from src/cpl_cli/tests/generated/simple-console/src/simple_console/simple-console.json rename to src/tests/generated/simple-console/src/simple_console/simple-console.json diff --git a/src/cpl_cli/tests/generated/simple-console/src/tests/__init__.py b/src/tests/generated/simple-console/src/tests/__init__.py similarity index 100% rename from src/cpl_cli/tests/generated/simple-console/src/tests/__init__.py rename to src/tests/generated/simple-console/src/tests/__init__.py diff --git a/src/cpl_cli/tests/generated/simple-di/LICENSE b/src/tests/generated/simple-di/LICENSE similarity index 100% rename from src/cpl_cli/tests/generated/simple-di/LICENSE rename to src/tests/generated/simple-di/LICENSE diff --git a/src/cpl_cli/tests/generated/simple-di/README.md b/src/tests/generated/simple-di/README.md similarity index 100% rename from src/cpl_cli/tests/generated/simple-di/README.md rename to src/tests/generated/simple-di/README.md diff --git a/src/cpl_cli/tests/generated/simple-di/appsettings.json b/src/tests/generated/simple-di/appsettings.json similarity index 100% rename from src/cpl_cli/tests/generated/simple-di/appsettings.json rename to src/tests/generated/simple-di/appsettings.json diff --git a/src/cpl_cli/tests/generated/simple-di/cpl-workspace.json b/src/tests/generated/simple-di/cpl-workspace.json similarity index 100% rename from src/cpl_cli/tests/generated/simple-di/cpl-workspace.json rename to src/tests/generated/simple-di/cpl-workspace.json diff --git a/src/cpl_cli/tests/generated/simple-di/cpl.json b/src/tests/generated/simple-di/cpl.json similarity index 100% rename from src/cpl_cli/tests/generated/simple-di/cpl.json rename to src/tests/generated/simple-di/cpl.json diff --git a/src/cpl_cli/tests/generated/simple-di/src/main.py b/src/tests/generated/simple-di/src/main.py similarity index 100% rename from src/cpl_cli/tests/generated/simple-di/src/main.py rename to src/tests/generated/simple-di/src/main.py diff --git a/src/cpl_cli/tests/generated/simple-di/src/simple_di/__init__.py b/src/tests/generated/simple-di/src/simple_di/__init__.py similarity index 100% rename from src/cpl_cli/tests/generated/simple-di/src/simple_di/__init__.py rename to src/tests/generated/simple-di/src/simple_di/__init__.py diff --git a/src/cpl_cli/tests/generated/simple-di/src/simple_di/main.py b/src/tests/generated/simple-di/src/simple_di/main.py similarity index 100% rename from src/cpl_cli/tests/generated/simple-di/src/simple_di/main.py rename to src/tests/generated/simple-di/src/simple_di/main.py diff --git a/src/cpl_cli/tests/generated/simple-di/src/simple_di/simple-di.json b/src/tests/generated/simple-di/src/simple_di/simple-di.json similarity index 100% rename from src/cpl_cli/tests/generated/simple-di/src/simple_di/simple-di.json rename to src/tests/generated/simple-di/src/simple_di/simple-di.json diff --git a/src/cpl_cli/tests/generated/simple-di/src/tests/__init__.py b/src/tests/generated/simple-di/src/tests/__init__.py similarity index 100% rename from src/cpl_cli/tests/generated/simple-di/src/tests/__init__.py rename to src/tests/generated/simple-di/src/tests/__init__.py diff --git a/src/cpl_cli/tests/generated/simple-startup-app/LICENSE b/src/tests/generated/simple-startup-app/LICENSE similarity index 100% rename from src/cpl_cli/tests/generated/simple-startup-app/LICENSE rename to src/tests/generated/simple-startup-app/LICENSE diff --git a/src/cpl_cli/tests/generated/simple-startup-app/README.md b/src/tests/generated/simple-startup-app/README.md similarity index 100% rename from src/cpl_cli/tests/generated/simple-startup-app/README.md rename to src/tests/generated/simple-startup-app/README.md diff --git a/src/cpl_cli/tests/generated/simple-startup-app/appsettings.json b/src/tests/generated/simple-startup-app/appsettings.json similarity index 100% rename from src/cpl_cli/tests/generated/simple-startup-app/appsettings.json rename to src/tests/generated/simple-startup-app/appsettings.json diff --git a/src/cpl_cli/tests/generated/simple-startup-app/cpl-workspace.json b/src/tests/generated/simple-startup-app/cpl-workspace.json similarity index 100% rename from src/cpl_cli/tests/generated/simple-startup-app/cpl-workspace.json rename to src/tests/generated/simple-startup-app/cpl-workspace.json diff --git a/src/cpl_cli/tests/generated/simple-startup-app/src/simple_startup_app/__init__.py b/src/tests/generated/simple-startup-app/src/simple_startup_app/__init__.py similarity index 100% rename from src/cpl_cli/tests/generated/simple-startup-app/src/simple_startup_app/__init__.py rename to src/tests/generated/simple-startup-app/src/simple_startup_app/__init__.py diff --git a/src/cpl_cli/tests/generated/simple-startup-app/src/simple_startup_app/application.py b/src/tests/generated/simple-startup-app/src/simple_startup_app/application.py similarity index 100% rename from src/cpl_cli/tests/generated/simple-startup-app/src/simple_startup_app/application.py rename to src/tests/generated/simple-startup-app/src/simple_startup_app/application.py diff --git a/src/cpl_cli/tests/generated/simple-startup-app/src/simple_startup_app/main.py b/src/tests/generated/simple-startup-app/src/simple_startup_app/main.py similarity index 100% rename from src/cpl_cli/tests/generated/simple-startup-app/src/simple_startup_app/main.py rename to src/tests/generated/simple-startup-app/src/simple_startup_app/main.py diff --git a/src/cpl_cli/tests/generated/simple-startup-app/src/simple_startup_app/simple-startup-app.json b/src/tests/generated/simple-startup-app/src/simple_startup_app/simple-startup-app.json similarity index 100% rename from src/cpl_cli/tests/generated/simple-startup-app/src/simple_startup_app/simple-startup-app.json rename to src/tests/generated/simple-startup-app/src/simple_startup_app/simple-startup-app.json diff --git a/src/cpl_cli/tests/generated/simple-startup-app/src/simple_startup_app/startup.py b/src/tests/generated/simple-startup-app/src/simple_startup_app/startup.py similarity index 100% rename from src/cpl_cli/tests/generated/simple-startup-app/src/simple_startup_app/startup.py rename to src/tests/generated/simple-startup-app/src/simple_startup_app/startup.py diff --git a/src/cpl_cli/tests/generated/simple-startup-app/src/tests/__init__.py b/src/tests/generated/simple-startup-app/src/tests/__init__.py similarity index 100% rename from src/cpl_cli/tests/generated/simple-startup-app/src/tests/__init__.py rename to src/tests/generated/simple-startup-app/src/tests/__init__.py diff --git a/src/cpl_cli/tests/generated/startup-app/LICENSE b/src/tests/generated/startup-app/LICENSE similarity index 100% rename from src/cpl_cli/tests/generated/startup-app/LICENSE rename to src/tests/generated/startup-app/LICENSE diff --git a/src/cpl_cli/tests/generated/startup-app/README.md b/src/tests/generated/startup-app/README.md similarity index 100% rename from src/cpl_cli/tests/generated/startup-app/README.md rename to src/tests/generated/startup-app/README.md diff --git a/src/cpl_cli/tests/generated/startup-app/cpl.json b/src/tests/generated/startup-app/cpl.json similarity index 100% rename from src/cpl_cli/tests/generated/startup-app/cpl.json rename to src/tests/generated/startup-app/cpl.json diff --git a/src/cpl_cli/tests/generated/startup-app/src/application.py b/src/tests/generated/startup-app/src/application.py similarity index 100% rename from src/cpl_cli/tests/generated/startup-app/src/application.py rename to src/tests/generated/startup-app/src/application.py diff --git a/src/cpl_cli/tests/generated/startup-app/src/main.py b/src/tests/generated/startup-app/src/main.py similarity index 100% rename from src/cpl_cli/tests/generated/startup-app/src/main.py rename to src/tests/generated/startup-app/src/main.py diff --git a/src/cpl_cli/tests/generated/startup-app/src/startup.py b/src/tests/generated/startup-app/src/startup.py similarity index 100% rename from src/cpl_cli/tests/generated/startup-app/src/startup.py rename to src/tests/generated/startup-app/src/startup.py diff --git a/src/cpl_cli/tests/generated/startup-app/src/tests/__init__.py b/src/tests/generated/startup-app/src/tests/__init__.py similarity index 100% rename from src/cpl_cli/tests/generated/startup-app/src/tests/__init__.py rename to src/tests/generated/startup-app/src/tests/__init__.py From 98e343a108650311d958771893ccdaff42d8c4fa Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Sun, 14 Nov 2021 11:56:42 +0100 Subject: [PATCH 4/7] Added logic to handle scoped services --- src/cpl_core/dependency_injection/scope.py | 18 ++++++++ .../dependency_injection/scope_abc.py | 24 ++++++++++ .../dependency_injection/scope_builder.py | 19 ++++++++ .../service_lifetime_enum.py | 2 +- .../dependency_injection/service_provider.py | 15 ++++++- .../service_provider_abc.py | 25 ++++++++++- src/tests/custom/di/LICENSE | 0 src/tests/custom/di/README.md | 0 src/tests/custom/di/appsettings.json | 15 +++++++ src/tests/custom/di/cpl-workspace.json | 9 ++++ src/tests/custom/di/src/di/__init__.py | 1 + src/tests/custom/di/src/di/application.py | 45 +++++++++++++++++++ src/tests/custom/di/src/di/di.json | 43 ++++++++++++++++++ .../custom/di/src/di/di_tester_service.py | 12 +++++ src/tests/custom/di/src/di/main.py | 14 ++++++ src/tests/custom/di/src/di/startup.py | 21 +++++++++ .../custom/di/src/di/test_service_service.py | 13 ++++++ src/tests/custom/di/src/tests/__init__.py | 1 + 18 files changed, 273 insertions(+), 4 deletions(-) create mode 100644 src/cpl_core/dependency_injection/scope.py create mode 100644 src/cpl_core/dependency_injection/scope_abc.py create mode 100644 src/cpl_core/dependency_injection/scope_builder.py create mode 100644 src/tests/custom/di/LICENSE create mode 100644 src/tests/custom/di/README.md create mode 100644 src/tests/custom/di/appsettings.json create mode 100644 src/tests/custom/di/cpl-workspace.json create mode 100644 src/tests/custom/di/src/di/__init__.py create mode 100644 src/tests/custom/di/src/di/application.py create mode 100644 src/tests/custom/di/src/di/di.json create mode 100644 src/tests/custom/di/src/di/di_tester_service.py create mode 100644 src/tests/custom/di/src/di/main.py create mode 100644 src/tests/custom/di/src/di/startup.py create mode 100644 src/tests/custom/di/src/di/test_service_service.py create mode 100644 src/tests/custom/di/src/tests/__init__.py diff --git a/src/cpl_core/dependency_injection/scope.py b/src/cpl_core/dependency_injection/scope.py new file mode 100644 index 00000000..a461fcdd --- /dev/null +++ b/src/cpl_core/dependency_injection/scope.py @@ -0,0 +1,18 @@ + +from cpl_core.console.console import Console +from cpl_core.dependency_injection.scope_abc import ScopeABC +from cpl_core.dependency_injection.service_provider_abc import ServiceProviderABC + + +class Scope(ScopeABC): + + def __init__(self, service_provider: ServiceProviderABC): + self._service_provider = service_provider + self._service_provider.set_scope(self) + + @property + def service_provider(self) -> ServiceProviderABC: + return self._service_provider + + def dispose(self): + self._service_provider = None diff --git a/src/cpl_core/dependency_injection/scope_abc.py b/src/cpl_core/dependency_injection/scope_abc.py new file mode 100644 index 00000000..4de16c74 --- /dev/null +++ b/src/cpl_core/dependency_injection/scope_abc.py @@ -0,0 +1,24 @@ +from abc import ABC, abstractmethod + +class ScopeABC(ABC): + r"""ABC for the class :class:`cpl_core.dependency_injection.scope.Scope`""" + + def __init__(self): + pass + + @property + @abstractmethod + def service_provider(self): + r"""Returns to service provider of scope + + Returns + ------- + Object of type :class:`cpl_core.dependency_injection.service_provider_abc.ServiceProviderABC` + """ + pass + + @abstractmethod + def dispose(): + r"""Sets service_provider to None + """ + pass \ No newline at end of file diff --git a/src/cpl_core/dependency_injection/scope_builder.py b/src/cpl_core/dependency_injection/scope_builder.py new file mode 100644 index 00000000..595b9a80 --- /dev/null +++ b/src/cpl_core/dependency_injection/scope_builder.py @@ -0,0 +1,19 @@ +from cpl_core.dependency_injection.scope import Scope +from cpl_core.dependency_injection.scope_abc import ScopeABC +from cpl_core.dependency_injection.service_provider_abc import ServiceProviderABC + + +class ScopeBuilder: + r"""Class to build :class:`cpl_core.dependency_injection.scope.Scope`""" + + def __init__(self, service_provider: ServiceProviderABC) -> None: + self._service_provider = service_provider + + def build(self) -> ScopeABC: + r"""Returns scope + + Returns + ------- + Object of type :class:`cpl_core.dependency_injection.scope.Scope` + """ + return Scope(self._service_provider) diff --git a/src/cpl_core/dependency_injection/service_lifetime_enum.py b/src/cpl_core/dependency_injection/service_lifetime_enum.py index c2057ba8..0b4cf16d 100644 --- a/src/cpl_core/dependency_injection/service_lifetime_enum.py +++ b/src/cpl_core/dependency_injection/service_lifetime_enum.py @@ -4,5 +4,5 @@ from enum import Enum class ServiceLifetimeEnum(Enum): singleton = 0 - scoped = 1 # not supported yet + scoped = 1 transient = 2 diff --git a/src/cpl_core/dependency_injection/service_provider.py b/src/cpl_core/dependency_injection/service_provider.py index cf079d83..04a19b57 100644 --- a/src/cpl_core/dependency_injection/service_provider.py +++ b/src/cpl_core/dependency_injection/service_provider.py @@ -1,10 +1,13 @@ from collections import Callable +import copy from inspect import signature, Parameter from typing import Optional from cpl_core.configuration.configuration_abc import ConfigurationABC from cpl_core.configuration.configuration_model_abc import ConfigurationModelABC from cpl_core.database.context.database_context_abc import DatabaseContextABC +from cpl_core.dependency_injection.scope_abc import ScopeABC +from cpl_core.dependency_injection.scope_builder import ScopeBuilder from cpl_core.dependency_injection.service_provider_abc import ServiceProviderABC from cpl_core.dependency_injection.service_descriptor import ServiceDescriptor from cpl_core.dependency_injection.service_lifetime_enum import ServiceLifetimeEnum @@ -30,6 +33,7 @@ class ServiceProvider(ServiceProviderABC): self._service_descriptors: list[ServiceDescriptor] = service_descriptors self._configuration: ConfigurationABC = config self._database_context = db_context + self._scope: Optional[ScopeABC] = None def _find_service(self, service_type: type) -> ServiceDescriptor: for descriptor in self._service_descriptors: @@ -84,8 +88,15 @@ class ServiceProvider(ServiceProviderABC): params.append(self._get_service(parameter)) return service_type(*params) + + def set_scope(self, scope: ScopeABC): + self._scope = scope + + def create_scope(self) -> ScopeABC: + sb = ScopeBuilder(ServiceProvider(copy.deepcopy(self._service_descriptors), self._configuration, self._database_context)) + return sb.build() - def get_service(self, service_type: type) -> Optional[Callable]: + def get_service(self, service_type: type) -> Optional[Callable[object]]: result = self._find_service(service_type) if result is None: @@ -95,7 +106,7 @@ class ServiceProvider(ServiceProviderABC): return result.implementation implementation = self.build_service(service_type) - if result.lifetime == ServiceLifetimeEnum.singleton: + if result.lifetime == ServiceLifetimeEnum.singleton or result.lifetime == ServiceLifetimeEnum.scoped and self._scope is not None: result.implementation = implementation return implementation diff --git a/src/cpl_core/dependency_injection/service_provider_abc.py b/src/cpl_core/dependency_injection/service_provider_abc.py index 6c64a4e3..cc06e529 100644 --- a/src/cpl_core/dependency_injection/service_provider_abc.py +++ b/src/cpl_core/dependency_injection/service_provider_abc.py @@ -2,6 +2,8 @@ from abc import abstractmethod, ABC from collections import Callable from typing import Type, Optional +from cpl_core.dependency_injection.scope_abc import ScopeABC + class ServiceProviderABC(ABC): r"""ABC for the class :class:`cpl_core.dependency_injection.service_provider.ServiceProvider`""" @@ -24,9 +26,30 @@ class ServiceProviderABC(ABC): Object of the given type """ pass + + @abstractmethod + def set_scope(self, scope: ScopeABC): + r"""Sets the scope of service provider + + Parameter + --------- + scope :class:`cpl_core.dependency_injection.scope.Scope` + Service scope + """ + pass + + @abstractmethod + def create_scope(self) -> ScopeABC: + r"""Creates a service scope + + Returns + ------- + Object of type :class:`cpl_core.dependency_injection.scope.Scope` + """ + pass @abstractmethod - def get_service(self, instance_type: Type) -> Optional[Callable]: + def get_service(self, instance_type: Type) -> Optional[Callable[object]]: r"""Returns instance of given type Parameter diff --git a/src/tests/custom/di/LICENSE b/src/tests/custom/di/LICENSE new file mode 100644 index 00000000..e69de29b diff --git a/src/tests/custom/di/README.md b/src/tests/custom/di/README.md new file mode 100644 index 00000000..e69de29b diff --git a/src/tests/custom/di/appsettings.json b/src/tests/custom/di/appsettings.json new file mode 100644 index 00000000..629e6ebd --- /dev/null +++ b/src/tests/custom/di/appsettings.json @@ -0,0 +1,15 @@ +{ + "TimeFormatSettings": { + "DateFormat": "%Y-%m-%d", + "TimeFormat": "%H:%M:%S", + "DateTimeFormat": "%Y-%m-%d %H:%M:%S.%f", + "DateTimeLogFormat": "%Y-%m-%d_%H-%M-%S" + }, + + "LoggingSettings": { + "Path": "logs/", + "Filename": "log_$start_time.log", + "ConsoleLogLevel": "ERROR", + "FileLogLevel": "WARN" + } +} diff --git a/src/tests/custom/di/cpl-workspace.json b/src/tests/custom/di/cpl-workspace.json new file mode 100644 index 00000000..4e95d495 --- /dev/null +++ b/src/tests/custom/di/cpl-workspace.json @@ -0,0 +1,9 @@ +{ + "WorkspaceSettings": { + "DefaultProject": "di", + "Projects": { + "di": "src/di/di.json" + }, + "Scripts": {} + } +} \ No newline at end of file diff --git a/src/tests/custom/di/src/di/__init__.py b/src/tests/custom/di/src/di/__init__.py new file mode 100644 index 00000000..ad5eca30 --- /dev/null +++ b/src/tests/custom/di/src/di/__init__.py @@ -0,0 +1 @@ +# imports: diff --git a/src/tests/custom/di/src/di/application.py b/src/tests/custom/di/src/di/application.py new file mode 100644 index 00000000..e9f0b4bf --- /dev/null +++ b/src/tests/custom/di/src/di/application.py @@ -0,0 +1,45 @@ +from cpl_core.application import ApplicationABC +from cpl_core.configuration import ConfigurationABC +from cpl_core.console.console import Console +from cpl_core.dependency_injection import ServiceProviderABC +from cpl_core.dependency_injection.scope import Scope +from test_service_service import TestService +from di_tester_service import DITesterService + + +class Application(ApplicationABC): + + def __init__(self, config: ConfigurationABC, services: ServiceProviderABC): + ApplicationABC.__init__(self, config, services) + + def _part_of_scoped(self): + ts: TestService = self._services.get_service(TestService) + ts.run() + + def configure(self): + pass + + def main(self): + Console.write_line('Scope1') + scope1: Scope = self._services.create_scope() + ts: TestService = scope1.service_provider.get_service(TestService) + ts.run() + dit: DITesterService = scope1.service_provider.get_service(DITesterService) + dit.run() + t = scope1 + b = t.service_provider + scope1.dispose() + + Console.write_line('Disposed:') + ts1: TestService = scope1.service_provider.get_service(TestService) + ts1.run() + + Console.write_line('Scope2') + scope2: Scope = self._services.create_scope() + ts: TestService = scope2.service_provider.get_service(TestService) + ts.run() + dit: DITesterService = scope2.service_provider.get_service(DITesterService) + dit.run() + + Console.write_line('Global') + self._part_of_scoped() diff --git a/src/tests/custom/di/src/di/di.json b/src/tests/custom/di/src/di/di.json new file mode 100644 index 00000000..cd4e3ff2 --- /dev/null +++ b/src/tests/custom/di/src/di/di.json @@ -0,0 +1,43 @@ +{ + "ProjectSettings": { + "Name": "di", + "Version": { + "Major": "0", + "Minor": "0", + "Micro": "0" + }, + "Author": "", + "AuthorEmail": "", + "Description": "", + "LongDescription": "", + "URL": "", + "CopyrightDate": "", + "CopyrightName": "", + "LicenseName": "", + "LicenseDescription": "", + "Dependencies": [ + "sh_cpl>=2021.10.0.post1" + ], + "PythonVersion": ">=3.9.2", + "PythonPath": { + "linux": "" + }, + "Classifiers": [] + }, + "BuildSettings": { + "ProjectType": "console", + "SourcePath": "", + "OutputPath": "../../dist", + "Main": "di.main", + "EntryPoint": "di", + "IncludePackageData": false, + "Included": [], + "Excluded": [ + "*/__pycache__", + "*/logs", + "*/tests" + ], + "PackageData": {}, + "ProjectReferences": [] + } +} \ No newline at end of file diff --git a/src/tests/custom/di/src/di/di_tester_service.py b/src/tests/custom/di/src/di/di_tester_service.py new file mode 100644 index 00000000..27a40b85 --- /dev/null +++ b/src/tests/custom/di/src/di/di_tester_service.py @@ -0,0 +1,12 @@ +from cpl_core.console.console import Console +from test_service_service import TestService + + +class DITesterService: + + def __init__(self, ts: TestService): + self._ts = ts + + def run(self): + Console.write_line('DIT: ') + self._ts.run() diff --git a/src/tests/custom/di/src/di/main.py b/src/tests/custom/di/src/di/main.py new file mode 100644 index 00000000..4289aee6 --- /dev/null +++ b/src/tests/custom/di/src/di/main.py @@ -0,0 +1,14 @@ +from cpl_core.application import ApplicationBuilder + +from di.application import Application +from di.startup import Startup + + +def main(): + app_builder = ApplicationBuilder(Application) + app_builder.use_startup(Startup) + app_builder.build().run() + + +if __name__ == '__main__': + main() diff --git a/src/tests/custom/di/src/di/startup.py b/src/tests/custom/di/src/di/startup.py new file mode 100644 index 00000000..9f56c8be --- /dev/null +++ b/src/tests/custom/di/src/di/startup.py @@ -0,0 +1,21 @@ +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 +from test_service_service import TestService +from di_tester_service import DITesterService + + +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: + services.add_scoped(TestService) + services.add_scoped(DITesterService) + + return services.build_service_provider() diff --git a/src/tests/custom/di/src/di/test_service_service.py b/src/tests/custom/di/src/di/test_service_service.py new file mode 100644 index 00000000..f99a47a1 --- /dev/null +++ b/src/tests/custom/di/src/di/test_service_service.py @@ -0,0 +1,13 @@ +import string +from cpl_core.console.console import Console +from cpl_core.utils.string import String + + +class TestService: + + def __init__(self): + self._name = String.random_string(string.ascii_lowercase, 8) + + + def run(self): + Console.write_line(f'Im {self._name}') \ No newline at end of file diff --git a/src/tests/custom/di/src/tests/__init__.py b/src/tests/custom/di/src/tests/__init__.py new file mode 100644 index 00000000..ad5eca30 --- /dev/null +++ b/src/tests/custom/di/src/tests/__init__.py @@ -0,0 +1 @@ +# imports: From 4b829cc4842dfaeec2f92aa92493a705a10aced4 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Sun, 14 Nov 2021 12:16:50 +0100 Subject: [PATCH 5/7] Added logic to handle async applicationBase --- src/cpl_core/application/application_abc.py | 22 ++++++++++ .../application/application_builder.py | 16 ++++++- .../application/application_builder_abc.py | 21 +++++++++ .../application/application_extension_abc.py | 3 ++ src/tests/custom/async/LICENSE | 0 src/tests/custom/async/README.md | 0 src/tests/custom/async/appsettings.json | 15 +++++++ src/tests/custom/async/cpl-workspace.json | 9 ++++ src/tests/custom/async/src/async/__init__.py | 1 + .../custom/async/src/async/application.py | 16 +++++++ src/tests/custom/async/src/async/async.json | 43 +++++++++++++++++++ src/tests/custom/async/src/async/main.py | 17 ++++++++ src/tests/custom/async/src/async/startup.py | 16 +++++++ src/tests/custom/async/src/tests/__init__.py | 1 + src/tests/custom/di/src/di/application.py | 6 +-- 15 files changed, 181 insertions(+), 5 deletions(-) create mode 100644 src/tests/custom/async/LICENSE create mode 100644 src/tests/custom/async/README.md create mode 100644 src/tests/custom/async/appsettings.json create mode 100644 src/tests/custom/async/cpl-workspace.json create mode 100644 src/tests/custom/async/src/async/__init__.py create mode 100644 src/tests/custom/async/src/async/application.py create mode 100644 src/tests/custom/async/src/async/async.json create mode 100644 src/tests/custom/async/src/async/main.py create mode 100644 src/tests/custom/async/src/async/startup.py create mode 100644 src/tests/custom/async/src/tests/__init__.py diff --git a/src/cpl_core/application/application_abc.py b/src/cpl_core/application/application_abc.py index 3c64d944..37d28d26 100644 --- a/src/cpl_core/application/application_abc.py +++ b/src/cpl_core/application/application_abc.py @@ -34,6 +34,28 @@ class ApplicationABC(ABC): self.main() except KeyboardInterrupt: 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): + r"""Entry point + + Called by custom Application.main + """ + try: + await self.configure() + await self.main() + except KeyboardInterrupt: + Console.close() @abstractmethod def configure(self): diff --git a/src/cpl_core/application/application_builder.py b/src/cpl_core/application/application_builder.py index 27ccb762..c434c6ec 100644 --- a/src/cpl_core/application/application_builder.py +++ b/src/cpl_core/application/application_builder.py @@ -1,4 +1,3 @@ -import types from typing import Type, Optional, Callable from cpl_core.application.application_abc import ApplicationABC @@ -6,7 +5,6 @@ from cpl_core.application.application_builder_abc import ApplicationBuilderABC from cpl_core.application.application_extension_abc import ApplicationExtensionABC from cpl_core.application.startup_abc import StartupABC from cpl_core.configuration.configuration import Configuration -from cpl_core.console import Console from cpl_core.dependency_injection.service_collection import ServiceCollection @@ -50,3 +48,17 @@ class ApplicationBuilder(ApplicationBuilderABC): extension.run(config, services) return self._app(config, services) + + async def build_async(self) -> ApplicationABC: + if self._startup is not None: + await self._startup.configure_configuration(self._configuration, self._environment) + await self._startup.configure_services(self._services, self._environment) + + config = self._configuration + services = self._services.build_service_provider() + + for ex in self._extensions: + extension = ex() + await extension.run(config, services) + + return self._app(config, services) diff --git a/src/cpl_core/application/application_builder_abc.py b/src/cpl_core/application/application_builder_abc.py index dff8e6f8..2ced6ad1 100644 --- a/src/cpl_core/application/application_builder_abc.py +++ b/src/cpl_core/application/application_builder_abc.py @@ -23,6 +23,17 @@ class ApplicationBuilderABC(ABC): """ pass + @abstractmethod + async def use_startup(self, startup: Type[StartupABC]): + r"""Sets the custom startup class to use async + + Parameter + --------- + startup: Type[:class:`cpl_core.application.startup_abc.StartupABC`] + Startup class to use + """ + pass + @abstractmethod def build(self) -> ApplicationABC: r"""Creates custom application object @@ -32,3 +43,13 @@ class ApplicationBuilderABC(ABC): Object of :class:`cpl_core.application.application_abc.ApplicationABC` """ pass + + @abstractmethod + async def build_async(self) -> ApplicationABC: + r"""Creates custom application object async + + Returns + ------- + Object of :class:`cpl_core.application.application_abc.ApplicationABC` + """ + pass diff --git a/src/cpl_core/application/application_extension_abc.py b/src/cpl_core/application/application_extension_abc.py index 0a6dfc20..a7092fcf 100644 --- a/src/cpl_core/application/application_extension_abc.py +++ b/src/cpl_core/application/application_extension_abc.py @@ -11,3 +11,6 @@ class ApplicationExtensionABC(ABC): @abstractmethod def run(self, config: ConfigurationABC, services: ServiceProviderABC): pass + + @abstractmethod + async def run(self, config: ConfigurationABC, services: ServiceProviderABC): pass diff --git a/src/tests/custom/async/LICENSE b/src/tests/custom/async/LICENSE new file mode 100644 index 00000000..e69de29b diff --git a/src/tests/custom/async/README.md b/src/tests/custom/async/README.md new file mode 100644 index 00000000..e69de29b diff --git a/src/tests/custom/async/appsettings.json b/src/tests/custom/async/appsettings.json new file mode 100644 index 00000000..629e6ebd --- /dev/null +++ b/src/tests/custom/async/appsettings.json @@ -0,0 +1,15 @@ +{ + "TimeFormatSettings": { + "DateFormat": "%Y-%m-%d", + "TimeFormat": "%H:%M:%S", + "DateTimeFormat": "%Y-%m-%d %H:%M:%S.%f", + "DateTimeLogFormat": "%Y-%m-%d_%H-%M-%S" + }, + + "LoggingSettings": { + "Path": "logs/", + "Filename": "log_$start_time.log", + "ConsoleLogLevel": "ERROR", + "FileLogLevel": "WARN" + } +} diff --git a/src/tests/custom/async/cpl-workspace.json b/src/tests/custom/async/cpl-workspace.json new file mode 100644 index 00000000..fc78d6ed --- /dev/null +++ b/src/tests/custom/async/cpl-workspace.json @@ -0,0 +1,9 @@ +{ + "WorkspaceSettings": { + "DefaultProject": "async", + "Projects": { + "async": "src/async/async.json" + }, + "Scripts": {} + } +} \ No newline at end of file diff --git a/src/tests/custom/async/src/async/__init__.py b/src/tests/custom/async/src/async/__init__.py new file mode 100644 index 00000000..ad5eca30 --- /dev/null +++ b/src/tests/custom/async/src/async/__init__.py @@ -0,0 +1 @@ +# imports: diff --git a/src/tests/custom/async/src/async/application.py b/src/tests/custom/async/src/async/application.py new file mode 100644 index 00000000..b2df0250 --- /dev/null +++ b/src/tests/custom/async/src/async/application.py @@ -0,0 +1,16 @@ +from cpl_core.application import ApplicationABC +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) + + async def configure(self): + pass + + async def main(self): + Console.write_line('Hello World') diff --git a/src/tests/custom/async/src/async/async.json b/src/tests/custom/async/src/async/async.json new file mode 100644 index 00000000..7e632a65 --- /dev/null +++ b/src/tests/custom/async/src/async/async.json @@ -0,0 +1,43 @@ +{ + "ProjectSettings": { + "Name": "async", + "Version": { + "Major": "0", + "Minor": "0", + "Micro": "0" + }, + "Author": "", + "AuthorEmail": "", + "Description": "", + "LongDescription": "", + "URL": "", + "CopyrightDate": "", + "CopyrightName": "", + "LicenseName": "", + "LicenseDescription": "", + "Dependencies": [ + "sh_cpl>=2021.10.0.post1" + ], + "PythonVersion": ">=3.9.2", + "PythonPath": { + "linux": "" + }, + "Classifiers": [] + }, + "BuildSettings": { + "ProjectType": "console", + "SourcePath": "", + "OutputPath": "../../dist", + "Main": "async.main", + "EntryPoint": "async", + "IncludePackageData": false, + "Included": [], + "Excluded": [ + "*/__pycache__", + "*/logs", + "*/tests" + ], + "PackageData": {}, + "ProjectReferences": [] + } +} \ No newline at end of file diff --git a/src/tests/custom/async/src/async/main.py b/src/tests/custom/async/src/async/main.py new file mode 100644 index 00000000..0cde844e --- /dev/null +++ b/src/tests/custom/async/src/async/main.py @@ -0,0 +1,17 @@ +import asyncio +from cpl_core.application import ApplicationBuilder + +from application import Application +from startup import Startup + + +async def main(): + app_builder = ApplicationBuilder(Application) + app_builder.use_startup(Startup) + app = await app_builder.build_async() + await app.run_async() + + +if __name__ == '__main__': + loop = asyncio.get_event_loop() + loop.run_until_complete(main()) diff --git a/src/tests/custom/async/src/async/startup.py b/src/tests/custom/async/src/async/startup.py new file mode 100644 index 00000000..dadaee3b --- /dev/null +++ b/src/tests/custom/async/src/async/startup.py @@ -0,0 +1,16 @@ +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) + + async def configure_configuration(self, configuration: ConfigurationABC, environment: ApplicationEnvironment) -> ConfigurationABC: + return configuration + + async def configure_services(self, services: ServiceCollectionABC, environment: ApplicationEnvironment) -> ServiceProviderABC: + return services.build_service_provider() diff --git a/src/tests/custom/async/src/tests/__init__.py b/src/tests/custom/async/src/tests/__init__.py new file mode 100644 index 00000000..ad5eca30 --- /dev/null +++ b/src/tests/custom/async/src/tests/__init__.py @@ -0,0 +1 @@ +# imports: diff --git a/src/tests/custom/di/src/di/application.py b/src/tests/custom/di/src/di/application.py index e9f0b4bf..ec91c6ad 100644 --- a/src/tests/custom/di/src/di/application.py +++ b/src/tests/custom/di/src/di/application.py @@ -30,9 +30,9 @@ class Application(ApplicationABC): b = t.service_provider scope1.dispose() - Console.write_line('Disposed:') - ts1: TestService = scope1.service_provider.get_service(TestService) - ts1.run() + #Console.write_line('Disposed:') + #ts1: TestService = scope1.service_provider.get_service(TestService) + #ts1.run() Console.write_line('Scope2') scope2: Scope = self._services.create_scope() From 589ef4fd4caf61e0f693fa9f220ef519410a5bf1 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Sun, 14 Nov 2021 12:32:11 +0100 Subject: [PATCH 6/7] Added logic to generate new projects with async --- .../new/console/source/name/application.py | 56 +++-- .../new/console/source/name/main.py | 224 ++++++++++++------ .../new/console/source/name/startup.py | 60 +++-- src/cpl_cli/command/new_service.py | 7 + src/cpl_cli/source_creator/console_builder.py | 25 +- src/cpl_cli/source_creator/library_builder.py | 21 +- 6 files changed, 271 insertions(+), 122 deletions(-) diff --git a/src/cpl_cli/_templates/new/console/source/name/application.py b/src/cpl_cli/_templates/new/console/source/name/application.py index 8230d308..56d9990f 100644 --- a/src/cpl_cli/_templates/new/console/source/name/application.py +++ b/src/cpl_cli/_templates/new/console/source/name/application.py @@ -5,29 +5,51 @@ from cpl_cli._templates.template_file_abc import TemplateFileABC class ApplicationTemplate(TemplateFileABC): - def __init__(self, name: str, path: str): + def __init__(self, name: str, path: str, use_async: bool): TemplateFileABC.__init__(self) self._name = 'application.py' self._path = path - self._value = textwrap.dedent("""\ - from cpl_core.application import ApplicationABC - from cpl_core.configuration import ConfigurationABC - from cpl_core.console import Console - from cpl_core.dependency_injection import ServiceProviderABC + self._use_async = use_async + + if self._use_async: + self._value = textwrap.dedent("""\ + from cpl_core.application import ApplicationABC + 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): - - def __init__(self, config: ConfigurationABC, services: ServiceProviderABC): - ApplicationABC.__init__(self, config, services) - - def configure(self): - pass - - def main(self): - Console.write_line('Hello World') - """) + async def configure(self): + pass + + async def main(self): + Console.write_line('Hello World') + """) + else: + self._value = textwrap.dedent("""\ + from cpl_core.application import ApplicationABC + 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 def name(self) -> str: diff --git a/src/cpl_cli/_templates/new/console/source/name/main.py b/src/cpl_cli/_templates/new/console/source/name/main.py index 76734058..6d78bf15 100644 --- a/src/cpl_cli/_templates/new/console/source/name/main.py +++ b/src/cpl_cli/_templates/new/console/source/name/main.py @@ -6,31 +6,52 @@ from cpl_cli._templates.template_file_abc import TemplateFileABC class MainWithApplicationHostAndStartupTemplate(TemplateFileABC): - def __init__(self, name: str, path: str): + def __init__(self, name: str, path: str, use_async: bool): TemplateFileABC.__init__(self) name = String.convert_to_snake_case(name) self._name = 'main.py' self._path = path + self._use_async = use_async import_pkg = f'{name}.' - 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() - """) + if use_async: + self._value = textwrap.dedent(f"""\ + from cpl_core.application import ApplicationBuilder + + from {import_pkg}application import Application + from {import_pkg}startup import Startup + + + async def main(): + app_builder = ApplicationBuilder(Application) + app_builder.use_startup(Startup) + app: Application = await app_builder.build_async() + await app.run() + + + 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 def name(self) -> str: @@ -47,29 +68,48 @@ class MainWithApplicationHostAndStartupTemplate(TemplateFileABC): class MainWithApplicationBaseTemplate(TemplateFileABC): - def __init__(self, name: str, path: str): + def __init__(self, name: str, path: str, use_async: bool): TemplateFileABC.__init__(self) name = String.convert_to_snake_case(name) self._name = 'main.py' self._path = path + self._use_async = use_async import_pkg = f'{name}.' - 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() - """) + if use_async: + self._value = textwrap.dedent(f"""\ + from cpl_core.application import ApplicationBuilder + + from {import_pkg}application import Application + + + async def main(): + app_builder = ApplicationBuilder(Application) + app: Application = await app_builder.build_async() + await app.run() + + + 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 def name(self) -> str: @@ -86,26 +126,41 @@ class MainWithApplicationBaseTemplate(TemplateFileABC): class MainWithoutApplicationBaseTemplate(TemplateFileABC): - def __init__(self, name: str, path: str): + def __init__(self, name: str, path: str, use_async: bool): TemplateFileABC.__init__(self) name = String.convert_to_snake_case(name) self._name = 'main.py' self._path = path + self._use_async = use_async import_pkg = f'{name}.' - self._value = textwrap.dedent("""\ - from cpl_core.console import Console - - - def main(): - Console.write_line('Hello World') - - - if __name__ == '__main__': - main() - """) + if use_async: + self._value = textwrap.dedent("""\ + from cpl_core.console import Console + + + async def main(): + Console.write_line('Hello World') + + + 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 def name(self) -> str: @@ -122,40 +177,69 @@ class MainWithoutApplicationBaseTemplate(TemplateFileABC): class MainWithDependencyInjection(TemplateFileABC): - def __init__(self, name: str, path: str): + def __init__(self, name: str, path: str, use_async: bool): TemplateFileABC.__init__(self) name = String.convert_to_snake_case(name) self._name = 'main.py' self._path = path + self._use_async = use_async import_pkg = f'{name}.' - 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() - """) + if use_async: + 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 + + + async def configure_configuration() -> ConfigurationABC: + config = Configuration() + return config + + + async def configure_services(config: ConfigurationABC) -> ServiceProviderABC: + services = ServiceCollection(config) + return services.build_service_provider() + + + async def main(): + await config = configure_configuration() + await provider = configure_services(config) + Console.write_line('Hello World') + + + 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 def name(self) -> str: diff --git a/src/cpl_cli/_templates/new/console/source/name/startup.py b/src/cpl_cli/_templates/new/console/source/name/startup.py index 959bc0ce..f2d51009 100644 --- a/src/cpl_cli/_templates/new/console/source/name/startup.py +++ b/src/cpl_cli/_templates/new/console/source/name/startup.py @@ -5,29 +5,51 @@ from cpl_cli._templates.template_file_abc import TemplateFileABC class StartupTemplate(TemplateFileABC): - def __init__(self, name: str, path: str): + def __init__(self, name: str, path: str, use_async: bool): TemplateFileABC.__init__(self) self._name = 'startup.py' self._path = path - 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() - """) + self._use_async = use_async + + if self._use_async: + 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) + + async def configure_configuration(self, configuration: ConfigurationABC, environment: ApplicationEnvironment) -> ConfigurationABC: + return configuration + + 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 def name(self) -> str: diff --git a/src/cpl_cli/command/new_service.py b/src/cpl_cli/command/new_service.py index c8519192..715f4c8b 100644 --- a/src/cpl_cli/command/new_service.py +++ b/src/cpl_cli/command/new_service.py @@ -46,6 +46,7 @@ class NewService(CommandABC): self._use_application_api: bool = False self._use_startup: bool = False self._use_service_providing: bool = False + self._use_async: bool = False @property def help_message(self) -> str: @@ -177,6 +178,10 @@ class NewService(CommandABC): result = Console.read('Do you want to use service providing? (y/n) ') if result.lower() == 'y': self._use_service_providing = True + + result = Console.read('Do you want to use async? (y/n) ') + if result.lower == 'y': + self._use_async = True Console.set_foreground_color(ForegroundColorEnum.default) @@ -202,6 +207,7 @@ class NewService(CommandABC): self._use_application_api, self._use_startup, self._use_service_providing, + self._use_async, self._project.name, self._project_json, self._workspace @@ -231,6 +237,7 @@ class NewService(CommandABC): self._use_application_api, self._use_startup, self._use_service_providing, + self._use_async, self._project.name, self._project_json, self._workspace diff --git a/src/cpl_cli/source_creator/console_builder.py b/src/cpl_cli/source_creator/console_builder.py index b6e3a91c..1d10d52f 100644 --- a/src/cpl_cli/source_creator/console_builder.py +++ b/src/cpl_cli/source_creator/console_builder.py @@ -59,13 +59,14 @@ class ConsoleBuilder: @classmethod def build(cls, project_path: str, use_application_api: bool, use_startup: bool, use_service_providing: bool, - project_name: str, project_settings: dict, workspace: Optional[WorkspaceSettings]): + use_async: bool, project_name: str, project_settings: dict, workspace: Optional[WorkspaceSettings]): """ Builds the console project files :param project_path: :param use_application_api: :param use_startup: :param use_service_providing: + :param use_async: :param project_name: :param project_settings: :param workspace: @@ -79,7 +80,8 @@ class ConsoleBuilder: ReadmeTemplate(), TestsInitTemplate(), AppsettingsTemplate(), - MainInitTemplate(project_name, os.path.join('src/', project_name_snake)) + MainInitTemplate(project_name, os.path.join( + 'src/', project_name_snake)) ] else: project_path = os.path.join( @@ -103,18 +105,22 @@ class ConsoleBuilder: src_rel_path = os.path.join('src/', src_name) if use_application_api: - templates.append(ApplicationTemplate(src_name, src_rel_path)) + templates.append(ApplicationTemplate(src_name, src_rel_path, use_async)) if use_startup: - templates.append(StartupTemplate(src_name, src_rel_path)) - templates.append(MainWithApplicationHostAndStartupTemplate(src_name, src_rel_path)) + templates.append(StartupTemplate(src_name, src_rel_path, use_async)) + templates.append(MainWithApplicationHostAndStartupTemplate( + src_name, src_rel_path, use_async)) else: - templates.append(MainWithApplicationBaseTemplate(src_name, src_rel_path)) + templates.append(MainWithApplicationBaseTemplate( + src_name, src_rel_path, use_async)) else: if use_service_providing: - templates.append(MainWithDependencyInjection(src_name, src_rel_path)) + templates.append(MainWithDependencyInjection( + src_name, src_rel_path, use_async)) else: - templates.append(MainWithoutApplicationBaseTemplate(src_name, src_rel_path)) + templates.append(MainWithoutApplicationBaseTemplate( + src_name, src_rel_path, use_async)) proj_name = project_name if workspace is not None: @@ -132,7 +138,8 @@ class ConsoleBuilder: else: workspace.projects[project_name] = f'src/{project_file_path}' - cls._create_workspace('cpl-workspace.json', workspace.default_project, workspace.projects) + cls._create_workspace('cpl-workspace.json', + workspace.default_project, workspace.projects) Console.spinner( f'Creating {project_file_path}', diff --git a/src/cpl_cli/source_creator/library_builder.py b/src/cpl_cli/source_creator/library_builder.py index dd009a1e..15268a07 100644 --- a/src/cpl_cli/source_creator/library_builder.py +++ b/src/cpl_cli/source_creator/library_builder.py @@ -59,7 +59,7 @@ class LibraryBuilder: @classmethod def build(cls, project_path: str, use_application_api: bool, use_startup: bool, - use_service_providing: bool, project_name: str, project_settings: dict, + use_async: bool, use_service_providing: bool, project_name: str, project_settings: dict, workspace: Optional[WorkspaceSettings]): """ Builds the library project files @@ -67,6 +67,7 @@ class LibraryBuilder: :param use_application_api: :param use_startup: :param use_service_providing: + :param use_async: :param project_name: :param project_settings: :param workspace: @@ -79,7 +80,8 @@ class LibraryBuilder: LicenseTemplate(), ReadmeTemplate(), TestsInitTemplate(), - NameInitTemplate(project_name, os.path.join('src/', project_name_snake)), + NameInitTemplate(project_name, os.path.join( + 'src/', project_name_snake)), AppsettingsTemplate() ] else: @@ -108,14 +110,18 @@ class LibraryBuilder: if use_startup: templates.append(StartupTemplate(src_name, src_rel_path)) - templates.append(MainWithApplicationHostAndStartupTemplate(src_name, src_rel_path)) + templates.append(MainWithApplicationHostAndStartupTemplate( + src_name, src_rel_path)) else: - templates.append(MainWithApplicationBaseTemplate(src_name, src_rel_path)) + templates.append(MainWithApplicationBaseTemplate( + src_name, src_rel_path)) else: if use_service_providing: - templates.append(MainWithDependencyInjection(src_name, src_rel_path)) + templates.append(MainWithDependencyInjection( + src_name, src_rel_path)) else: - templates.append(MainWithoutApplicationBaseTemplate(src_name, src_rel_path)) + templates.append(MainWithoutApplicationBaseTemplate( + src_name, src_rel_path)) proj_name = project_name if workspace is not None: @@ -133,7 +139,8 @@ class LibraryBuilder: else: workspace.projects[project_name] = f'src/{project_file_path}' - cls._create_workspace('cpl-workspace.json', workspace.default_project, workspace.projects) + cls._create_workspace('cpl-workspace.json', + workspace.default_project, workspace.projects) Console.spinner( f'Creating {project_file_path}', From 57040f85f0fabf6cecc0077d6844f077e55bbe27 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Sun, 14 Nov 2021 12:53:09 +0100 Subject: [PATCH 7/7] Changed versions --- scripts/upload.sh | 18 +- src/cpl_cli/__init__.py | 4 +- src/cpl_cli/_templates/__init__.py | 4 +- src/cpl_cli/_templates/build/__init__.py | 4 +- src/cpl_cli/_templates/generate/__init__.py | 4 +- src/cpl_cli/_templates/new/__init__.py | 4 +- .../_templates/new/console/__init__.py | 4 +- .../_templates/new/console/source/__init__.py | 4 +- .../new/console/source/name/__init__.py | 4 +- .../new/console/source/name/main.py | 20 +- .../new/console/source/tests/__init__.py | 4 +- .../_templates/new/library/__init__.py | 4 +- .../_templates/new/library/source/__init__.py | 4 +- .../new/library/source/name/__init__.py | 4 +- .../new/library/source/name/application.py | 55 +++-- .../new/library/source/name/main.py | 230 ++++++++++++------ .../new/library/source/name/startup.py | 59 +++-- .../new/library/source/tests/__init__.py | 4 +- src/cpl_cli/_templates/publish/__init__.py | 4 +- src/cpl_cli/command/__init__.py | 4 +- src/cpl_cli/command/new_service.py | 2 +- src/cpl_cli/command/version_service.py | 6 +- src/cpl_cli/configuration/__init__.py | 4 +- src/cpl_cli/cpl_cli.json | 4 +- src/cpl_cli/live_server/__init__.py | 4 +- src/cpl_cli/publish/__init__.py | 4 +- src/cpl_cli/source_creator/__init__.py | 4 +- src/cpl_core/application/application_abc.py | 11 - 28 files changed, 304 insertions(+), 177 deletions(-) diff --git a/scripts/upload.sh b/scripts/upload.sh index 9c27227f..8b0d0d73 100644 --- a/scripts/upload.sh +++ b/scripts/upload.sh @@ -1,16 +1,16 @@ #!/bin/bash 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-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-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-query/publish/setup/* 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-core/publish/setup/* - twine upload -r pip-.sh-edraft.de ../dist/sh_cpl-query/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-.sh-edraft.de dist/sh_cpl-query/publish/setup/* 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-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-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-query/publish/setup/* fi diff --git a/src/cpl_cli/__init__.py b/src/cpl_cli/__init__.py index 7af49608..83b7e4cb 100644 --- a/src/cpl_cli/__init__.py +++ b/src/cpl_cli/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_cli' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.2' +__version__ = '2021.10.3' from collections import namedtuple @@ -29,4 +29,4 @@ from .main import main from .startup import Startup VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='2') +version_info = VersionInfo(major='2021', minor='10', micro='3') diff --git a/src/cpl_cli/_templates/__init__.py b/src/cpl_cli/_templates/__init__.py index b3432fda..d58c82b8 100644 --- a/src/cpl_cli/_templates/__init__.py +++ b/src/cpl_cli/_templates/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.2' +__version__ = '2021.10.3' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='2') +version_info = VersionInfo(major='2021', minor='10', micro='3') diff --git a/src/cpl_cli/_templates/build/__init__.py b/src/cpl_cli/_templates/build/__init__.py index 2f641018..fa4b9456 100644 --- a/src/cpl_cli/_templates/build/__init__.py +++ b/src/cpl_cli/_templates/build/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.build' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.2' +__version__ = '2021.10.3' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='2') +version_info = VersionInfo(major='2021', minor='10', micro='3') diff --git a/src/cpl_cli/_templates/generate/__init__.py b/src/cpl_cli/_templates/generate/__init__.py index a625e275..49bf35e1 100644 --- a/src/cpl_cli/_templates/generate/__init__.py +++ b/src/cpl_cli/_templates/generate/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.generate' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.2' +__version__ = '2021.10.3' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='2') +version_info = VersionInfo(major='2021', minor='10', micro='3') diff --git a/src/cpl_cli/_templates/new/__init__.py b/src/cpl_cli/_templates/new/__init__.py index ded8c8ed..305ac63a 100644 --- a/src/cpl_cli/_templates/new/__init__.py +++ b/src/cpl_cli/_templates/new/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.2' +__version__ = '2021.10.3' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='2') +version_info = VersionInfo(major='2021', minor='10', micro='3') diff --git a/src/cpl_cli/_templates/new/console/__init__.py b/src/cpl_cli/_templates/new/console/__init__.py index 2ed4ea3c..ddf58279 100644 --- a/src/cpl_cli/_templates/new/console/__init__.py +++ b/src/cpl_cli/_templates/new/console/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.console' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.2' +__version__ = '2021.10.3' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='2') +version_info = VersionInfo(major='2021', minor='10', micro='3') diff --git a/src/cpl_cli/_templates/new/console/source/__init__.py b/src/cpl_cli/_templates/new/console/source/__init__.py index a567a195..eaadf9b1 100644 --- a/src/cpl_cli/_templates/new/console/source/__init__.py +++ b/src/cpl_cli/_templates/new/console/source/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.console.source' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.2' +__version__ = '2021.10.3' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='2') +version_info = VersionInfo(major='2021', minor='10', micro='3') diff --git a/src/cpl_cli/_templates/new/console/source/name/__init__.py b/src/cpl_cli/_templates/new/console/source/name/__init__.py index 8200673b..e5752ad4 100644 --- a/src/cpl_cli/_templates/new/console/source/name/__init__.py +++ b/src/cpl_cli/_templates/new/console/source/name/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.console.source.name' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.2' +__version__ = '2021.10.3' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='2') +version_info = VersionInfo(major='2021', minor='10', micro='3') diff --git a/src/cpl_cli/_templates/new/console/source/name/main.py b/src/cpl_cli/_templates/new/console/source/name/main.py index 6d78bf15..a489668a 100644 --- a/src/cpl_cli/_templates/new/console/source/name/main.py +++ b/src/cpl_cli/_templates/new/console/source/name/main.py @@ -12,12 +12,13 @@ class MainWithApplicationHostAndStartupTemplate(TemplateFileABC): name = String.convert_to_snake_case(name) self._name = 'main.py' self._path = path - self._use_async = use_async import_pkg = f'{name}.' if use_async: self._value = textwrap.dedent(f"""\ + import asyncio + from cpl_core.application import ApplicationBuilder from {import_pkg}application import Application @@ -28,7 +29,7 @@ class MainWithApplicationHostAndStartupTemplate(TemplateFileABC): app_builder = ApplicationBuilder(Application) app_builder.use_startup(Startup) app: Application = await app_builder.build_async() - await app.run() + await app.run_async() if __name__ == '__main__': @@ -74,12 +75,13 @@ class MainWithApplicationBaseTemplate(TemplateFileABC): name = String.convert_to_snake_case(name) self._name = 'main.py' self._path = path - self._use_async = use_async import_pkg = f'{name}.' if use_async: self._value = textwrap.dedent(f"""\ + import asyncio + from cpl_core.application import ApplicationBuilder from {import_pkg}application import Application @@ -88,7 +90,7 @@ class MainWithApplicationBaseTemplate(TemplateFileABC): async def main(): app_builder = ApplicationBuilder(Application) app: Application = await app_builder.build_async() - await app.run() + await app.run_async() if __name__ == '__main__': @@ -132,12 +134,13 @@ class MainWithoutApplicationBaseTemplate(TemplateFileABC): name = String.convert_to_snake_case(name) self._name = 'main.py' self._path = path - self._use_async = use_async import_pkg = f'{name}.' if use_async: self._value = textwrap.dedent("""\ + import asyncio + from cpl_core.console import Console @@ -183,12 +186,13 @@ class MainWithDependencyInjection(TemplateFileABC): name = String.convert_to_snake_case(name) self._name = 'main.py' self._path = path - self._use_async = use_async import_pkg = f'{name}.' if use_async: self._value = textwrap.dedent("""\ + import asyncio + from cpl_core.configuration import Configuration, ConfigurationABC from cpl_core.console import Console from cpl_core.dependency_injection import ServiceCollection, ServiceProviderABC @@ -205,8 +209,8 @@ class MainWithDependencyInjection(TemplateFileABC): async def main(): - await config = configure_configuration() - await provider = configure_services(config) + config = await configure_configuration() + provider = await configure_services(config) Console.write_line('Hello World') diff --git a/src/cpl_cli/_templates/new/console/source/tests/__init__.py b/src/cpl_cli/_templates/new/console/source/tests/__init__.py index 551c83cb..87cb86d5 100644 --- a/src/cpl_cli/_templates/new/console/source/tests/__init__.py +++ b/src/cpl_cli/_templates/new/console/source/tests/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.console.source.tests' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.2' +__version__ = '2021.10.3' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='2') +version_info = VersionInfo(major='2021', minor='10', micro='3') diff --git a/src/cpl_cli/_templates/new/library/__init__.py b/src/cpl_cli/_templates/new/library/__init__.py index 2c3ea082..6da46ac9 100644 --- a/src/cpl_cli/_templates/new/library/__init__.py +++ b/src/cpl_cli/_templates/new/library/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.library' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.2' +__version__ = '2021.10.3' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='2') +version_info = VersionInfo(major='2021', minor='10', micro='3') diff --git a/src/cpl_cli/_templates/new/library/source/__init__.py b/src/cpl_cli/_templates/new/library/source/__init__.py index da92f04f..62ebe51e 100644 --- a/src/cpl_cli/_templates/new/library/source/__init__.py +++ b/src/cpl_cli/_templates/new/library/source/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.library.source' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.2' +__version__ = '2021.10.3' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='2') +version_info = VersionInfo(major='2021', minor='10', micro='3') diff --git a/src/cpl_cli/_templates/new/library/source/name/__init__.py b/src/cpl_cli/_templates/new/library/source/name/__init__.py index f6edde16..34a6b8ea 100644 --- a/src/cpl_cli/_templates/new/library/source/name/__init__.py +++ b/src/cpl_cli/_templates/new/library/source/name/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.library.source.name' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.2' +__version__ = '2021.10.3' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='2') +version_info = VersionInfo(major='2021', minor='10', micro='3') diff --git a/src/cpl_cli/_templates/new/library/source/name/application.py b/src/cpl_cli/_templates/new/library/source/name/application.py index 8230d308..5ca0b146 100644 --- a/src/cpl_cli/_templates/new/library/source/name/application.py +++ b/src/cpl_cli/_templates/new/library/source/name/application.py @@ -5,29 +5,50 @@ from cpl_cli._templates.template_file_abc import TemplateFileABC class ApplicationTemplate(TemplateFileABC): - def __init__(self, name: str, path: str): + def __init__(self, name: str, path: str, use_async: bool): TemplateFileABC.__init__(self) self._name = 'application.py' self._path = path - self._value = textwrap.dedent("""\ - from cpl_core.application import ApplicationABC - from cpl_core.configuration import ConfigurationABC - from cpl_core.console import Console - from cpl_core.dependency_injection import ServiceProviderABC + + if use_async: + self._value = textwrap.dedent("""\ + from cpl_core.application import ApplicationABC + 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): - - def __init__(self, config: ConfigurationABC, services: ServiceProviderABC): - ApplicationABC.__init__(self, config, services) - - def configure(self): - pass - - def main(self): - Console.write_line('Hello World') - """) + async def configure(self): + pass + + async def main(self): + Console.write_line('Hello World') + """) + else: + self._value = textwrap.dedent("""\ + from cpl_core.application import ApplicationABC + 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 def name(self) -> str: diff --git a/src/cpl_cli/_templates/new/library/source/name/main.py b/src/cpl_cli/_templates/new/library/source/name/main.py index a486428b..9db9f95f 100644 --- a/src/cpl_cli/_templates/new/library/source/name/main.py +++ b/src/cpl_cli/_templates/new/library/source/name/main.py @@ -5,7 +5,7 @@ from cpl_cli._templates.template_file_abc import TemplateFileABC class MainWithApplicationHostAndStartupTemplate(TemplateFileABC): - def __init__(self, name: str, path: str): + def __init__(self, name: str, path: str, use_async: bool): TemplateFileABC.__init__(self) self._name = 'main.py' @@ -15,22 +15,44 @@ class MainWithApplicationHostAndStartupTemplate(TemplateFileABC): if name == '': import_pkg = '' - 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() - """) + if use_async: + self._value = textwrap.dedent(f"""\ + import asyncio + + from cpl_core.application import ApplicationBuilder + + from {import_pkg}application import Application + from {import_pkg}startup import Startup + + + async def main(): + app_builder = ApplicationBuilder(Application) + app_builder.use_startup(Startup) + app: Application = await app_builder.build_async() + 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 def name(self) -> str: @@ -47,7 +69,7 @@ class MainWithApplicationHostAndStartupTemplate(TemplateFileABC): class MainWithApplicationBaseTemplate(TemplateFileABC): - def __init__(self, name: str, path: str): + def __init__(self, name: str, path: str, use_async: bool): TemplateFileABC.__init__(self) self._name = 'main.py' @@ -57,20 +79,40 @@ class MainWithApplicationBaseTemplate(TemplateFileABC): if name == '': import_pkg = '' - 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() - """) + if use_async: + self._value = textwrap.dedent(f"""\ + import asyncio + + from cpl_core.application import ApplicationBuilder + + from {import_pkg}application import Application + + + async def main(): + app_builder = ApplicationBuilder(Application) + app: Application = await app_builder.build_async() + 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 def name(self) -> str: @@ -87,23 +129,39 @@ class MainWithApplicationBaseTemplate(TemplateFileABC): class MainWithoutApplicationBaseTemplate(TemplateFileABC): - def __init__(self, name: str, path: str): + def __init__(self, name: str, path: str, use_async: bool): TemplateFileABC.__init__(self) self._name = 'main.py' self._path = path - self._value = textwrap.dedent("""\ - from cpl_core.console import Console - - - def main(): - Console.write_line('Hello World') - - - if __name__ == '__main__': - main() - """) + if use_async: + self._value = textwrap.dedent("""\ + import asyncio + + from cpl_core.console import Console + + + async def main(): + Console.write_line('Hello World') + + + 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 def name(self) -> str: @@ -120,37 +178,67 @@ class MainWithoutApplicationBaseTemplate(TemplateFileABC): class MainWithDependencyInjection(TemplateFileABC): - def __init__(self, name: str, path: str): + def __init__(self, name: str, path: str, use_async: bool): TemplateFileABC.__init__(self) self._name = 'main.py' self._path = path - - 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() - """) + + if use_async: + self._value = textwrap.dedent("""\ + import asyncio + + from cpl_core.configuration import Configuration, ConfigurationABC + from cpl_core.console import Console + from cpl_core.dependency_injection import ServiceCollection, ServiceProviderABC + + + async def configure_configuration() -> ConfigurationABC: + config = Configuration() + return config + + + async def configure_services(config: ConfigurationABC) -> ServiceProviderABC: + services = ServiceCollection(config) + return services.build_service_provider() + + + async def main(): + config = await configure_configuration() + provider = await configure_services(config) + Console.write_line('Hello World') + + + 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 def name(self) -> str: diff --git a/src/cpl_cli/_templates/new/library/source/name/startup.py b/src/cpl_cli/_templates/new/library/source/name/startup.py index 959bc0ce..fcfe0b8b 100644 --- a/src/cpl_cli/_templates/new/library/source/name/startup.py +++ b/src/cpl_cli/_templates/new/library/source/name/startup.py @@ -5,29 +5,50 @@ from cpl_cli._templates.template_file_abc import TemplateFileABC class StartupTemplate(TemplateFileABC): - def __init__(self, name: str, path: str): + def __init__(self, name: str, path: str, use_async: bool): TemplateFileABC.__init__(self) self._name = 'startup.py' self._path = path - 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() - """) + + if use_async: + 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) + + async def configure_configuration(self, configuration: ConfigurationABC, environment: ApplicationEnvironment) -> ConfigurationABC: + return configuration + + 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 def name(self) -> str: diff --git a/src/cpl_cli/_templates/new/library/source/tests/__init__.py b/src/cpl_cli/_templates/new/library/source/tests/__init__.py index 509ba102..30c8cb2f 100644 --- a/src/cpl_cli/_templates/new/library/source/tests/__init__.py +++ b/src/cpl_cli/_templates/new/library/source/tests/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.library.source.tests' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.2' +__version__ = '2021.10.3' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='2') +version_info = VersionInfo(major='2021', minor='10', micro='3') diff --git a/src/cpl_cli/_templates/publish/__init__.py b/src/cpl_cli/_templates/publish/__init__.py index ef3ffab3..22dda426 100644 --- a/src/cpl_cli/_templates/publish/__init__.py +++ b/src/cpl_cli/_templates/publish/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.publish' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.2' +__version__ = '2021.10.3' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='2') +version_info = VersionInfo(major='2021', minor='10', micro='3') diff --git a/src/cpl_cli/command/__init__.py b/src/cpl_cli/command/__init__.py index ca2ad5c7..47f70034 100644 --- a/src/cpl_cli/command/__init__.py +++ b/src/cpl_cli/command/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_cli.command' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.2' +__version__ = '2021.10.3' from collections import namedtuple @@ -28,4 +28,4 @@ from .publish_service import PublishService from .version_service import VersionService VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='2') +version_info = VersionInfo(major='2021', minor='10', micro='3') diff --git a/src/cpl_cli/command/new_service.py b/src/cpl_cli/command/new_service.py index 715f4c8b..1d5b9d5b 100644 --- a/src/cpl_cli/command/new_service.py +++ b/src/cpl_cli/command/new_service.py @@ -180,7 +180,7 @@ class NewService(CommandABC): self._use_service_providing = True result = Console.read('Do you want to use async? (y/n) ') - if result.lower == 'y': + if result.lower() == 'y': self._use_async = True Console.set_foreground_color(ForegroundColorEnum.default) diff --git a/src/cpl_cli/command/version_service.py b/src/cpl_cli/command/version_service.py index 5f8050ef..f68c9b16 100644 --- a/src/cpl_cli/command/version_service.py +++ b/src/cpl_cli/command/version_service.py @@ -52,7 +52,11 @@ class VersionService(CommandABC): ] 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): packages.append([f'{modname}', module.__version__]) diff --git a/src/cpl_cli/configuration/__init__.py b/src/cpl_cli/configuration/__init__.py index 856d8c5d..5a03bb48 100644 --- a/src/cpl_cli/configuration/__init__.py +++ b/src/cpl_cli/configuration/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_cli.configuration' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.2' +__version__ = '2021.10.3' from collections import namedtuple @@ -30,4 +30,4 @@ from .workspace_settings import WorkspaceSettings from .workspace_settings_name_enum import WorkspaceSettingsNameEnum VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='2') +version_info = VersionInfo(major='2021', minor='10', micro='3') diff --git a/src/cpl_cli/cpl_cli.json b/src/cpl_cli/cpl_cli.json index aebc9fe6..6f7578f3 100644 --- a/src/cpl_cli/cpl_cli.json +++ b/src/cpl_cli/cpl_cli.json @@ -4,7 +4,7 @@ "Version": { "Major": "2021", "Minor": "10", - "Micro": "2" + "Micro": "3" }, "Author": "Sven Heidemann", "AuthorEmail": "sven.heidemann@sh-edraft.de", @@ -16,7 +16,7 @@ "LicenseName": "MIT", "LicenseDescription": "MIT, see LICENSE for more details.", "Dependencies": [ - "sh_cpl-core>=2021.10.0.post1" + "sh_cpl-core>=2021.10.2" ], "PythonVersion": ">=3.8", "PythonPath": {}, diff --git a/src/cpl_cli/live_server/__init__.py b/src/cpl_cli/live_server/__init__.py index c414dac3..a80cc10a 100644 --- a/src/cpl_cli/live_server/__init__.py +++ b/src/cpl_cli/live_server/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli.live_server' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.2' +__version__ = '2021.10.3' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='2') +version_info = VersionInfo(major='2021', minor='10', micro='3') diff --git a/src/cpl_cli/publish/__init__.py b/src/cpl_cli/publish/__init__.py index b62f9083..d312caa7 100644 --- a/src/cpl_cli/publish/__init__.py +++ b/src/cpl_cli/publish/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_cli.publish' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.2' +__version__ = '2021.10.3' from collections import namedtuple @@ -24,4 +24,4 @@ from .publisher_abc import PublisherABC from .publisher_service import PublisherService VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='2') +version_info = VersionInfo(major='2021', minor='10', micro='3') diff --git a/src/cpl_cli/source_creator/__init__.py b/src/cpl_cli/source_creator/__init__.py index 4c8d75f1..fe409fa3 100644 --- a/src/cpl_cli/source_creator/__init__.py +++ b/src/cpl_cli/source_creator/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli.source_creator' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.2' +__version__ = '2021.10.3' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='2') +version_info = VersionInfo(major='2021', minor='10', micro='3') diff --git a/src/cpl_core/application/application_abc.py b/src/cpl_core/application/application_abc.py index 37d28d26..037a73d2 100644 --- a/src/cpl_core/application/application_abc.py +++ b/src/cpl_core/application/application_abc.py @@ -35,17 +35,6 @@ class ApplicationABC(ABC): except KeyboardInterrupt: 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): r"""Entry point