This commit is contained in:
Sven Heidemann 2021-03-30 12:44:31 +02:00
parent 3428c70b69
commit 0da83935fc
22 changed files with 807 additions and 76 deletions

View File

@ -15,16 +15,10 @@ from cpl_cli.configuration.build_settings import BuildSettings
from cpl_cli.configuration.build_settings_name_enum import BuildSettingsNameEnum from cpl_cli.configuration.build_settings_name_enum import BuildSettingsNameEnum
from cpl_cli.configuration.project_settings import ProjectSettings from cpl_cli.configuration.project_settings import ProjectSettings
from cpl_cli.configuration.project_settings_name_enum import ProjectSettingsNameEnum from cpl_cli.configuration.project_settings_name_enum import ProjectSettingsNameEnum
from cpl_cli.configuration.project_type_enum import ProjectTypeEnum
from cpl_cli.configuration.version_settings_name_enum import VersionSettingsNameEnum from cpl_cli.configuration.version_settings_name_enum import VersionSettingsNameEnum
from cpl_cli.templates.new.console.appsettings_json import AppsettingsTemplate from cpl_cli.source_creator.console_builder import ConsoleBuilder
from cpl_cli.templates.new.console.license import LicenseTemplate from cpl_cli.source_creator.library_builder import LibraryBuilder
from cpl_cli.templates.new.console.readme_py import ReadmeTemplate
from cpl_cli.templates.new.console.src.application import ApplicationTemplate
from cpl_cli.templates.new.console.src.main import MainWithApplicationHostAndStartupTemplate, \
MainWithoutApplicationBaseTemplate, MainWithApplicationBaseTemplate, MainWithDependencyInjection
from cpl_cli.templates.new.console.src.startup import StartupTemplate
from cpl_cli.templates.new.console.src.tests.init import TestsInitTemplate
from cpl_cli.templates.template_file_abc import TemplateFileABC
class NewService(CommandABC): class NewService(CommandABC):
@ -96,11 +90,15 @@ class NewService(CommandABC):
self._project.from_dict(self._project_dict) self._project.from_dict(self._project_dict)
def _create_build_settings(self): def _create_build_settings(self):
main = 'main'
if self._command == ProjectTypeEnum.library.value:
main = f'{self._project.name}_cli.main'
self._build_dict = { self._build_dict = {
BuildSettingsNameEnum.project_type.value: self._command, BuildSettingsNameEnum.project_type.value: self._command,
BuildSettingsNameEnum.source_path.value: 'src', BuildSettingsNameEnum.source_path.value: 'src',
BuildSettingsNameEnum.output_path.value: 'dist', BuildSettingsNameEnum.output_path.value: 'dist',
BuildSettingsNameEnum.main.value: 'main', BuildSettingsNameEnum.main.value: main,
BuildSettingsNameEnum.entry_point.value: self._project.name, BuildSettingsNameEnum.entry_point.value: self._project.name,
BuildSettingsNameEnum.include_package_data.value: False, BuildSettingsNameEnum.include_package_data.value: False,
BuildSettingsNameEnum.included.value: [], BuildSettingsNameEnum.included.value: [],
@ -154,68 +152,6 @@ class NewService(CommandABC):
Console.set_foreground_color(ForegroundColorEnum.default) Console.set_foreground_color(ForegroundColorEnum.default)
def _build_project_dir(self, project_path: str):
"""
Builds the project files
:param project_path:
:return:
"""
if not os.path.isdir(project_path):
os.makedirs(project_path)
with open(os.path.join(project_path, 'cpl.json'), 'w') as project_json:
project_json.write(json.dumps(self._project_json, indent=2))
project_json.close()
templates: list[TemplateFileABC] = [
LicenseTemplate(),
ReadmeTemplate(),
TestsInitTemplate(),
AppsettingsTemplate()
]
if self._use_application_api:
templates.append(ApplicationTemplate())
if self._use_startup:
templates.append(StartupTemplate())
templates.append(MainWithApplicationHostAndStartupTemplate())
else:
templates.append(MainWithApplicationBaseTemplate())
else:
if self._use_service_providing:
templates.append(MainWithDependencyInjection())
else:
templates.append(MainWithoutApplicationBaseTemplate())
for template in templates:
Console.spinner(
f'Creating {self._project.name}/{template.path}{template.name}',
self._create_template,
project_path,
template,
text_foreground_color=ForegroundColorEnum.green,
spinner_foreground_color=ForegroundColorEnum.cyan
)
@staticmethod
def _create_template(project_path: str, template: TemplateFileABC):
"""
Creates template
:param project_path:
:param template:
:return:
"""
file_path = os.path.join(project_path, template.path, template.name)
file_rel_path = os.path.join(project_path, template.path)
if not os.path.isdir(file_rel_path):
os.makedirs(file_rel_path)
with open(file_path, 'w') as license_file:
license_file.write(template.value)
license_file.close()
def _console(self, args: list[str]): def _console(self, args: list[str]):
""" """
Generates new console project Generates new console project
@ -233,7 +169,42 @@ class NewService(CommandABC):
self._get_project_information() self._get_project_information()
try: try:
self._build_project_dir(path) ConsoleBuilder.build(
path,
self._use_application_api,
self._use_startup,
self._use_service_providing,
self._project.name,
self._project_json
)
except Exception as e:
Console.error('Could not create project', str(e))
def _library(self, args: list[str]):
"""
Generates new library project
:param args:
:return:
"""
name = self._config.get_configuration(self._command)
self._create_project_settings(name)
self._create_build_settings()
self._create_project_json()
path = self._get_project_path()
if path is None:
return
self._get_project_information()
try:
LibraryBuilder.build(
path,
self._use_application_api,
self._use_startup,
self._use_service_providing,
self._project.name,
self._project_json
)
except Exception as e: except Exception as e:
Console.error('Could not create project', str(e)) Console.error('Could not create project', str(e))
@ -247,10 +218,13 @@ class NewService(CommandABC):
self._help('Usage: cpl new <schematic> [options]') self._help('Usage: cpl new <schematic> [options]')
return return
self._command = args[0] self._command = str(args[0]).lower()
if self._command == 'console': if self._command == ProjectTypeEnum.console.value:
self._console(args) self._console(args)
elif self._command == ProjectTypeEnum.library.value:
self._library(args)
else: else:
self._help('Usage: cpl new <schematic> [options]') self._help('Usage: cpl new <schematic> [options]')
return return

View File

@ -9,6 +9,7 @@ from watchdog.observers import Observer
from cpl.console.console import Console from cpl.console.console import Console
from cpl.environment.application_environment_abc import ApplicationEnvironmentABC from cpl.environment.application_environment_abc import ApplicationEnvironmentABC
from cpl_cli.configuration.build_settings import BuildSettings from cpl_cli.configuration.build_settings import BuildSettings
from cpl_cli.configuration.project_type_enum import ProjectTypeEnum
from cpl_cli.live_server.live_server_thread import LiveServerThread from cpl_cli.live_server.live_server_thread import LiveServerThread
@ -80,5 +81,9 @@ class LiveServerService(FileSystemEventHandler):
Starts the CPL live development server Starts the CPL live development server
:return: :return:
""" """
if self._build_settings.project_type == ProjectTypeEnum.library.value:
Console.error(f'Project cannot be a {ProjectTypeEnum.library.value} to be started')
return
Console.write_line('** CPL live development server is running **') Console.write_line('** CPL live development server is running **')
self._start() self._start()

View File

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
"""
sh_cpl sh-edraft Common Python library
~~~~~~~~~~~~~~~~~~~
sh-edraft Common Python library
:copyright: (c) 2020 - 2021 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'cpl_cli.source_creator'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
__version__ = '2021.4.0rc2'
from collections import namedtuple
# imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2021', minor='04', micro='0rc2')

View File

@ -0,0 +1,71 @@
import json
import os
from cpl.console.foreground_color_enum import ForegroundColorEnum
from cpl.console.console import Console
from cpl_cli.source_creator.template_builder import TemplateBuilder
from cpl_cli.templates.new.console.appsettings_json import AppsettingsTemplate
from cpl_cli.templates.new.console.license import LicenseTemplate
from cpl_cli.templates.new.console.readme_py import ReadmeTemplate
from cpl_cli.templates.new.console.src.application import ApplicationTemplate
from cpl_cli.templates.new.console.src.main import MainWithApplicationHostAndStartupTemplate, \
MainWithoutApplicationBaseTemplate, MainWithApplicationBaseTemplate, MainWithDependencyInjection
from cpl_cli.templates.new.console.src.startup import StartupTemplate
from cpl_cli.templates.new.console.src.tests.init import TestsInitTemplate
from cpl_cli.templates.template_file_abc import TemplateFileABC
class ConsoleBuilder:
def __init__(self):
pass
@staticmethod
def build(project_path: str, use_application_api: bool, use_startup: bool, use_service_providing: bool,
project_name: str, project_settings: dict):
"""
Builds the console project files
:param project_path:
:param use_application_api:
:param use_startup:
:param use_service_providing:
:param project_name:
:param project_settings:
:return:
"""
if not os.path.isdir(project_path):
os.makedirs(project_path)
with open(os.path.join(project_path, 'cpl.json'), 'w') as project_json:
project_json.write(json.dumps(project_settings, indent=2))
project_json.close()
templates: list[TemplateFileABC] = [
LicenseTemplate(),
ReadmeTemplate(),
TestsInitTemplate(),
AppsettingsTemplate()
]
if use_application_api:
templates.append(ApplicationTemplate())
if use_startup:
templates.append(StartupTemplate())
templates.append(MainWithApplicationHostAndStartupTemplate())
else:
templates.append(MainWithApplicationBaseTemplate())
else:
if use_service_providing:
templates.append(MainWithDependencyInjection())
else:
templates.append(MainWithoutApplicationBaseTemplate())
for template in templates:
Console.spinner(
f'Creating {project_name}/{template.path}{template.name}',
TemplateBuilder.build,
project_path,
template,
text_foreground_color=ForegroundColorEnum.green,
spinner_foreground_color=ForegroundColorEnum.cyan
)

View File

@ -0,0 +1,73 @@
import json
import os
from cpl.console.foreground_color_enum import ForegroundColorEnum
from cpl.console.console import Console
from cpl_cli.source_creator.template_builder import TemplateBuilder
from cpl_cli.templates.new.library.appsettings_json import AppsettingsTemplate
from cpl_cli.templates.new.library.license import LicenseTemplate
from cpl_cli.templates.new.library.readme_py import ReadmeTemplate
from cpl_cli.templates.new.library.src.cli.application import ApplicationTemplate
from cpl_cli.templates.new.library.src.cli.init import CLIInitTemplate
from cpl_cli.templates.new.library.src.cli.main import MainWithApplicationHostAndStartupTemplate, \
MainWithoutApplicationBaseTemplate, MainWithApplicationBaseTemplate, MainWithDependencyInjection
from cpl_cli.templates.new.library.src.cli.startup import StartupTemplate
from cpl_cli.templates.new.library.src.tests.init import TestsInitTemplate
from cpl_cli.templates.template_file_abc import TemplateFileABC
class LibraryBuilder:
def __init__(self):
pass
@staticmethod
def build(project_path: str, use_application_api: bool, use_startup: bool, use_service_providing: bool,
project_name: str, project_settings: dict):
"""
Builds the library project files
:param project_path:
:param use_application_api:
:param use_startup:
:param use_service_providing:
:param project_name:
:param project_settings:
:return:
"""
if not os.path.isdir(project_path):
os.makedirs(project_path)
with open(os.path.join(project_path, 'cpl.json'), 'w') as project_json:
project_json.write(json.dumps(project_settings, indent=2))
project_json.close()
templates: list[TemplateFileABC] = [
LicenseTemplate(),
ReadmeTemplate(),
TestsInitTemplate(),
CLIInitTemplate(project_name),
AppsettingsTemplate()
]
if use_application_api:
templates.append(ApplicationTemplate(project_name))
if use_startup:
templates.append(StartupTemplate(project_name))
templates.append(MainWithApplicationHostAndStartupTemplate(project_name))
else:
templates.append(MainWithApplicationBaseTemplate())
else:
if use_service_providing:
templates.append(MainWithDependencyInjection())
else:
templates.append(MainWithoutApplicationBaseTemplate())
for template in templates:
Console.spinner(
f'Creating {project_name}/{template.path}{template.name}',
TemplateBuilder.build,
project_path,
template,
text_foreground_color=ForegroundColorEnum.green,
spinner_foreground_color=ForegroundColorEnum.cyan
)

View File

@ -0,0 +1,24 @@
import os
from cpl_cli.templates.template_file_abc import TemplateFileABC
class TemplateBuilder:
@staticmethod
def build(project_path: str, template: TemplateFileABC):
"""
Creates template
:param project_path:
:param template:
:return:
"""
file_path = os.path.join(project_path, template.path, template.name)
file_rel_path = os.path.join(project_path, template.path)
if not os.path.isdir(file_rel_path):
os.makedirs(file_rel_path)
with open(file_path, 'w') as license_file:
license_file.write(template.value)
license_file.close()

View File

@ -52,7 +52,8 @@ class Startup(StartupABC):
ConsoleArgument('', 'install', ['i', 'I'], ' ', is_value_token_optional=True) ConsoleArgument('', 'install', ['i', 'I'], ' ', is_value_token_optional=True)
) )
self._configuration.add_console_argument(ConsoleArgument('', 'new', ['n', 'N'], '', console_arguments=[ self._configuration.add_console_argument(ConsoleArgument('', 'new', ['n', 'N'], '', console_arguments=[
ConsoleArgument('', 'console', ['c', 'C'], ' ') ConsoleArgument('', 'console', ['c', 'C'], ' '),
ConsoleArgument('', 'library', ['l', 'L'], ' ')
])) ]))
self._configuration.add_console_argument(ConsoleArgument('', 'publish', ['p', 'P'], '')) self._configuration.add_console_argument(ConsoleArgument('', 'publish', ['p', 'P'], ''))
self._configuration.add_console_argument(ConsoleArgument('', 'start', ['s', 'S'], '')) self._configuration.add_console_argument(ConsoleArgument('', 'start', ['s', 'S'], ''))

View File

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
"""
sh_cpl sh-edraft Common Python library
~~~~~~~~~~~~~~~~~~~
sh-edraft Common Python library
:copyright: (c) 2020 - 2021 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'cpl_cli.templates.new.library'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
__version__ = '2021.4.0rc2'
from collections import namedtuple
# imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2021', minor='04', micro='0rc2')

View File

@ -0,0 +1,41 @@
import textwrap
from cpl_cli.templates.template_file_abc import TemplateFileABC
class AppsettingsTemplate(TemplateFileABC):
def __init__(self):
TemplateFileABC.__init__(self)
self._name = 'appsettings.json'
self._path = ''
self._value = textwrap.dedent("""\
{
"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"
}
}
""")
@property
def name(self) -> str:
return self._name
@property
def path(self) -> str:
return self._path
@property
def value(self) -> str:
return self._value

View File

@ -0,0 +1,23 @@
from cpl_cli.templates.template_file_abc import TemplateFileABC
class LicenseTemplate(TemplateFileABC):
def __init__(self):
TemplateFileABC.__init__(self)
self._name = 'LICENSE'
self._path = ''
self._value = """"""
@property
def name(self) -> str:
return self._name
@property
def path(self) -> str:
return self._path
@property
def value(self) -> str:
return self._value

View File

@ -0,0 +1,23 @@
from cpl_cli.templates.template_file_abc import TemplateFileABC
class ReadmeTemplate(TemplateFileABC):
def __init__(self):
TemplateFileABC.__init__(self)
self._name = 'README.md'
self._path = ''
self._value = """"""
@property
def name(self) -> str:
return self._name
@property
def path(self) -> str:
return self._path
@property
def value(self) -> str:
return self._value

View File

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
"""
sh_cpl sh-edraft Common Python library
~~~~~~~~~~~~~~~~~~~
sh-edraft Common Python library
:copyright: (c) 2020 - 2021 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'cpl_cli.templates.new.library.src'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
__version__ = '2021.4.0rc2'
from collections import namedtuple
# imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2021', minor='04', micro='0rc2')

View File

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
"""
sh_cpl sh-edraft Common Python library
~~~~~~~~~~~~~~~~~~~
sh-edraft Common Python library
:copyright: (c) 2020 - 2021 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'cpl_cli.templates.new.library.src.cli'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
__version__ = '2021.4.0rc2'
from collections import namedtuple
# imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2021', minor='04', micro='0rc2')

View File

@ -0,0 +1,42 @@
import textwrap
from cpl_cli.templates.template_file_abc import TemplateFileABC
class ApplicationTemplate(TemplateFileABC):
def __init__(self, name: str):
TemplateFileABC.__init__(self)
self._name = 'application.py'
self._path = f'src/{name}_cli/'
self._value = textwrap.dedent("""\
from cpl.application import ApplicationABC
from cpl.configuration import ConfigurationABC
from cpl.console import Console
from cpl.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:
return self._name
@property
def path(self) -> str:
return self._path
@property
def value(self) -> str:
return self._value

View File

@ -0,0 +1,27 @@
import textwrap
from cpl_cli.templates.template_file_abc import TemplateFileABC
class CLIInitTemplate(TemplateFileABC):
def __init__(self, name: str):
TemplateFileABC.__init__(self)
self._name = '__init__.py'
self._path = f'src/{name}_cli/'
self._value = textwrap.dedent("""\
# imports:
""")
@property
def name(self) -> str:
return self._name
@property
def path(self) -> str:
return self._path
@property
def value(self) -> str:
return self._value

View File

@ -0,0 +1,153 @@
import textwrap
from cpl_cli.templates.template_file_abc import TemplateFileABC
class MainWithApplicationHostAndStartupTemplate(TemplateFileABC):
def __init__(self, name: str):
TemplateFileABC.__init__(self)
self._name = 'main.py'
self._path = f'src/{name}_cli/'
self._value = textwrap.dedent("""\
from cpl.application import ApplicationBuilder
from application import Application
from 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:
return self._name
@property
def path(self) -> str:
return self._path
@property
def value(self) -> str:
return self._value
class MainWithApplicationBaseTemplate(TemplateFileABC):
def __init__(self):
TemplateFileABC.__init__(self)
self._name = 'main.py'
self._path = 'src/'
self._value = textwrap.dedent("""\
from cpl.application import ApplicationBuilder
from application import Application
def main():
app_builder = ApplicationBuilder(Application)
app_builder.build().run()
if __name__ == '__main__':
main()
""")
@property
def name(self) -> str:
return self._name
@property
def path(self) -> str:
return self._path
@property
def value(self) -> str:
return self._value
class MainWithoutApplicationBaseTemplate(TemplateFileABC):
def __init__(self):
TemplateFileABC.__init__(self)
self._name = 'main.py'
self._path = 'src/'
self._value = textwrap.dedent("""\
from cpl.console import Console
def main():
Console.write_line('Hello World')
if __name__ == '__main__':
main()
""")
@property
def name(self) -> str:
return self._name
@property
def path(self) -> str:
return self._path
@property
def value(self) -> str:
return self._value
class MainWithDependencyInjection(TemplateFileABC):
def __init__(self):
TemplateFileABC.__init__(self)
self._name = 'main.py'
self._path = 'src/'
self._value = textwrap.dedent("""\
from cpl.configuration import Configuration, ConfigurationABC
from cpl.console import Console
from cpl.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:
return self._name
@property
def path(self) -> str:
return self._path
@property
def value(self) -> str:
return self._value

View File

@ -0,0 +1,45 @@
import textwrap
from cpl_cli.templates.template_file_abc import TemplateFileABC
class StartupTemplate(TemplateFileABC):
def __init__(self, name: str):
TemplateFileABC.__init__(self)
self._name = 'startup.py'
self._path = f'src/{name}_cli/'
self._value = textwrap.dedent("""\
from cpl.application import StartupABC
from cpl.configuration import ConfigurationABC
from cpl.dependency_injection import ServiceProviderABC, ServiceCollectionABC
class Startup(StartupABC):
def __init__(self, config: ConfigurationABC, services: ServiceCollectionABC):
StartupABC.__init__(self)
self._configuration = config
self._environment = self._configuration.environment
self._services = services
def configure_configuration(self) -> ConfigurationABC:
return self._configuration
def configure_services(self) -> ServiceProviderABC:
return self._services.build_service_provider()
""")
@property
def name(self) -> str:
return self._name
@property
def path(self) -> str:
return self._path
@property
def value(self) -> str:
return self._value

View File

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
"""
sh_cpl sh-edraft Common Python library
~~~~~~~~~~~~~~~~~~~
sh-edraft Common Python library
:copyright: (c) 2020 - 2021 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'cpl_cli.templates.new.library.src.name'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
__version__ = '2021.4.0rc2'
from collections import namedtuple
# imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2021', minor='04', micro='0rc2')

View File

@ -0,0 +1,27 @@
import textwrap
from cpl_cli.templates.template_file_abc import TemplateFileABC
class TestsInitTemplate(TemplateFileABC):
def __init__(self, name: str):
TemplateFileABC.__init__(self)
self._name = '__init__.py'
self._path = f'src/{name}/'
self._value = textwrap.dedent("""\
# imports:
""")
@property
def name(self) -> str:
return self._name
@property
def path(self) -> str:
return self._path
@property
def value(self) -> str:
return self._value

View File

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
"""
sh_cpl sh-edraft Common Python library
~~~~~~~~~~~~~~~~~~~
sh-edraft Common Python library
:copyright: (c) 2020 - 2021 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'cpl_cli.templates.new.library.src.tests'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
__version__ = '2021.4.0rc2'
from collections import namedtuple
# imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2021', minor='04', micro='0rc2')

View File

@ -0,0 +1,27 @@
import textwrap
from cpl_cli.templates.template_file_abc import TemplateFileABC
class TestsInitTemplate(TemplateFileABC):
def __init__(self):
TemplateFileABC.__init__(self)
self._name = '__init__.py'
self._path = 'src/tests/'
self._value = textwrap.dedent("""\
# imports:
""")
@property
def name(self) -> str:
return self._name
@property
def path(self) -> str:
return self._path
@property
def value(self) -> str:
return self._value

View File

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
"""
test2
~~~~~~~~~~~~~~~~~~~
:copyright: (c)
:license:
"""
__title__ = 'test2.test2'
__author__ = ''
__license__ = ''
__copyright__ = 'Copyright (c) '
__version__ = '0.0.0'
from collections import namedtuple
# imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='0', minor='0', micro='0')