Compare commits

..

749 Commits

Author SHA1 Message Date
b6cf5962aa Merge pull request 'Removed tools & docs' (#197) from dev_cleanup into master
Reviewed-on: #197
2025-10-08 21:30:47 +02:00
d3084041a9 Removed tools & docs 2025-10-08 21:30:01 +02:00
c1e65bf0dc Set correct version 2024-07-25 17:56:25 +02:00
688381b106 Merge pull request 'py12' (#177) from py12 into master
Reviewed-on: sh-edraft.de/sh_cpl#177
2024-07-25 17:55:07 +02:00
c3e3367264 Removed bundle project 2024-07-25 17:54:24 +02:00
c3d51e29fc Set version 2024-07-25 17:34:24 +02:00
cae2e6d92e Hopefully fixed db errors 2024-01-13 14:26:36 +01:00
347418bdc5 Added ssl_disabled option 2023-12-06 17:56:13 +01:00
153fc8922e Fixed dc collection 2023-10-13 15:20:26 +02:00
cdbfaeb013 Merge pull request 'Updated deps' (#176) from 2023.10 into master
Reviewed-on: sh-edraft.de/sh_cpl#176
2023-10-13 15:01:06 +02:00
4062a6ebe4 Updated deps 2023-10-13 14:57:46 +02:00
46ef6b3938 Merge pull request '2023.10' (#175) from 2023.10 into master
Reviewed-on: sh-edraft.de/sh_cpl#175
2023-10-13 14:48:39 +02:00
c1b9c0fb4a Added R as return type 2023-10-12 21:20:36 +02:00
8ede2998fe Fixed configuration typing 2023-10-12 21:14:49 +02:00
41f974fe6e Fixed cpl-discord deps 2023-10-12 21:06:10 +02:00
e7af5ce322 Fixed cpl-query typing 2023-10-12 21:05:38 +02:00
7881294554 Fixed types 2023-10-12 20:55:24 +02:00
b3fd122fcd Build cpl-discord new version 2023-10-12 20:42:24 +02:00
1dd48899d7 Improved cpl-discords service loading for commands and events 2023-10-12 20:41:34 +02:00
f357e97ce5 Build and formatted new version 2023-10-12 20:16:16 +02:00
2d8ecd424a Switched mysql package 2023-10-12 20:11:14 +02:00
affbbc822d Removed handled vars from values in JP 2023-07-19 11:34:19 +02:00
43ea732c5f Fixed config loading 2023-07-19 11:28:33 +02:00
708918464f Improved config loading 2023-07-19 11:16:04 +02:00
ed2377c288 Updated discord.py 2023-06-13 16:22:54 +02:00
b819eb439c Fixed translaiton settings 2023-06-13 16:14:38 +02:00
b3ed7101fc Fixed update command 2023-06-13 15:56:46 +02:00
a3504af376 Fixed update command 2023-06-13 15:47:44 +02:00
81c2f1cba9 Fixed discord service config loading 2023-06-13 15:38:04 +02:00
bea5b22251 Fixed db settings default port 2023-06-13 15:08:04 +02:00
e04d0beb68 Fixed circular import from query package 2023-06-13 13:27:37 +02:00
08ba097aaa Merge pull request '#173' (#174) from #173 into master
Reviewed-on: sh-edraft.de/sh_cpl#174
2023-06-12 20:48:34 +02:00
ea968d94e4 Build app 2023-06-12 20:47:14 +02:00
8e12c72b07 Fixed cpl update dev deps bug #170 2023-06-12 20:47:13 +02:00
8dee4d8f70 Fixed config type 2023-04-15 11:47:31 +02:00
315b8e631a Merge pull request '2023.4' (#168) from 2023.4 into master
Reviewed-on: sh-edraft.de/sh_cpl#168
2023-04-12 13:57:50 +02:00
cbb1860f25 Fixed internal settings 2023-04-12 13:47:38 +02:00
9839bcaa14 Removed unused imports 2023-04-12 13:34:43 +02:00
da54337221 Fixed ProjectSettings 2023-04-12 13:31:59 +02:00
a6a1e764d1 Updated deps 2023-04-12 13:30:13 +02:00
eb6aa08c10 Updated deps 2023-04-12 12:57:58 +02:00
14a190a67f Merge pull request '#166' (#167) from #166 into 2023.4
Reviewed-on: sh-edraft.de/sh_cpl#167
Closes #166
2023-04-11 14:49:21 +02:00
cf5ae89884 Fixed start test 2023-04-11 14:26:17 +02:00
558dfb8ced Deactivated test output 2023-04-11 12:51:49 +02:00
2ec8fc22b3 Improved generic type hints 2023-04-11 12:50:05 +02:00
c94700495b Merge pull request '#157' (#165) from #157 into 2023.4
Reviewed-on: sh-edraft.de/sh_cpl#165
Closes #157
2023-04-11 11:48:48 +02:00
69a3bc5e31 Fixed cwd handling 2023-04-10 15:10:39 +02:00
d189f49418 Improved service_provider_tests 2023-04-10 14:53:59 +02:00
60fb416b67 Added service_provider_tests 2023-04-10 14:47:25 +02:00
792429d19d Added console argument tests 2023-04-10 13:35:11 +02:00
106975015e Improved config tests 2023-04-09 12:51:57 +02:00
1117735f2e Added configuration tests & improved json parsing by converting into target types 2023-04-09 12:31:31 +02:00
0378f8944a Added AppEnv tests 2023-04-09 12:05:05 +02:00
75fde0f444 Added pipe tests 2023-04-07 14:52:17 +02:00
04f610c799 Removed obsolete pipes 2023-04-07 14:41:11 +02:00
3178b59147 Added JSONProcessorTestCase 2023-04-07 14:40:03 +02:00
9c7008e179 Improved core test suite 2023-04-07 14:08:06 +02:00
7ff7dbc56b Added core test suite 2023-04-07 14:04:39 +02:00
823d524a81 Added core.utils.string tests & fixed some functions 2023-04-07 14:03:45 +02:00
1b60debba7 Fixed cli schematics & added tests 2023-04-07 13:42:20 +02:00
3fc713cc8d Merge pull request '#154' (#164) from #154 into 2023.4
Reviewed-on: sh-edraft.de/sh_cpl#164
Closes #154
2023-04-05 22:30:38 +02:00
bb26c7e94d Updated docs 2023-04-05 22:01:15 +02:00
52404cf5d3 Updated docs 2023-04-05 21:59:58 +02:00
32223bcfc2 Updated docs 2023-04-05 21:43:21 +02:00
4e2bdb2b59 Fixed translation settings 2023-04-05 18:17:57 +02:00
d72514205c Updated PipSettings 2023-04-05 18:13:29 +02:00
9b4afdbe18 Updated TranslationSettings & formatted code 2023-04-05 18:12:31 +02:00
6751541269 Updated DiscordBotSettings 2023-04-05 18:11:16 +02:00
fe9918af16 Updated discord deps 2023-04-05 18:10:33 +02:00
d2c56f1a3f Fixed some broken references 2023-04-05 18:07:31 +02:00
8624549aa6 Fixed some broken references 2023-04-05 18:03:13 +02:00
9a6ce704b7 Removed from_dict from build and project settings 2023-04-05 16:30:02 +02:00
9af2a1962d Improved internal settings 2023-04-04 23:19:59 +02:00
a8d4a7a362 Added JSONProcessor to utils & Added JSONProcessor as settings parser 2023-04-04 22:52:13 +02:00
943f5ad50b Improved service scope 2023-04-04 21:45:32 +02:00
4cd8fea07a Merge pull request 'Added more version operator support' (#163) from #160 into 2023.4
Reviewed-on: sh-edraft.de/sh_cpl#163
Closes #160
2023-04-04 21:36:54 +02:00
82b3a22ac8 Added more version operator support 2023-04-04 21:36:24 +02:00
2c6367a408 Improved cpl query 2023-04-04 21:05:53 +02:00
af94a0c52d Formatted code 2023-04-04 15:56:37 +02:00
9c374f6bb2 Merge pull request '#161' (#162) from #161 into 2023.4
Reviewed-on: sh-edraft.de/sh_cpl#162
Closes #161
2023-04-04 14:52:30 +02:00
d0a19458c5 Formatted code 2023-04-04 14:50:19 +02:00
5d6e7677de Improved typing in query 2023-04-04 14:42:43 +02:00
01309e3124 Cleaned code 2023-04-04 13:58:37 +02:00
083e1ce4a1 Fixed OrderedQueryable imports 2023-04-04 13:55:50 +02:00
8c012e5902 Set Self type 2023-04-04 13:33:45 +02:00
5e6d17cc86 Updated some stuff 2023-04-04 13:30:10 +02:00
c4a71de83f Formatted code 2023-04-04 13:30:00 +02:00
01bc746092 Merge branch 'master' into 2023.4
# Conflicts:
#	src/cpl_cli/.cpl/__init__.py
#	src/cpl_cli/__init__.py
#	src/cpl_cli/_templates/__init__.py
#	src/cpl_cli/_templates/build/__init__.py
#	src/cpl_cli/_templates/publish/__init__.py
#	src/cpl_cli/abc/__init__.py
#	src/cpl_cli/command/__init__.py
#	src/cpl_cli/configuration/__init__.py
#	src/cpl_cli/cpl-cli.json
#	src/cpl_cli/helper/__init__.py
#	src/cpl_cli/live_server/__init__.py
#	src/cpl_cli/migrations/__init__.py
#	src/cpl_cli/migrations/base/__init__.py
#	src/cpl_cli/migrations/service/__init__.py
#	src/cpl_cli/publish/__init__.py
#	src/cpl_cli/source_creator/__init__.py
#	src/cpl_cli/validators/__init__.py
#	src/cpl_core/__init__.py
#	src/cpl_core/application/__init__.py
#	src/cpl_core/configuration/__init__.py
#	src/cpl_core/console/__init__.py
#	src/cpl_core/cpl-core.json
#	src/cpl_core/database/__init__.py
#	src/cpl_core/database/connection/__init__.py
#	src/cpl_core/database/context/__init__.py
#	src/cpl_core/dependency_injection/__init__.py
#	src/cpl_core/dependency_injection/service_provider.py
#	src/cpl_core/dependency_injection/service_provider_abc.py
#	src/cpl_core/environment/__init__.py
#	src/cpl_core/logging/__init__.py
#	src/cpl_core/mailing/__init__.py
#	src/cpl_core/pipes/__init__.py
#	src/cpl_core/time/__init__.py
#	src/cpl_core/utils/__init__.py
#	src/cpl_discord/.cpl/__init__.py
#	src/cpl_discord/.cpl/schematic_discord_event.py
#	src/cpl_discord/__init__.py
#	src/cpl_discord/application/__init__.py
#	src/cpl_discord/command/__init__.py
#	src/cpl_discord/configuration/__init__.py
#	src/cpl_discord/container/__init__.py
#	src/cpl_discord/cpl-discord.json
#	src/cpl_discord/events/__init__.py
#	src/cpl_discord/helper/__init__.py
#	src/cpl_discord/service/__init__.py
#	src/cpl_discord/service/discord_bot_service.py
#	src/cpl_discord/service/discord_bot_service_abc.py
#	src/cpl_discord/service/discord_service.py
#	src/cpl_query/__init__.py
#	src/cpl_query/base/__init__.py
#	src/cpl_query/base/queryable_abc.py
#	src/cpl_query/cpl-query.json
#	src/cpl_query/enumerable/__init__.py
#	src/cpl_query/extension/__init__.py
#	src/cpl_query/iterable/__init__.py
2023-04-04 13:29:45 +02:00
87d023ef7f Merge pull request 'Updated docs' (#159) from #150 into 2023.4
Reviewed-on: sh-edraft.de/sh_cpl#159
Closes #150
2023-04-04 13:16:38 +02:00
119052f9a2 Updated docs 2023-04-04 13:16:19 +02:00
43710717c9 Fixed cpl-discord deps 2023-03-11 01:33:56 +01:00
7bf5e25c5e Fixed typing 2023-03-06 19:03:35 +01:00
faa030df96 Fixed typing 2023-03-06 19:03:01 +01:00
b2efe285a9 Added line counter 2023-02-20 15:59:33 +01:00
9e28dce5ce Updated docs 2023-02-20 15:55:20 +01:00
8179508248 Added scheduled event support for cpl-discord 2023-02-13 16:58:46 +01:00
2c3664c1b9 Fixed schematic schematic 2023-01-15 10:01:19 +01:00
269f083662 Fixed static inject args order 2023-01-15 02:34:09 +01:00
8b40c65661 Fixed discord event schematic 2023-01-12 13:49:15 +01:00
7be3cf38dc Fixed cpl-cli deps 2023-01-12 09:05:36 +01:00
b18a7297a7 Build fix version 2023-01-12 08:58:05 +01:00
7f46fbe87a Added *args and **kwargs support to discord bot and DI 2023-01-12 08:57:01 +01:00
e0ca7c2ae6 Build fixed version 2023-01-07 15:03:21 +01:00
6389a940bc Fixed static di injection 2023-01-07 15:00:38 +01:00
48d0daabf5 Updated copyright 2022-12-25 12:05:02 +01:00
8fc3c04720 Updated deps 2022-12-25 12:02:47 +01:00
351f953fdb Merge pull request '2022.12' (#133) from 2022.12 into master
Reviewed-on: sh-edraft.de/sh_cpl#133
Reviewed-by: edraft-dev <dev.sven.heidemann@sh-edraft.de>
2022-12-25 11:58:34 +01:00
e1560dfab5 Merge pull request '2022.12.1' (#158) from 2022.12.1 into 2022.12
Reviewed-on: sh-edraft.de/sh_cpl#158
2022-12-25 11:29:56 +01:00
c9bc6a026a Build release 2022.12.1 2022-12-25 11:26:51 +01:00
83f0e8bd42 Set version 2022-12-25 11:25:53 +01:00
7af83b49a5 Merge pull request 'Added multiple instance handling (#152)' (#156) from #152 into 2022.12
Reviewed-on: sh-edraft.de/sh_cpl#156
Closes #152
2022-12-23 17:29:15 +01:00
59263ece6e Added multiple instance handling #152 2022-12-23 17:28:38 +01:00
a507ed9f46 Fixed publish all script 2022-12-23 16:45:14 +01:00
6b451142e2 Merge pull request 'Static dependency injection (#148)' (#155) from #148 into 2022.12
Reviewed-on: sh-edraft.de/sh_cpl#155
Closes #148
2022-12-23 16:36:21 +01:00
12beea05a7 Merge branch '2022.12' into #148 2022-12-23 16:35:24 +01:00
713fa5243c Fixed publisher service 2022-12-23 16:09:28 +01:00
d600852bec Added logic to support global service provider #148 2022-12-22 18:52:17 +01:00
c09f2f8e83 Fixed scoped #148 2022-12-20 14:50:35 +01:00
2fb515195c Improved query performance test 2022-12-20 14:34:55 +01:00
889f51f5c5 Fixed python path in settings 2022-12-20 14:29:43 +01:00
742ba8314a Merge pull request 'cpl n l -> keine Fragen... (#144)' (#149) from #144 into 2022.12
Reviewed-on: sh-edraft.de/sh_cpl#149
Closes #144
2022-12-19 08:39:30 +01:00
b95d90a191 Fixed python path in project settings #144 2022-12-19 08:36:40 +01:00
46fa49a102 Updated project type library logic & fixed tests #144 2022-12-18 14:27:41 +01:00
d5e89d6e2a Fixed cpl cli build #144 2022-12-18 12:03:41 +01:00
086fc75fec Build cpl query 2022-12-12 20:59:43 +01:00
05c33990bb Performance improvements 2022-12-12 20:59:04 +01:00
cbae40ef4d Fixed skip function 2022-12-11 10:44:23 +01:00
002ba6b4e0 Added split function 2022-12-11 09:16:38 +01:00
85f75b4677 Fixed group by 2022-12-11 08:58:55 +01:00
95d8df5bea Merge pull request 'Added new schematics & fixed run command #145' (#147) from #145 into 2022.12
Reviewed-on: sh-edraft.de/sh_cpl#147
Closes #145
2022-12-10 21:44:17 +01:00
ac1cd9bdde Added new schematics & fixed run command #145 2022-12-10 21:43:46 +01:00
2d9bb79af7 Merge pull request 'cli discord unterstützung (#143)' (#146) from #143 into 2022.12
Reviewed-on: sh-edraft.de/sh_cpl#146
Closes #143
2022-12-09 15:07:27 +01:00
120c9e6800 Fixed tests #143 2022-12-08 16:08:48 +01:00
6f3099a8db Updated packages & improved docs #143 2022-12-08 15:29:48 +01:00
e46711dc54 Added unittests #143 2022-12-08 14:23:46 +01:00
59920c59e0 Added cpl g & n discord support #143 2022-12-08 12:14:58 +01:00
604bb8f55c Updated discord test app #143 2022-12-08 11:02:54 +01:00
2f8dc63cdc Added discord command & event to cpl g schematics #143 2022-12-08 10:36:23 +01:00
4fbb3ec838 Updated readme 2022-12-07 20:12:07 +01:00
6818fe9a5c Improved cpl new appsettings template 2022-12-07 20:06:54 +01:00
3854fa5aa6 Merge pull request 'cpl n <project-type> name (#139)' (#140) from #139 into 2022.12
Reviewed-on: sh-edraft.de/sh_cpl#140
Closes #139
2022-12-07 16:16:14 +01:00
1ca459e67a Removed skip test case #139 2022-12-07 15:48:37 +01:00
fe8ffb2839 Removed comments #139 2022-12-07 15:46:58 +01:00
42fb88c35d Removed old new command #139 2022-12-07 15:45:15 +01:00
db7a0786a9 Merge branch '2022.12' into #139 2022-12-07 15:41:56 +01:00
f9f2612356 Merge pull request 'configuration.add_configuration(value: any) type fix (#141)' (#142) from #141 into 2022.12
Reviewed-on: sh-edraft.de/sh_cpl#142
Closes #141
2022-12-07 15:41:18 +01:00
df81bb599f Merge branch '2022.12' into #141 2022-12-07 13:07:38 +01:00
6d2492c1cf Added generic typing to configuration #141 2022-12-07 13:06:50 +01:00
e244535557 Improved cpl n custom templating #139 2022-12-06 17:42:55 +01:00
5f10603fe5 [WIP] Improved cpl new templating #139 2022-12-05 23:08:52 +01:00
6b8491eea2 Merge pull request 'cpl g <schematic> customizable (#137)' (#138) from #137 into 2022.12
Reviewed-on: sh-edraft.de/sh_cpl#138
Closes #137
2022-12-05 20:34:45 +01:00
b63bf41294 Fixed cpl help #137 2022-12-05 20:24:15 +01:00
f6cc3a7ddf Removed cpl g arguments #137 2022-12-05 20:00:32 +01:00
d1c93abe2c Improved cpl g templating & added custom templating #137 2022-12-05 19:57:33 +01:00
d6e3b37f7f Fixed recursion in cpl 2022-12-05 14:37:25 +01:00
9840779af4 build new cpl version 2022-12-05 14:30:33 +01:00
b893ec1fcf Merge pull request 'Removed old file #134' (#136) from #134 into 2022.12
Reviewed-on: sh-edraft.de/sh_cpl#136
2022-12-05 14:16:55 +01:00
d5e5bfe69d Removed old file #134 2022-12-05 14:15:01 +01:00
4afe5c4581 Fixed cpl query for now #134 2022-12-05 14:12:20 +01:00
e054ac364e Updated docs 2022-12-04 00:50:24 +01:00
68e01afb5b Release 2022.12.0 2022-12-04 00:12:40 +01:00
2e0a8bb1ff Minor fixes to cpl query 2022-12-04 00:08:16 +01:00
b02aebef35 Improved set-version tool & set version 2022-12-03 23:42:23 +01:00
099a51ed93 Merge pull request 'Fixed invalid output after console spinner #122' (#132) from #122 into 2022.12
Reviewed-on: sh-edraft.de/sh_cpl#132
Closes #122
2022-12-03 23:31:20 +01:00
e4aedb354b Fixed invalid output after console spinner #122 2022-12-03 23:30:54 +01:00
301768b842 Merge pull request 'cpl start & run - Bessere Einbindung mit den Build-Tools #124' (#131) from #124 into 2022.12
Reviewed-on: sh-edraft.de/sh_cpl#131
Closes #124
2022-12-03 23:25:11 +01:00
856960d799 Added logic to run build code to cpl start #124 2022-12-02 19:38:03 +01:00
d0877a4ea6 Added logic to run build code to cpl run #124 2022-12-02 18:41:58 +01:00
3c20ab296a Added --dev flag to cpl run & start #124 2022-12-02 17:48:35 +01:00
4dc7ee3314 Merge pull request 'cpl query Enumerable quatsch #129' (#130) from #129 into 2022.12
Reviewed-on: sh-edraft.de/sh_cpl#130
Closes #129
2022-12-01 23:43:01 +01:00
05bd5e8593 Improved query performance test #129 2022-12-01 23:41:06 +01:00
2fe3912a07 Fixed version test #129 2022-12-01 23:34:00 +01:00
2840628443 Improved tests #129 2022-12-01 23:23:48 +01:00
f0f79e7e3b Refactored cpl-query Iterable & Enumerable #129 2022-12-01 21:09:39 +01:00
e8ae635c88 Improved tests #129 2022-12-01 17:00:17 +01:00
d8f7e03815 Added group by & refactored Iterable #129 2022-12-01 16:27:29 +01:00
ba1b5e49ae Merge pull request 'Added logic to change base path for cpl n #120' (#128) from #120 into 2022.12
Reviewed-on: sh-edraft.de/sh_cpl#128
Closes #120
2022-12-01 14:00:46 +01:00
703a2c91b5 Added logic to change base path for cpl n #120 2022-12-01 13:55:55 +01:00
4a54bb62de Merge pull request 'cpl g in project directory #93' (#127) from #93 into 2022.12
Reviewed-on: sh-edraft.de/sh_cpl#127
Closes #93
2022-12-01 12:26:01 +01:00
9e84c8359b Removed empty PythonPath #93 2022-12-01 12:25:36 +01:00
5139876d90 Merge branch '#93' of https://git.sh-edraft.de/sh-edraft.de/sh_cpl into #93 2022-12-01 12:22:20 +01:00
6aef49de40 Repaired build & publish #93 2022-12-01 12:22:14 +01:00
186b336bf3 Repaired build & publish #93 2022-12-01 12:22:14 +01:00
1bbec27d1a Fixed cpl g path problems & package names #93 2022-12-01 12:21:57 +01:00
f0a8d69e22 Merge branch '2022.12' of https://git.sh-edraft.de/sh-edraft.de/sh_cpl into 2022.12 2022-12-01 12:21:17 +01:00
8bd237206c Fixed logging #123 2022-12-01 12:20:32 +01:00
6bf7c3a2bc Reverted #125 fix 2022-12-01 12:19:49 +01:00
2e8be741cc Repaired build & publish #93 2022-12-01 12:17:26 +01:00
abd0352750 Repaired build & publish #93 2022-11-30 19:05:11 +01:00
25d91b85f3 Merge branch '2022.12' into #93 2022-11-30 18:06:49 +01:00
f08eb42105 Merge pull request 'Logging Farben #123' (#126) from #123 into 2022.12
Reviewed-on: sh-edraft.de/sh_cpl#126
Closes #123
2022-11-30 18:06:12 +01:00
f450102c93 Fixed cpl g path problems & package names #93 2022-11-30 18:04:40 +01:00
db28645e98 Fixed logging #123 2022-11-30 15:17:08 +01:00
23efb776e7 Call pre & post scripts with args of base command & Build cpl-core@2022.7.0.post9 2022-11-18 09:17:56 +01:00
7f621b282f Build cpl-core@2022.7.0.post8 2022-11-18 08:37:16 +01:00
5dc7fce1e7 Call pre & post scripts with args of base command 2022-11-18 08:36:21 +01:00
879f59b0d5 Fixed #125 2022-10-21 22:34:47 +02:00
511622820a Fixed translation loading 2022-10-19 17:38:21 +02:00
0914f969e5 Resolved deps conflicts 2022-10-18 20:58:19 +02:00
c611045290 Removed german string 'this is a automatic...' in mail client 2022-10-18 20:44:08 +02:00
89ac9e90d6 Fixed take & skip 2022-10-15 13:17:08 +02:00
ae2a98b3bc Fixed unicode problems with windoof 2022-10-12 20:29:18 +02:00
bd242baa0a Removed exit from console warn in logger | WTF im so fckng sorry 2022-10-06 16:47:29 +02:00
8e4caeb2a8 Removed exit from console warn in logger | WTF im so fckng sorry 2022-10-06 16:46:44 +02:00
3b55b3d5a5 Fixed _append_log & create logic in logger_service 2022-10-06 16:45:20 +02:00
cc3b1afaa1 Fixed _append_log & create logic in logger_service 2022-10-06 16:24:01 +02:00
a22b6fdbdb Fixed typo | sry x2 :/ 2022-10-03 17:39:43 +02:00
e3041c4b5b Fixed typo | sry :/ 2022-10-03 17:36:31 +02:00
8ad6d50a04 Added reaction raw events 2022-10-03 17:32:12 +02:00
4db000f6d7 Added protected log and path getter to logger in cpl-core 2022-10-02 23:15:07 +02:00
3821624c3b Removed content from on_message log in cpl-discord 2022-10-02 13:01:09 +02:00
60a722b4ec Improved app builder to return self in use_startup 2022-10-02 02:43:10 +02:00
65132aa107 Improved app builder to return self in use_extension 2022-10-02 02:39:03 +02:00
48eac124a5 Fixed settings handling in cpl-discord 2022-10-01 22:38:01 +02:00
be23b18d33 Merge pull request 'Release 2022.10' (#112) from 2022.10 into master
Reviewed-on: sh-edraft.de/sh_cpl#112
Reviewed-by: edraft-dev <dev.sven.heidemann@sh-edraft.de>
2022-09-30 15:48:19 +02:00
748cc66946 Removed print 2022-09-30 15:47:54 +02:00
304b2e4255 Set new version & build projects 2022-09-30 15:39:41 +02:00
9fa183f143 Merge pull request '2022.10.11 - Added migrations to update command #114' (#117) from 2022.10.11-#114 into 2022.10
Reviewed-on: sh-edraft.de/sh_cpl#117
Closes 117
2022-09-30 14:10:50 +02:00
82df528395 Merge pull request '2022.10.12 - Fixed cpl g existing __init__.py overwrite #116' (#118) from 2022.10.12-#116 into 2022.10
Reviewed-on: sh-edraft.de/sh_cpl#118
Closes #118
2022-09-30 14:07:07 +02:00
49e3bddc91 Fixed cpl g existing __init__.py overwrite #116 2022-09-19 23:10:10 +02:00
c52bf961e1 Added migrations to update command #114 2022-09-19 23:00:09 +02:00
df3f9f0306 Merge pull request 'Fixed update & install commands #113' (#115) from 2022.10.10-#113 into 2022.10
Reviewed-on: sh-edraft.de/sh_cpl#115
Closes #113
2022-09-19 21:48:56 +02:00
ef2d73aadc Fixed update & install commands #113 2022-09-19 21:09:41 +02:00
1ed721cccb Updated packages (Build RC2) 2022-09-18 11:37:50 +02:00
a724216563 Added dockerfile to test 2022-09-18 11:27:26 +02:00
2bcf4d7a97 Re-build correct version 2022-09-18 11:09:38 +02:00
2dfa2dd68f Improved project file structure 2022-09-18 10:59:29 +02:00
e94ed0b7f0 Build rc1 2022-09-17 13:03:37 +02:00
c7e2f8609c Merge pull request '2022.10.3 - Removed duplicated schematic name in generate command #92' (#111) from 2022.10.3 into 2022.10
Reviewed-on: sh-edraft.de/sh_cpl#111
Closes #92
2022-09-17 12:12:52 +02:00
9d2321cc9c Merge branch '2022.10' into 2022.10.3 2022-09-17 12:12:40 +02:00
61d9912950 Removed duplicated schematic name in generate command #92 2022-09-17 12:09:05 +02:00
f23d32a92a Merge pull request '2022.10.4 - Removed async from startup functions (#94)' (#110) from 2022.10.4 into 2022.10
Reviewed-on: sh-edraft.de/sh_cpl#110
Closes #94
2022-09-17 11:59:38 +02:00
dc489cbf7a Removed async from startup functions 2022-09-17 11:58:43 +02:00
41d24aae99 Merge pull request '2022.10.6 - Added error message when logging configuration not exists (#95)' (#109) from 2022.10.6 into 2022.10
Reviewed-on: sh-edraft.de/sh_cpl#109
Closes #95
2022-09-17 11:40:46 +02:00
6b50bba139 Merge branch '2022.10' into 2022.10.6 2022-09-17 11:40:30 +02:00
139422fd32 Added error message when logging configuration not exists 2022-09-17 11:39:19 +02:00
409e11df42 Merge pull request '2022.10.5 Improved version command & fixed unittests (#97)' (#107) from 2022.10.5 into 2022.10
Reviewed-on: sh-edraft.de/sh_cpl#107
Closes #97
2022-09-16 10:43:17 +02:00
f3a11f9791 Improved version command & fixed unittests 2022-09-15 19:16:52 +02:00
8dcc5b4011 Merge pull request '2022.10.9 - Enumerable & List (#105)' (#106) from 2022.10.9 into 2022.10
Reviewed-on: sh-edraft.de/sh_cpl#106
Closes #105
2022-09-15 18:21:25 +02:00
d0f65834f1 Added performance test case 2022-09-15 18:14:40 +02:00
47ed0a705d Improved query 2022-09-15 17:00:22 +02:00
ae3192b63c Removed SequenceABC 2022-09-15 12:48:05 +02:00
bb461f5fba Improved query 2022-09-15 00:30:44 +02:00
52069b7bb3 Improved Sequences 2022-09-14 23:01:52 +02:00
f0ed0bd2e1 Added sequence converters 2022-09-14 13:23:23 +02:00
e868a120f0 Build cpl-query 2022-09-13 19:38:16 +02:00
70652aeb4c Changed structure of cpl-query 2022-09-13 19:33:26 +02:00
28adcc4e49 Implemented enumerable 2022-09-13 12:07:04 +02:00
affbb1ee7b Merge pull request '2022.10.8 - Moved query functions to static query class (#102)' (#104) from 2022.10.8 into 2022.10
Reviewed-on: sh-edraft.de/sh_cpl#104
Closes #102
2022-09-12 22:55:14 +02:00
d8a4210c9b Moved query functions to static query class 2022-09-12 22:53:52 +02:00
b16d555e33 Merge pull request '2022.10.2 - Code refactoring' (#103) from 2022.10.2 into 2022.10
Reviewed-on: sh-edraft.de/sh_cpl#103
2022-09-12 22:31:04 +02:00
4380142ccd Merge branch '2022.10' into 2022.10.2 2022-09-12 22:30:41 +02:00
91f2d6cb21 Code refactoring 2022-09-12 22:29:46 +02:00
249b071ee9 Merge pull request '2022.10.2' (#101) from 2022.10.2 into 2022.10
Reviewed-on: sh-edraft.de/sh_cpl#101
2022-09-12 22:29:22 +02:00
53fe437100 Added more data containers 2022-09-12 22:18:54 +02:00
fc63f3616e Added tests for select & select many 2022-09-12 18:07:37 +02:00
a528511732 Added tests for select & select many 2022-09-12 17:58:48 +02:00
dbe1d37046 Build version 2022-09-11 22:02:10 +02:00
988965ed52 Improved cpl-query & added first types from discord 2022-09-11 21:57:27 +02:00
3c5ca594d5 Merge pull request '2022.10.1' (#100) from 2022.10.1 into 2022.10
Reviewed-on: sh-edraft.de/sh_cpl#100
2022-09-11 19:30:39 +02:00
452b30c899 Build version 2022-09-11 19:30:19 +02:00
85c5b26fdf Added slash command support 2022-09-11 10:21:28 +02:00
92ed684866 First migrations 2022-09-10 10:27:31 +02:00
88e83db330 Improved scope handling 2022-07-31 13:32:02 +02:00
55609fc691 Renamed sh_cpl to cpl in docs 2022-07-31 11:33:45 +02:00
e0d89f967f Improved docs 2022-07-31 11:30:05 +02:00
b2ce8a6924 Added on_error to event types enum 2022-07-19 21:42:45 +02:00
71efbd1b42 Fixed database connection handling by reconnecting 2022-07-19 07:37:03 +02:00
e36939a108 Fixed database port handling 2022-07-18 12:15:28 +02:00
721461fc1b Deployed cpl-discord==2022.7.0.post2 2022-07-17 16:11:33 +02:00
72ee59b2b4 Deployed cpl-core==2022.7.0.post3 2022-07-17 15:52:53 +02:00
95159da0fc Fixed pynput imports 2022-07-17 15:52:17 +02:00
330d702347 Fixed base class of translation service 2022-07-17 15:49:50 +02:00
cbf669d3bd Fixed base class of translation service 2022-07-16 22:06:38 +02:00
7498fe3255 Fixed settings error 2022-07-16 19:37:40 +02:00
880998e8ca Published cpl-discord.post1 2022-07-16 19:23:00 +02:00
ecc9657eaa Merge pull request '2022.7 - cpl-discord' (#96) from 2022.7 into master
Reviewed-on: sh-edraft.de/sh_cpl#96
Closes #91
2022-07-16 16:16:49 +02:00
125f65cf1b Published cpl-discord 2022-07-16 16:15:52 +02:00
1cd9c7d669 Fixed set-version 2022-07-16 16:07:39 +02:00
5165f31066 Build cpl-discord 2022-07-16 15:53:02 +02:00
10d33e5d1d Added logic to handle commands 2022-07-16 15:45:34 +02:00
fb35e8b8b2 Added logic to create a bot 2022-07-16 14:53:54 +02:00
4402bcce73 Added test project 2022-07-16 12:22:10 +02:00
8839b26f00 Added event bases 2022-07-16 12:21:59 +02:00
a79358725c Added cpl-discord project 2022-07-16 12:12:52 +02:00
2ab1576230 Fixed async init error & Fixed pip install 2022-07-14 16:29:08 +02:00
c0be380f69 Removed vscode files 2022-07-14 15:22:10 +02:00
c0ae0c8389 Merge pull request '2022.7 - cpl-translation' (#90) from 2022.7 into master
Reviewed-on: sh-edraft.de/sh_cpl#90
Closes #89
Closes #63
Closes #62
2022-07-10 18:10:30 +02:00
4a766e8284 Release 2022.7 2022-07-10 18:08:44 +02:00
2772ea8df2 Added translation unittests 2022-07-10 17:56:38 +02:00
a604f0e821 Build package 2022-07-10 17:23:50 +02:00
6995b25518 Injected add_translation function from translation package 2022-07-10 17:17:45 +02:00
e4f843829f Added logic to load translations and to translate texts 2022-06-29 20:03:13 +02:00
39b6ca790c Added test project 2022-06-29 19:05:12 +02:00
4c8d7a8031 Added translation project 2022-06-29 19:04:01 +02:00
6d75bc433e Merge pull request '2022.6' (#88) from 2022.6 into master
Reviewed-on: sh-edraft.de/sh_cpl#88
2022-06-29 17:50:06 +02:00
8bb7fbd1c4 Merge remote-tracking branch 'origin/2022.6' into 2022.6 2022-06-29 17:47:04 +02:00
ad03e655e9 Build Release 2022.6.0 2022-06-29 17:46:59 +02:00
61d3974a47 Build Release 2022.6.0 2022-06-29 17:46:01 +02:00
3d852c87e2 Improved docs 2022-06-29 17:44:10 +02:00
0e46528f32 Merge pull request '2022.6.8 - Dokumentation' (#87) from 2022.6.8 into 2022.6
Reviewed-on: sh-edraft.de/sh_cpl#87
Closes #56
2022-06-29 17:42:33 +02:00
bb8fa1f6a8 Improved readme 2022-06-29 17:40:05 +02:00
9fdaa810c0 Build 2022.6.0rc2 2022-06-27 21:48:15 +02:00
4083ac0c14 Build docs and added tutorial files 2022-06-27 21:42:34 +02:00
b9e0b7ccd0 Build 2022.6.0.rc1 2022-06-27 20:55:44 +02:00
4b9e428abb Updated tools 2022-06-27 20:52:27 +02:00
63ad13e09a Improved version handling of set-version 2022-06-27 20:46:01 +02:00
cc06a308a1 Merge pull request '2022.6.10 - Dev dependencies' (#86) from 2022.6.10 into 2022.6
Reviewed-on: sh-edraft.de/sh_cpl#86
Closes #71
2022-06-27 20:18:24 +02:00
e9fdd20181 Updated unittests 2022-06-27 20:16:37 +02:00
8692686cb5 Added dev-deps support to new command 2022-06-27 20:07:52 +02:00
db29ad36fe Added dev-deps support to cpl install without package 2022-06-27 20:05:34 +02:00
0710b25317 Added dev-dependencies to uninstall command 2022-06-27 20:04:19 +02:00
cbd2964f42 Added dev-dependencies to install command 2022-06-27 20:02:01 +02:00
f51118f13c Merge pull request '2022.6.2 - Venv support' (#85) from 2022.6.2 into 2022.6
Reviewed-on: sh-edraft.de/sh_cpl#85
Closes #51
2022-06-27 11:52:17 +02:00
323e363b42 Improved venv support to all related commands 2022-06-27 11:50:22 +02:00
e8a4fe6142 Added venv support to install command 2022-06-27 10:52:26 +02:00
587d9b359c Merge pull request '2022.6.17 - Unittests' (#84) from 2022.6.17 into 2022.6
Reviewed-on: sh-edraft.de/sh_cpl#84
2022-06-27 10:03:54 +02:00
c2632253ac Added tests for update command 2022-06-27 09:10:21 +02:00
45be77dd10 Added tests for version command 2022-06-26 19:51:18 +02:00
78ffbcc33d Readded all test cases 2022-06-26 01:07:10 +02:00
d83d1a244e Fixed for start command [WIP] output is needed 2022-06-26 01:05:45 +02:00
fa002a50ac Fixed for start command 2022-06-26 00:41:25 +02:00
32507afae9 Added tests for start command 2022-06-26 00:39:16 +02:00
6de3bbdaf4 Added tests for run command 2022-06-26 00:15:05 +02:00
6e50d0cb22 Added tests for publish command 2022-06-23 23:47:29 +02:00
9e978f3ece Fixed tests for un/install commands 2022-06-23 23:39:41 +02:00
32478926c8 Added tests for build command 2022-06-23 21:49:44 +02:00
2925788d01 Added tests for uninstall command 2022-06-21 09:24:56 +02:00
c0789cf4f7 Added tests for install command 2022-06-21 08:56:26 +02:00
89d591ce0a Added project reference handling in cpl remove 2022-06-04 00:36:31 +02:00
77c560b40c Improved cpl remove test 2022-06-03 23:46:03 +02:00
dad4913bcd Added cpl remove test 2022-06-03 23:44:26 +02:00
9b56650d4b Added cpl add test 2022-06-03 23:35:07 +02:00
9fca2018e5 Build dev10 2022-05-27 18:57:12 +02:00
e5dd890931 Improved unittest for cpl new & Fixed subdirectory handling with cpl new 2022-05-27 18:57:00 +02:00
beadbf8e91 Improved set-version to ignore skipped deps 2022-05-27 18:26:32 +02:00
ff5f9b833d Improved unittest for cpl new 2022-05-27 18:07:12 +02:00
162f06001a Build dev8 & improved cpl new unittests 2022-05-26 23:27:32 +02:00
348fad24c7 Build dev8 & improved set-version change handling 2022-05-26 23:27:20 +02:00
f9748cdb76 Improved gitignore 2022-05-26 23:03:18 +02:00
56380763a9 Improved unittests 2022-05-26 23:01:50 +02:00
3a1630b687 Added force option to set-version 2022-05-26 23:01:23 +02:00
a593f34cde Build dev7 2022-05-26 23:00:55 +02:00
49cce5fa1a Extended cpl new options 2022-05-26 22:52:03 +02:00
df7bd06629 Fixed additional argument & flag bug 2022-05-26 22:51:29 +02:00
e0da77fd4b Added new test condition for cpl new 2022-05-26 22:24:19 +02:00
833dd83008 Improved unittests & added tests for cpl new 2022-05-26 22:21:16 +02:00
ce0ad4013f [WIP] Improved unittest 2022-05-26 21:42:43 +02:00
698f80adfe Build dev6 2022-05-26 21:42:28 +02:00
d0b0f4bfcb Fixed set-version 2022-05-26 21:41:42 +02:00
d23ea86ccf Added logic to answer questions of new command dialog by flag arguments 2022-05-26 21:18:57 +02:00
15d938b172 Fixed handing of unregistered console arguments 2022-05-26 21:01:41 +02:00
6c1d7a3b29 Removed prints from CLITestSuite 2022-05-26 16:29:07 +02:00
c28f551682 Added skip message to set-version 2022-05-26 16:26:55 +02:00
def92c78c8 Added logic to change version only for projects with changes 2022-05-26 16:25:15 +02:00
ddff9dec11 Fixed install command 2022-05-26 16:08:37 +02:00
9e0e85d646 Fixed install command 2022-05-26 16:06:56 +02:00
b05ca7e980 Set dev version 2022-05-26 16:03:14 +02:00
8f8a9f7dd7 Moved query unittests 2022-05-26 15:53:23 +02:00
df32978a31 Moved unittests 2022-05-26 15:49:52 +02:00
79b51cf8c5 Build dev4 & added unittest support to console 2022-05-26 15:41:47 +02:00
a72dd0dc2e Improved tests 2022-05-26 15:29:49 +02:00
d937c4c0e6 Added tests for generate command 2022-05-26 14:47:36 +02:00
46cceb0910 Registered CLI test cases 2022-05-26 13:59:46 +02:00
e74e39c189 Added CLI command test cases 2022-05-26 13:49:31 +02:00
c2706c7737 Added unittest projects 2022-05-26 13:37:15 +02:00
d0e66d24bd Added logic to generate test cases 2022-05-26 13:17:58 +02:00
c1a1849ad2 Added logic to create new unittest project 2022-05-26 13:12:35 +02:00
0675105731 Merge pull request '2022.6.16 - Build-Tools' (#83) from 2022.6.16 into 2022.6
Reviewed-on: sh-edraft.de/sh_cpl#83
Closes #82
2022-05-26 12:13:45 +02:00
7ee0b951a8 Rebuild & improved workspace scripts 2022-05-25 19:59:38 +02:00
d8168f024c Added logic to write PipPath & build dev2 2022-05-25 19:53:05 +02:00
2654dc7c69 Merge remote-tracking branch 'origin/2022.6.16' into 2022.6.16 2022-05-25 19:38:56 +02:00
4224960837 First dev build 2022-05-25 19:38:49 +02:00
907c3a8fff First dev build 2022-05-25 19:38:38 +02:00
28505479ba Added new project 2022-05-25 19:30:11 +02:00
84d3abce3f Merge pull request '2022.6.15 - set-version' (#81) from 2022.6.15 into 2022.6
Reviewed-on: sh-edraft.de/sh_cpl#81
Closes #80
2022-05-25 19:10:35 +02:00
9050dffc53 Renamed projects && build dev6 2022-05-25 19:07:29 +02:00
e0f69c9bdf Fixed old naming of cpl_core 2022-05-25 18:56:08 +02:00
bbd0a60f98 Added functionality to set dependencies for all projects in workspace 2022-05-25 18:54:21 +02:00
e23f4187fe Added logic to add internal pipes in ServiceCollection 2022-05-25 18:42:47 +02:00
15f200df3a Added version pipe 2022-05-25 18:40:01 +02:00
a1a3ad6fb5 Build dev4 2022-05-25 17:09:31 +02:00
d6677d53a3 Added empty lines to generate output 2022-05-25 17:08:03 +02:00
07e43b50d1 Fixed generate pipe argument 2022-05-25 17:07:22 +02:00
ac83555b24 Added logic to handle cpl deps 2022-05-25 17:04:18 +02:00
1ab358059c Added more pre-build scripts 2022-05-25 16:57:21 +02:00
5bf83c0d77 Build dev2 2022-05-25 16:56:24 +02:00
03ac00c6e3 Bugfixes for set-version & CustomScriptService 2022-05-25 16:51:52 +02:00
0122d8fc78 Merge remote-tracking branch 'origin/2022.6.15' into 2022.6.15 2022-05-25 16:43:52 +02:00
a66ce96dbf Added set-version logic && Fixed CustomScriptService to handle arguments 2022-05-25 16:43:43 +02:00
6da8e30446 Added set-version logic && Fixed CustomScriptService to handle arguments 2022-05-25 16:43:28 +02:00
539ed13be4 Bugfixes for run service 2022-05-25 16:06:44 +02:00
036a553f64 Dev build 2022.6.15.dev1 2022-05-25 15:12:36 +02:00
976a14584b Dev build 2022.6.15.dev1 2022-05-25 15:12:30 +02:00
ed69f52927 Fixed generate service 2022-05-25 15:11:42 +02:00
98847495e6 Merge pull request '2022.6.14 - Pre & Post build scripts' (#79) from 2022.6.14 into 2022.6
Reviewed-on: sh-edraft.de/sh_cpl#79
Closes #77
2022-05-25 14:15:24 +02:00
40f132da33 Added workspace scripts 2022-05-25 14:14:26 +02:00
5feb44595a Fixed cpl run command 2022-05-25 14:00:38 +02:00
48c6941f1a Added run command & tools/set-version project 2022-05-25 13:43:16 +02:00
a8756d493a Fixed error with RemoveService 2022-05-25 13:19:12 +02:00
9f4077a073 Improved configuration 2022-05-25 13:11:41 +02:00
3e7a3d75c5 Merge pull request 'cpl@2022.6.13 - cpl run command' (#78) from 2022.6.13 into 2022.6
Reviewed-on: sh-edraft.de/sh_cpl#78
Closes #76
2022-05-25 08:42:41 +02:00
477d2d87d3 Added run command 2022-05-25 08:41:35 +02:00
7a65dbe39b Readded logic to handle pre and post scripts from workspace 2022-05-24 22:28:38 +02:00
f83755ac77 Removed console output & build new dev version 2022-05-24 20:20:42 +02:00
a590cfd066 Bugfixes for start service 2022-05-24 20:12:59 +02:00
f317035342 Bugfixes for test application & added validators to cli 2022-05-24 19:20:55 +02:00
8900bdd446 Removed invalid import && build for rc1 2022-05-24 18:20:31 +02:00
35ecf158a2 Fixed loading by base_type 2022-05-24 18:13:39 +02:00
353c1d30ec Merge pull request '2022.6.9 - Singleton initialisierung' (#75) from 2022.6.9 into 2022.6
Reviewed-on: sh-edraft.de/sh_cpl#75
Closes #70
2022-05-24 17:52:13 +02:00
1c94fb5bd1 Added logic to load singletons when requested not when registered 2022-05-24 17:51:17 +02:00
cf305aeebb Merge pull request '2022.6.12 - Alle Umgebungsvariablen' (#74) from 2022.6.12 into 2022.6
Reviewed-on: sh-edraft.de/sh_cpl#74
Closes #73
2022-05-24 17:39:20 +02:00
90e97433e0 Added logic to load all environment variables by prefix 2022-05-24 17:37:31 +02:00
125a85a0af Merge pull request '2022.6.7 - Pipes' (#69) from 2022.6.7 into 2022.6
Reviewed-on: sh-edraft.de/sh_cpl#69
Closes #60
2022-05-22 20:28:46 +02:00
cfb8838c73 Added default pipes 2022-05-22 20:27:58 +02:00
824d491ebc Dev build projects 2022-05-22 18:49:31 +02:00
d694c408c0 Added CLI logic to generate pipes 2022-05-22 18:48:33 +02:00
d1bb266d49 Added Pipes 2022-05-22 18:43:10 +02:00
419fcc3d29 Merge pull request '2022.6.5 - CLI Erweiterung' (#68) from 2022.6.5 into 2022.6
Reviewed-on: sh-edraft.de/sh_cpl#68
Closes #54
2022-05-22 18:34:44 +02:00
24ab6a51c1 Refactored executable arguments 2022-05-22 18:33:07 +02:00
dec4a45d98 Added logic to add CLI commands from external packages 2022-05-22 18:32:34 +02:00
d11c56db03 Merge pull request 'cpl@2022.6.3 - Verbesserung der Parameter' (#67) from 2022.6.3 into 2022.6
Reviewed-on: sh-edraft.de/sh_cpl#67
2022-05-22 17:38:21 +02:00
fc23315cc7 Build version 2022.6.3 2022-05-22 17:35:38 +02:00
1f503fe20d Build new version 2022-05-20 10:37:43 +02:00
4564f7ac0e Improved output & imports 2022-05-20 10:35:47 +02:00
7b823e1141 Added validator generation 2022-05-20 10:34:09 +02:00
dac3d9c6bb Added validators (closes #59) 2022-05-20 10:27:55 +02:00
ccca904cb8 Smaller output fixes 2022-05-20 09:17:51 +02:00
c66a81c0ec Dev build & migrated custom scripts 2022-05-20 09:12:28 +02:00
fb810e2943 Dev build & migrated custom scripts & add logic to prevent next executable 2022-05-20 09:10:29 +02:00
5cc663dedc Migrated generate command 2022-05-20 08:50:50 +02:00
593372699b BUild dev version 2022-05-20 08:44:32 +02:00
1899cb5b86 Added scripts to workspace 2022-05-19 20:49:48 +02:00
0a285f2d28 Improved help command 2022-05-19 20:23:21 +02:00
94c82e6701 Improved help command 2022-05-19 20:21:46 +02:00
0d37c86061 Removed console output 2022-05-19 20:05:22 +02:00
6c8e9ccd89 Migrated StartService to new argument parsing 2022-05-19 20:04:29 +02:00
e7cf545502 Migrated NewService to new argument parsing 2022-05-19 19:52:36 +02:00
44182eec86 Fixed value handling for variable arguments 2022-05-19 19:41:02 +02:00
0f5b1b7586 Improved argument handling 2022-05-19 19:37:32 +02:00
4fe073580a Migrated first commands to new argument parser 2022-05-19 18:12:47 +02:00
2fed654c16 Improved argument handling 2022-05-19 18:09:25 +02:00
8ebd4864d3 Improved & added commands 2022-05-19 08:25:32 +02:00
a495532a4d Removed console debug outputs 2022-05-18 22:29:44 +02:00
d87ce72f07 Improved argument parsing 2022-05-18 22:26:11 +02:00
50201346e2 Added functions to define console arguments 2022-05-18 18:21:05 +02:00
773b154371 Improved service collection 2022-05-18 18:20:25 +02:00
5b59d1d384 Merge pull request '2022.6.4' (#58) from 2022.6.4 into 2022.6
Reviewed-on: sh-edraft.de/sh_cpl#58
2022-04-30 18:33:54 +02:00
dcd8583183 Build packages 2022-04-30 17:44:15 +02:00
97e52b39c0 Added logic to handle StartupExtension classes 2022-04-30 17:43:34 +02:00
581013b61a Merge pull request '2022.6.1' (#57) from 2022.6.1 into 2022.6
Reviewed-on: sh-edraft.de/sh_cpl#57
2022-04-30 17:16:49 +02:00
fd68d25a1d Updated to python3.10 2022-04-30 17:15:26 +02:00
588f93f7b1 Updated packages 2022-04-30 16:41:52 +02:00
96f402dcdd Updated packages 2022-04-30 16:33:30 +02:00
c1b7fca8d5 Moved from pyfiglet to art 2022-01-19 22:06:59 +01:00
2e4e7ccc57 Fixed minor issues with console & updated packages 2022-01-19 15:06:26 +01:00
ada3d133df Changed exit() to sys.exit() 2022-01-19 12:44:23 +01:00
61e7b9d684 Fixed cpl new command 2022-01-15 23:28:22 +01:00
24172c658c Fixed cpl new command 2022-01-15 22:16:17 +01:00
62ac976b99 Fixed where query typing 2022-01-15 11:11:14 +01:00
1f445a99b2 Fixed typing in count function of cpl_query 2022-01-08 18:09:03 +01:00
025286052b Fixed typing in service collection abc 2022-01-08 17:58:22 +01:00
32a856f8e8 Published new version 2021-12-07 16:07:21 +01:00
21f50f3b24 Fixed table_abc 2021-12-07 16:06:20 +01:00
ce77d41246 Build new docs 2021-12-02 08:20:38 +01:00
dec137220c Improved TableABC 2021-11-30 17:48:08 +01:00
01c7e155c3 Fixed typo 2021-11-30 15:24:01 +01:00
dcbcb67ce8 Fixed db connection 2021-11-30 15:01:28 +01:00
d57fd10718 Fixed add_db_context function 2021-11-30 14:14:34 +01:00
2b91db5d81 Removed unsued parameter 2021-11-30 14:05:52 +01:00
dffa3de1ec Merge pull request '2021.11' (#50) from 2021.11 into master
Reviewed-on: sh-edraft.de/sh_cpl#50
2021-11-30 12:03:03 +01:00
403837901b Added logic to simulate uninstall command 2021-11-30 11:55:11 +01:00
0de725c907 Added logic to simulate install command 2021-11-30 11:51:45 +01:00
e811e08c52 Changed version of cli 2021-11-30 11:22:02 +01:00
6518ae7516 Changed version of query 2021-11-30 11:21:19 +01:00
95b5f99f1f Changed core version 2021-11-30 11:20:15 +01:00
de22e79b71 Removed console from db connection 2021-11-30 11:15:41 +01:00
127c67e566 Improved imports 2021-11-30 11:14:40 +01:00
3523dbd5c5 Improved typing 2021-11-30 11:12:13 +01:00
b526a07e19 Added demo for SQL Support 2021-11-30 11:10:36 +01:00
d9f10edbb7 [WIP] Added native mysql support 2021-11-29 20:55:43 +01:00
7616cd4c69 Changed version 2021-11-29 17:49:10 +01:00
afe75f6848 Fixed custom scripts 2021-11-29 17:47:44 +01:00
c0e2db8281 Build new CLI version 2021-11-29 09:30:46 +01:00
3727af11c4 Minor bugfixes with custom scripts 2021-11-29 09:30:10 +01:00
450295cfcf Build new version 2021-11-29 09:22:33 +01:00
457bce8aa9 Minor bugfixes 2021-11-29 09:21:55 +01:00
0f81497ea3 Changed version 2021-11-24 17:48:39 +01:00
fa7ee800e1 Fixed cpl start reading full path 2021-11-24 17:48:19 +01:00
56b7452e55 Changed version 2021-11-23 19:02:15 +01:00
9d73566453 Fixed custom command handling 2021-11-23 19:01:00 +01:00
28ba0c174a Changed version 2021-11-22 20:54:07 +01:00
5d0444bcc0 Fixed type problems with ordered List 2021-11-22 20:52:10 +01:00
40876005d5 Changed vs code settings 2021-11-22 20:49:39 +01:00
ac6d941822 Improved gitignore 2021-11-19 09:16:11 +01:00
113b365a47 Removed outdating line 2021-11-15 01:16:37 +01:00
2f785536e1 Improved path handling for new projects 2021-11-15 01:03:50 +01:00
9ab4013b4b Fixed async handling for new command 2021-11-15 00:20:39 +01:00
b3b04f03ce Merge pull request '2021.10.2' (#48) from 2021.10.2 into master
Reviewed-on: sh-edraft.de/sh_cpl#48
Closed #47
2021-11-14 12:56:41 +01:00
57040f85f0 Changed versions 2021-11-14 12:53:09 +01:00
589ef4fd4c Added logic to generate new projects with async 2021-11-14 12:32:11 +01:00
4b829cc484 Added logic to handle async applicationBase 2021-11-14 12:16:50 +01:00
98e343a108 Added logic to handle scoped services 2021-11-14 11:56:42 +01:00
7749d5a789 Moved tests to src & added add scoped logic 2021-11-14 10:04:32 +01:00
c3b48bfa41 Changed version 2021-11-14 09:55:27 +01:00
470e7ab2f4 Changed versions to new scheme 2021-11-14 09:52:07 +01:00
4ceea36926 Changed version 2021-11-02 18:42:13 +01:00
b3f8174663 Added cpl_query to docs 2021-11-02 18:41:30 +01:00
58dccea28b Improved docs 2021-11-02 17:45:45 +01:00
ca086e01d7 Improved docs 2021-11-02 17:30:10 +01:00
c5b1a95661 Moved implementations to extensions 2021-11-02 17:28:36 +01:00
d7881774a8 Improved docs by adding cpl_query.exceptions 2021-11-02 17:23:42 +01:00
6eec92243e Improved docs 2021-11-01 21:17:56 +01:00
124b236182 Improved docs 2021-11-01 20:43:25 +01:00
2dc96cdf3d Improved workspace 2021-11-01 18:49:22 +01:00
6f7923debc Moved tests 2021-11-01 18:47:23 +01:00
90d148b4a5 Added launch settings 2021-11-01 18:42:12 +01:00
73e2c5ec10 Added vs code 2021-11-01 18:24:41 +01:00
f31522dcd9 Changed version 2021-10-27 14:25:33 +02:00
a83607fd81 Fixed subclass support for Iterable 2021-10-27 14:24:43 +02:00
707df3f27d Fixed command handling 2021-10-26 23:23:56 +02:00
0f43e57831 Removed console.write_line 2021-10-26 13:09:44 +02:00
c08ab33060 Changed deps 2021-10-26 13:06:14 +02:00
ee2abd98b3 Changed version 2021-10-26 13:00:27 +02:00
e39661a42a Fixed command handling 2021-10-26 13:00:16 +02:00
9518d19580 Fixed invalid lines in startup template 2021-10-08 08:22:36 +02:00
adf95faaf8 Improved typo 2021-10-08 08:16:46 +02:00
2f92e9909d Improved env 2021-10-04 10:21:50 +02:00
b18f2c4bcd Removed debug changes 2021-10-04 09:59:20 +02:00
784ba049ad Fixed new library problems 2021-10-04 09:56:33 +02:00
4d6d19d2e5 Fixed new command problems 2021-10-04 09:56:08 +02:00
6fa47f19af Merge pull request '2021.10' (#41) from 2021.10 into master
Reviewed-on: sh-edraft.de/sh_cpl#41
2021-10-04 09:32:41 +02:00
fb2872422e Added upload script 2021-10-04 09:30:27 +02:00
8460c0fa33 Published 2021.10 2021-10-04 09:23:08 +02:00
18f95341f4 Merge pull request '2021.10.6' (#39) from 2021.10.6 into 2021.10 | closed #38
Reviewed-on: sh-edraft.de/sh_cpl#39
2021-10-03 11:26:48 +02:00
a8011267d9 Improved version command 2021-10-03 11:23:17 +02:00
f8ebb4f1d7 Improved imports in test app 2021-10-03 11:02:08 +02:00
3903f85368 Added logic to handle extensions before running the app 2021-10-02 10:57:54 +02:00
05a9bdbf4a Improved docstrings 2021-08-07 11:29:00 +02:00
2809a9cd82 Improved imports 2021-08-07 11:24:17 +02:00
1c6794dc40 Renamed cpl to cpl_core & added config and services as arguments to startup 2021-08-07 11:21:30 +02:00
cac80657df Renamed cpl to cpl_core 2021-08-05 14:21:42 +02:00
11241d8f99 Renamed project 2021-08-05 14:17:38 +02:00
308e5c9b0c Merge pull request '2021.10.4' (#37) from 2021.10.4 into 2021.10
Reviewed-on: sh-edraft.de/sh_cpl#37
Closed #32
2021-08-05 14:04:45 +02:00
c12ff4f9e3 Added logic to migrate attributes from workspace and project settings 2021-08-05 14:02:00 +02:00
091c89df2c Changed version of CLI 2021-08-05 13:37:40 +02:00
63a67be0ee Improved new command 2021-08-05 13:27:08 +02:00
c68224b31a Improved deps of cpl_query 2021-08-02 14:48:46 +02:00
9f219757c3 Merge pull request '2021.10.3' (#35) from 2021.10.3 into 2021.10
Reviewed-on: sh-edraft.de/sh_cpl#35
2021-08-02 14:36:45 +02:00
e09a4402b3 Published sh_cpl-query to version 2021.10.0rc1 2021-08-02 14:36:00 +02:00
6867eb0e65 Improved scripts 2021-08-02 14:14:50 +02:00
ffaa5c4a2b Refactoring 2021-08-02 14:09:42 +02:00
b9499108d8 Build cpl_query 2021-08-02 14:03:51 +02:00
37175b7227 Added queries sum, skip & take 2021-07-27 13:57:42 +02:00
2b5831c5fe Improved numbered queries 2021-07-27 13:00:06 +02:00
62c8b9c68d Added reverse query 2021-07-27 12:54:49 +02:00
a080119c44 Improved unittests 2021-07-27 12:48:22 +02:00
a26c6f1bd9 Improved avg, max and min queries type handling 2021-07-27 12:42:33 +02:00
daac14e099 Improved avg query 2021-07-27 12:35:14 +02:00
d4b5c32a21 Added min and max queries 2021-07-27 11:57:42 +02:00
c115afd736 Moved last queries 2021-07-27 11:47:13 +02:00
e7863a92e0 Added last query 2021-07-27 11:43:45 +02:00
82a9e3a23a Improved index out of range exception 2021-07-27 11:40:24 +02:00
a3a0a150a8 Added element at query 2021-07-27 11:29:52 +02:00
6951a19670 Renamed files 2021-07-27 11:22:29 +02:00
669133d491 Added distinct query 2021-07-27 11:20:35 +02:00
c60598b3f6 Added count query 2021-07-27 11:01:43 +02:00
45733b30ef Improved error handling 2021-07-27 10:59:24 +02:00
f8bd86692e Added contains query 2021-07-27 10:55:23 +02:00
5e5d86cf94 Added better exceptions 2021-07-27 09:41:51 +02:00
e0b7728719 Added avg query 2021-07-27 09:26:30 +02:00
0f85d4b9bc Refactoring & added all query 2021-07-27 09:15:19 +02:00
a3fff9c7d7 Build package 2021-07-26 15:55:08 +02:00
8dcf3a6768 Refactoring 2021-07-26 15:52:27 +02:00
94949394de Improved list to handle typing 2021-07-26 15:48:42 +02:00
b7be439381 Changed func type from str to Callable 2021-07-26 15:32:28 +02:00
0cae3428b9 Added order by functions 2021-07-26 15:21:57 +02:00
cc7755bafc Improved cli project builders 2021-07-25 19:18:06 +02:00
4e78b9c12b Added different queries & unittests 2021-07-25 19:15:02 +02:00
5c80cf2222 Added CPL Query 2021-07-25 12:24:58 +02:00
d02548e1a8 Merge pull request '2021.10.2' (#33) from 2021.10.2 into 2021.10
Reviewed-on: sh-edraft.de/sh_cpl#33
2021-07-25 12:05:12 +02:00
51efe973e8 Improved logic to handle pre and post scripts 2021-07-25 12:00:12 +02:00
0bb272d89b Added logic to handle pre and post scripts 2021-07-25 11:42:46 +02:00
59f6843ea9 Changed version 2021-07-24 17:25:06 +02:00
be6838f97b Added logic to handle custom scripts from workspaces 2021-07-24 17:24:01 +02:00
d5b2d3605b CPL Release 2021.4.0.post2 2021-05-23 12:41:59 +02:00
7a48917fb4 CLI Release 2021.4.0.post3 2021-05-22 15:10:50 +02:00
59832742b6 CLI Release 2021.4.0.post2 2021-05-22 12:55:17 +02:00
f9f04901c0 Bugfixes 2021-05-22 12:53:04 +02:00
593ffbb068 Updated cli project file 2021-05-19 09:03:31 +02:00
3d35f2ac63 Merge pull request '2021.4.post1' (#31) from 2021.4.post1 into master
Reviewed-on: sh-edraft.de/sh_cpl#31
2021-05-19 09:00:39 +02:00
5bfba581cb Release 2021.4.0.post1 2021-05-19 08:35:02 +02:00
8fb570468c More bugfixes & added generated test projects 2021-05-19 08:28:59 +02:00
128fda60b0 Release 2021.4.1.rc2 2021-05-19 08:19:21 +02:00
ab539c15dd Fixed source creation bug 2021-05-19 08:03:04 +02:00
b931ba6e17 Fixed source creation bug 2021-05-19 08:01:02 +02:00
f611aa73db Publish 2021.4.post1.rc1 2021-05-17 19:43:09 +02:00
69f697e36f Merge pull request '2021.4.4' (#30) from 2021.4.4 into 2021.4.post1
Reviewed-on: sh-edraft.de/sh_cpl#30
2021-05-17 18:34:58 +02:00
654fb69295 Added cli docs 2021-05-17 18:32:09 +02:00
850d44a105 Added docs to cpl.utils 2021-05-17 18:07:08 +02:00
8d4597705d Build docs 2021-05-17 17:55:20 +02:00
fa5655414a Added docs for cpl.mailing 2021-05-17 17:54:57 +02:00
6fc4cebbfe Added docs for cpl.logging 2021-05-17 17:45:22 +02:00
89f3c5833f Added docs for cpl.time 2021-05-17 17:30:26 +02:00
adf9a33e83 Added docs for cpl.environment 2021-05-17 17:28:52 +02:00
4adf6bc834 Added docs for cpl.dependency_injection 2021-05-17 17:22:41 +02:00
9026f021ed Improved docs for cpl.database 2021-05-17 17:13:36 +02:00
e562c31033 Added docs for cpl.database 2021-05-17 17:05:43 +02:00
7b90b5af57 Added docs for cpl.console 2021-05-16 17:42:09 +02:00
cda1fabd4f Added docs for cpl.configuration 2021-05-16 16:57:59 +02:00
4209055d62 Improved documentation for cpl.application 2021-04-14 22:20:18 +02:00
ed1a4eb88c Added cpl_cli docs & moved cpl_cli/templates -> cpl_cli/_templates 2021-04-14 10:58:47 +02:00
478f1ad0ff Added first sphinx generated doc 2021-04-14 10:45:39 +02:00
80eb1da0e1 Merge pull request '2021.4.7' (#29) from 2021.4.7 into 2021.4.post1
Reviewed-on: sh-edraft.de/sh_cpl#29
2021-04-13 15:47:24 +02:00
ae39d43ea9 Added useful deployment scripts & closed #22 2021-04-13 15:43:05 +02:00
602c48bc06 Bugfixes for help command handling 2021-04-13 15:27:19 +02:00
d34d501520 Bugfixes for help command 2021-04-12 20:22:28 +02:00
8f3ee53915 Fixed typos 2021-04-12 20:05:55 +02:00
7eca382cb3 Added help messages to cli commands 2021-04-12 20:02:45 +02:00
f8f5d46491 Added help message to generate command 2021-04-12 19:44:29 +02:00
696c62292b Added logic to cli to use --help option for help command 2021-04-12 19:43:55 +02:00
d94b25d9d8 Improved configuration console argument handling 2021-04-12 19:43:30 +02:00
93829027af Added help message to all cli commands 2021-04-11 16:36:59 +02:00
cce4b6b191 Merge pull request '2021.4.6' (#25) from 2021.4.6 into 2021.4.post1
Reviewed-on: sh-edraft.de/sh_cpl#25
2021-04-11 15:54:37 +02:00
0876f06282 Improved cpl-project related files & closed #20 2021-04-11 15:50:13 +02:00
c970412a66 Fixed relative path handling in add command 2021-04-11 15:42:34 +02:00
6af9328e14 Added cli command add 2021-04-11 15:36:04 +02:00
5987b71c80 Improved configuration to allow multiple arguments 2021-04-11 15:09:11 +02:00
79fdc0c60b Improved configuration to allow multiple arguments 2021-04-11 15:00:54 +02:00
cfb6a84799 Fixed console argument handling 2021-04-11 14:44:46 +02:00
faa7e701fd Fixed workspace loading error for update command 2021-04-11 14:21:59 +02:00
d5b8286f68 Fixed workspace loading error for update command 2021-04-11 13:23:02 +02:00
a3d5737eaf Fixed workspace loading error for update command 2021-04-11 13:20:32 +02:00
314bb1b722 Fixed workspace loading error for update command 2021-04-11 13:15:19 +02:00
1c353bbcdf Improved cli workspace handling 2021-04-11 13:00:26 +02:00
036b9dcc2d Added more functions to string 2021-04-11 13:00:05 +02:00
0fec5719bc Added remove to help command 2021-04-11 12:34:02 +02:00
3572081e43 Added remove command 2021-04-11 12:33:05 +02:00
8cf7f494b3 Improved configuration 2021-04-11 12:18:36 +02:00
b1165e169a Improved console argument value handling in configuration 2021-04-11 11:42:48 +02:00
284ebe1b11 Added logic to cpl cli to change cwd only when wanted 2021-04-11 11:12:39 +02:00
d51659db3e Improved cli build and publish to use project references 2021-04-11 11:01:57 +02:00
3aa3a874c9 Improved default cwd in ApplicationEnvironment 2021-04-11 10:04:55 +02:00
113d3199b1 Improved main.py templates for new command to handle local imports 2021-04-10 12:04:47 +02:00
5712a9ad67 Improved file creation new command 2021-04-10 11:50:35 +02:00
1f8d420749 Improved workspace handling in new command 2021-04-10 11:46:36 +02:00
9065ef901c Improved new command to handle existing projects better 2021-04-10 11:24:39 +02:00
b2c5d304f8 Improved path and name handling in new command 2021-04-10 11:14:37 +02:00
70ae7dd9e6 Fixed workspace creation error 2021-04-10 11:06:58 +02:00
94b122d677 Removed unused import 2021-04-10 11:05:31 +02:00
f6fc5d09e7 Improved path and name handling in new command 2021-04-10 11:01:56 +02:00
2b5c75cc67 Improved workspace handling to new command for console type 2021-04-09 22:41:04 +02:00
167f813bcf Removed dev outputs 2021-04-09 22:26:55 +02:00
7b9765e5b1 Improved readme 2021-04-09 22:16:43 +02:00
7ad01d4bdd Improved new command to use workspace when found 2021-04-09 22:09:55 +02:00
d19c47e571 Added cpl-env to gitignore 2021-04-09 20:52:50 +02:00
4bfc647b91 Improved live dev server to use venv 2021-04-09 20:42:15 +02:00
98117ed7ad Moved templates/[..]/src to templates/[..]/source to prevent 'src' exclusion 2021-04-09 20:26:31 +02:00
cc9b25356c Improved workspace and venv handling for uninstall and install command 2021-04-09 20:07:38 +02:00
a95d6e7f8a Improved configuration to handle absolute paths in add_json_file 2021-04-08 21:40:50 +02:00
fe5c41ac09 Added workspace handling to update command 2021-04-08 21:18:29 +02:00
b672174960 Added workspace handling to uninstall command 2021-04-08 21:14:38 +02:00
a8691ced5b Added workspace handling to install command 2021-04-08 21:12:00 +02:00
fc53f90ecd Added workspace handling for new command 2021-04-08 20:58:55 +02:00
0f836b5c7d Published after file move 2021-04-08 20:28:34 +02:00
34ed7123d1 Improved workspace handling in publish and build command 2021-04-08 20:28:19 +02:00
5f668e17c9 Improved workspace handling in start command 2021-04-08 19:30:00 +02:00
806888bf49 Removed content_root_path 2021-04-08 17:50:54 +02:00
e8756a09ca Improved general test project file 2021-04-08 16:46:46 +02:00
e38988be1b Changed project files of general test project 2021-04-07 22:11:22 +02:00
4009c93353 Added workspace handling to live dev server 2021-04-07 22:00:56 +02:00
3ba5c10fad Publish CLI 2021.4 2021-04-07 19:19:20 +02:00
2552f1d43c Added workspace handling to publish command 2021-04-07 19:18:55 +02:00
5be2e83798 Improved configuration 2021-04-07 18:57:00 +02:00
d4919e027c Removed console output 2021-04-07 18:37:57 +02:00
7ef238b64d Added workspace handling to build command 2021-04-07 18:36:08 +02:00
703d20f43f Improved version handling 2021-04-07 18:35:14 +02:00
d9bd7911ef Improved start command to use workspace 2021-04-07 18:19:55 +02:00
6a5c832288 Added new file structure 2021-04-07 18:19:34 +02:00
dc849c4f71 Improved application environment 2021-04-07 18:06:07 +02:00
76a6ba11fb Publish 2021.4.post1 for local dev 2021-04-07 17:01:39 +02:00
305a19730f Merge pull request 'Fixed #21 - Added logic to automatically add 'src' to path in generate command' (#24) from 2021.4.5 into 2021.4.post1
Reviewed-on: sh-edraft.de/sh_cpl#24
2021-04-07 16:59:24 +02:00
de15e81703 Fixed #21 - Added logic to automatically add 'src' to path in generate command 2021-04-07 16:55:44 +02:00
b91544a0da Edited LICENSE 2021-04-01 11:09:50 +02:00
caca34168e Merge pull request '2021.4' (#19) from 2021.4 into master
Reviewed-on: sh-edraft.de/sh_common_py_lib#19
2021-04-01 10:13:32 +02:00
18b8ac589d Publish 2021.4.0 2021-04-01 10:04:13 +02:00
d85e628784 Improved readme 2021-03-31 15:51:14 +02:00
1e150cf10c Improved readme 2021-03-31 15:49:52 +02:00
9b0f0b7559 Improved readme 2021-03-31 15:49:00 +02:00
cc118b5030 Merge pull request '2021.04.03 - Readme' (#18) from 2021.04.03 into 2021.4
Reviewed-on: sh-edraft.de/sh_common_py_lib#18
2021-03-31 15:42:40 +02:00
3e7ff78861 Merge branch '2021.4' into 2021.04.03 2021-03-31 15:40:18 +02:00
448d538d21 Updated reame 2021-03-31 15:38:26 +02:00
d368161eb3 Publish 2021.4.0rc7 2021-03-31 12:11:55 +02:00
eef8488ca2 Bugfixes for new lib 2021-03-31 12:11:19 +02:00
b22d04b145 Publish 2021.4.0rc6 2021-03-31 12:03:15 +02:00
6579e54c2b Improved windows support 2021-03-31 12:02:51 +02:00
88c0153ca2 Improved windows support for publisher 2021-03-31 11:55:46 +02:00
f28c6ab309 Removed prints 2021-03-31 11:51:20 +02:00
976041f812 Publish 2021.4.0rc5 2021-03-31 11:48:26 +02:00
7693dd462f Bugfixes for publisher windows support 2021-03-31 11:47:47 +02:00
df5e61cf98 Bugfixes for publisher windows support 2021-03-31 11:47:28 +02:00
df87d08be3 Bugfix for live server windows support 2021-03-31 11:41:16 +02:00
33cb35e26f Publish 2021.4.0rc4.post1 2021-03-31 11:25:07 +02:00
18b2cd8f2f Publish 2021.4.0rc4 2021-03-31 11:01:08 +02:00
7ab2a881e8 Bugfixes 2021-03-31 10:47:14 +02:00
960de880ee Bugfixes 2021-03-31 10:44:54 +02:00
c0d8904782 Bugfixes for the command new 2021-03-31 10:19:54 +02:00
b6d508526a Bugfixes for the command new 2021-03-31 09:46:41 +02:00
31307485f0 Bugfixes in new command template 2021-03-31 09:13:04 +02:00
612c3583f1 Removed ununsed files 2021-03-30 21:02:36 +02:00
6cdd3376f1 Publish 2021.4.0rc3 2021-03-30 21:01:10 +02:00
b947789779 Bugfixes 2021-03-30 20:59:09 +02:00
0da83935fc Bugfixes 2021-03-30 12:44:31 +02:00
3428c70b69 Bugfixes 2021-03-30 11:54:44 +02:00
3d511ff727 Bugfixes 2021-03-30 11:53:07 +02:00
cf2f293290 Publish 2021.4.0rc2 2021-03-30 11:03:16 +02:00
c39601a35d Improved publisher 2021-03-30 11:02:58 +02:00
5f36e0a43e Improved publisher 2021-03-30 10:43:39 +02:00
31fe1c5cd7 Improved service collection 2021-03-30 10:29:50 +02:00
0cdecd893a Improved database context 2021-03-30 10:06:07 +02:00
260fe06be8 Improved new command 2021-03-30 09:54:04 +02:00
8ddfd35a82 Improved generate command 2021-03-30 09:47:47 +02:00
099bae3d7c Removed usage of ServiceABC 2021-03-30 09:27:45 +02:00
9758e1fae2 Improved update command 2021-03-29 16:16:27 +02:00
211143d6ab Package update 2021-03-29 16:06:54 +02:00
70b49a098a Publish 2021.4.0rc1 2021-03-29 15:59:05 +02:00
e2544f90fe Merge pull request '2021.4.2' (#12) from 2021.4.2 into 2021.4
Reviewed-on: sh-edraft.de/sh_common_py_lib#12
2021-03-29 15:48:58 +02:00
c223524d1b Removed direct import 2021-03-29 15:47:41 +02:00
1789e2671a Publish 2021.4.2 2021-03-29 15:26:45 +02:00
d0812bcf5c Added database table test 2021-03-29 14:29:17 +02:00
4d5368e5fc Bugfixes & improved database context handling 2021-03-29 14:18:58 +02:00
f3be927440 Removed service abc 2021-03-29 13:29:26 +02:00
d0e3e1792f Added db context handling 2021-03-29 13:25:25 +02:00
31793fb290 Added db context handling 2021-03-29 13:25:15 +02:00
41ddc86961 Bugfixes 2021-03-29 12:16:12 +02:00
30ef74dd18 Added generated simple di test app 2021-03-29 11:48:25 +02:00
bc69476bb2 Improved new project templates & publish 2021.4.2.dev1 2021-03-29 11:47:49 +02:00
05b9fd801b Bugfixes 2021-03-29 09:21:58 +02:00
7af7f866c1 Removed application runtime | Code refactoring p.2 2021-03-29 08:56:18 +02:00
069e44bee6 Code refactoring p.1 2021-03-27 08:41:33 +01:00
3c0dd00a99 Bugfixes 2021-03-26 13:16:40 +01:00
afb91c8f1f Improved service provider 2021-03-23 21:42:08 +01:00
ca51f88d2b Improved service provider 2021-03-23 21:39:29 +01:00
a683b70c5f [WIP] Improved service collection 2021-03-23 20:23:30 +01:00
c650e87443 [WIP] Added first changes for the DI 2021-03-23 20:21:24 +01:00
36dfedf918 Bugfixes cpl cli output 2021-03-23 17:31:24 +01:00
252f2b55fe Bugfixes in templates 2021-03-23 17:29:13 +01:00
99091a2540 Publish for 2021.4.2 2021-03-21 20:22:04 +01:00
c3fdb7a049 Changed version 2021-03-21 20:05:51 +01:00
601 changed files with 18452 additions and 5163 deletions

9
.gitignore vendored
View File

@@ -106,10 +106,14 @@ celerybeat.pid
.venv
env/
venv/
venv_*/
ENV/
env.bak/
venv.bak/
# Custom Environments
cpl-env/
# Spyder project settings
.spyderproject
.spyproject
@@ -129,5 +133,8 @@ dmypy.json
.pyre/
# IDE
.vscode/
.idea/
PythonImportHelper-v2-Completion.json
# cpl unittest stuff
unittests/test_*_playground

View File

@@ -1,4 +1,4 @@
MIT License Copyright (c) <year> <copyright holders>
MIT License Copyright (c) 2020 - 2023 sh-edraft.de
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

153
README.md
View File

@@ -1,2 +1,153 @@
# sh_common_py_lib
<h1 align="center">CPL - Common python library</h1>
<!-- Summary -->
<p align="center">
<!-- <img src="" alt="cpl-logo" width="120px" height="120px"/> -->
<br>
<i>
CPL is a development platform for python server applications
<br>using Python.</i>
<br>
</p>
## Table of Contents
<!-- TABLE OF CONTENTS -->
<ol>
<li><a href="#Features">Features</a></li>
<li>
<a href="#getting-started">Getting Started</a>
<ul>
<li><a href="#prerequisites">Prerequisites</a></li>
<li><a href="#installation">Installation</a></li>
</ul>
</li>
<li><a href="#roadmap">Roadmap</a></li>
<li><a href="#contributing">Contributing</a></li>
<li><a href="#license">License</a></li>
<li><a href="#contact">Contact</a></li>
</ol>
## Features
<!-- FEATURE OVERVIEW -->
- Expandle
- Application base
- Standardized application classes
- Application object builder
- Application extension classes
- Startup classes
- Startup extension classes
- Configuration
- Configure via object mapped JSON
- Console argument handling
- Console class for in and output
- Banner
- Spinner
- Options (menu)
- Table
- Write
- Write_at
- Write_line
- Write_line_at
- Dependency injection
- Service lifetimes: singleton, scoped and transient
- Providing of application environment
- Environment (development, staging, testing, production)
- Appname
- Customer
- Hostname
- Runtime directory
- Working directory
- Logging
- Standardized logger
- Log-level (FATAL, ERROR, WARN, INFO, DEBUG & TRACE)
- Mail handling
- Send mails
- Pipe classes
- Convert input
- Utils
- Credential manager
- Encryption via BASE64
- PIP wrapper class based on subprocess
- Run pip commands
- String converter to different variants
- to_lower_case
- to_camel_case
- ...
<!-- GETTING STARTED -->
## Getting Started
[Get started with CPL][quickstart].
### Prerequisites
- Install [python] which includes [Pip installs packages][pip]
### Installation
Install the CPL package
```sh
pip install cpl-core --extra-index-url https://pip.sh-edraft.de
```
Install the CPL CLI
```sh
pip install cpl-cli --extra-index-url https://pip.sh-edraft.de
```
Create workspace:
```sh
cpl new <console|library|unittest> <PROJECT NAME>
```
Run the application:
```sh
cd <PROJECT NAME>
cpl start
```
<!-- ROADMAP -->
## Roadmap
See the [open issues](https://git.sh-edraft.de/sh-edraft.de/sh_cpl/issues) for a list of proposed features (and known issues).
<!-- CONTRIBUTING -->
## Contributing
### Contributing Guidelines
Read through our [contributing guidelines][contributing] to learn about our submission process, coding rules and more.
### Want to Help?
Want to file a bug, contribute some code, or improve documentation? Excellent! Read up on our guidelines for [contributing][contributing].
<!-- LICENSE -->
## License
Distributed under the MIT License. See [LICENSE] for more information.
<!-- CONTACT -->
## Contact
Sven Heidemann - sven.heidemann@sh-edraft.de
Project link: [https://git.sh-edraft.de/sh-edraft.de/sh_common_py_lib](https://git.sh-edraft.de/sh-edraft.de/sh_cpl)
<!-- External LINKS -->
[pip_url]: https://pip.sh-edraft.de
[python]: https://www.python.org/
[pip]: https://pypi.org/project/pip/
<!-- Internal LINKS -->
[project]: https://git.sh-edraft.de/sh-edraft.de/sh_cpl
[quickstart]: https://git.sh-edraft.de/sh-edraft.de/sh_cpl/wiki/quickstart
[contributing]: https://git.sh-edraft.de/sh-edraft.de/sh_cpl/wiki/contributing
[license]: LICENSE

151
cpl-workspace.json Normal file
View File

@@ -0,0 +1,151 @@
{
"WorkspaceSettings": {
"DefaultProject": "cpl-core",
"Projects": {
"cpl-cli": "src/cpl_cli/cpl-cli.json",
"cpl-core": "src/cpl_core/cpl-core.json",
"cpl-discord": "src/cpl_discord/cpl-discord.json",
"cpl-query": "src/cpl_query/cpl-query.json",
"cpl-translation": "src/cpl_translation/cpl-translation.json",
"set-version": "tools/set_version/set-version.json",
"set-pip-urls": "tools/set_pip_urls/set-pip-urls.json",
"unittests": "unittests/unittests/unittests.json",
"unittests_cli": "unittests/unittests_cli/unittests_cli.json",
"unittests_core": "unittests/unittests_core/unittests_core.json",
"unittests_query": "unittests/unittests_query/unittests_query.json",
"unittests_shared": "unittests/unittests_shared/unittests_shared.json",
"unittests_translation": "unittests/unittests_translation/unittests_translation.json"
},
"Scripts": {
"hello-world": "echo 'Hello World'",
"format": "echo 'Formatting:'; black ./",
"sv": "cpl set-version",
"set-version": "cpl run set-version --dev $ARGS; echo '';",
"spu": "cpl set-pip-urls",
"set-pip-urls": "cpl run set-pip-urls --dev $ARGS; echo '';",
"docs-build": "cpl format; echo 'Build Documentation'; cpl db-core; cpl db-discord; cpl db-query; cpl db-translation; cd docs/; make clean; make html;",
"db-core": "cd docs/; sphinx-apidoc -o source/ ../src/cpl_core; cd ../",
"db-discord": "cd docs/; sphinx-apidoc -o source/ ../src/cpl_discord; cd ../",
"db-query": "cd docs/; sphinx-apidoc -o source/ ../src/cpl_query; cd ../",
"db-translation": "cd docs/; sphinx-apidoc -o source/ ../src/cpl_translation; cd ../",
"db": "cpl docs-build",
"docs-open": "xdg-open $PWD/docs/build/html/index.html &",
"do": "cpl docs-open",
"test": "cpl run unittests",
"pre-build-all": "cpl sv $ARGS; cpl spu $ARGS;",
"build-all": "cpl build-cli; cpl build-core; cpl build-discord; cpl build-query; cpl build-translation; cpl build-set-pip-urls; cpl build-set-version",
"ba": "cpl build-all $ARGS",
"build-cli": "echo 'Build cpl-cli'; cd ./src/cpl_cli; cpl build; cd ../../;",
"build-core": "echo 'Build cpl-core'; cd ./src/cpl_core; cpl build; cd ../../;",
"build-discord": "echo 'Build cpl-discord'; cd ./src/cpl_discord; cpl build; cd ../../;",
"build-query": "echo 'Build cpl-query'; cd ./src/cpl_query; cpl build; cd ../../;",
"build-translation": "echo 'Build cpl-translation'; cd ./src/cpl_translation; cpl build; cd ../../;",
"build-set-pip-urls": "echo 'Build set-pip-urls'; cd ./tools/set_pip_urls; cpl build; cd ../../;",
"build-set-version": "echo 'Build set-version'; cd ./tools/set_version; cpl build; cd ../../;",
"pre-publish-all": "cpl sv $ARGS; cpl spu $ARGS;",
"publish-all": "cpl publish-cli; cpl publish-core; cpl publish-discord; cpl publish-query; cpl publish-translation;",
"pa": "cpl publish-all $ARGS",
"publish-cli": "echo 'Publish cpl-cli'; cd ./src/cpl_cli; cpl publish; cd ../../;",
"publish-core": "echo 'Publish cpl-core'; cd ./src/cpl_core; cpl publish; cd ../../;",
"publish-discord": "echo 'Publish cpl-discord'; cd ./src/cpl_discord; cpl publish; cd ../../;",
"publish-query": "echo 'Publish cpl-query'; cd ./src/cpl_query; cpl publish; cd ../../;",
"publish-translation": "echo 'Publish cpl-translation'; cd ./src/cpl_translation; cpl publish; cd ../../;",
"upload-prod-cli": "echo 'PROD Upload cpl-cli'; cpl upl-prod-cli;",
"upl-prod-cli": "twine upload -r pip.sh-edraft.de dist/cpl-cli/publish/setup/*",
"upload-prod-core": "echo 'PROD Upload cpl-core'; cpl upl-prod-core;",
"upl-prod-core": "twine upload -r pip.sh-edraft.de dist/cpl-core/publish/setup/*",
"upload-prod-discord": "echo 'PROD Upload cpl-discord'; cpl upl-prod-discord;",
"upl-prod-discord": "twine upload -r pip.sh-edraft.de dist/cpl-discord/publish/setup/*",
"upload-prod-query": "echo 'PROD Upload cpl-query'; cpl upl-prod-query;",
"upl-prod-query": "twine upload -r pip.sh-edraft.de dist/cpl-query/publish/setup/*",
"upload-prod-translation": "echo 'PROD Upload cpl-translation'; cpl upl-prod-translation;",
"upl-prod-translation": "twine upload -r pip.sh-edraft.de dist/cpl-translation/publish/setup/*",
"upload-exp-cli": "echo 'EXP Upload cpl-cli'; cpl upl-exp-cli;",
"upl-exp-cli": "twine upload -r pip-exp.sh-edraft.de dist/cpl-cli/publish/setup/*",
"upload-exp-core": "echo 'EXP Upload cpl-core'; cpl upl-exp-core;",
"upl-exp-core": "twine upload -r pip-exp.sh-edraft.de dist/cpl-core/publish/setup/*",
"upload-exp-discord": "echo 'EXP Upload cpl-discord'; cpl upl-exp-discord;",
"upl-exp-discord": "twine upload -r pip-exp.sh-edraft.de dist/cpl-discord/publish/setup/*",
"upload-exp-query": "echo 'EXP Upload cpl-query'; cpl upl-exp-query;",
"upl-exp-query": "twine upload -r pip-exp.sh-edraft.de dist/cpl-query/publish/setup/*",
"upload-exp-translation": "echo 'EXP Upload cpl-translation'; cpl upl-exp-translation;",
"upl-exp-translation": "twine upload -r pip-exp.sh-edraft.de dist/cpl-translation/publish/setup/*",
"upload-dev-cli": "echo 'DEV Upload cpl-cli'; cpl upl-dev-cli;",
"upl-dev-cli": "twine upload -r pip-dev.sh-edraft.de dist/cpl-cli/publish/setup/*",
"upload-dev-core": "echo 'DEV Upload cpl-core'; cpl upl-dev-core;",
"upl-dev-core": "twine upload -r pip-dev.sh-edraft.de dist/cpl-core/publish/setup/*",
"upload-dev-discord": "echo 'DEV Upload cpl-discord'; cpl upl-dev-discord;",
"upl-dev-discord": "twine upload -r pip-dev.sh-edraft.de dist/cpl-discord/publish/setup/*",
"upload-dev-query": "echo 'DEV Upload cpl-query'; cpl upl-dev-query;",
"upl-dev-query": "twine upload -r pip-dev.sh-edraft.de dist/cpl-query/publish/setup/*",
"upload-dev-translation": "echo 'DEV Upload cpl-translation'; cpl upl-dev-translation;",
"upl-dev-translation": "twine upload -r pip-dev.sh-edraft.de dist/cpl-translation/publish/setup/*",
"pre-deploy-prod": "cpl sv $ARGS; cpl spu --environment=production;",
"deploy-prod": "cpl deploy-prod-cli; cpl deploy-prod-core; cpl deploy-prod-discord; cpl deploy-prod-query; cpl deploy-prod-translation;",
"dp": "cpl deploy-prod $ARGS",
"deploy-prod-cli": "cpl publish-cli; cpl upload-prod-cli",
"deploy-prod-core": "cpl publish-core; cpl upload-prod-core",
"deploy-prod-query": "cpl publish-query; cpl upload-prod-query",
"deploy-prod-discord": "cpl publish-discord; cpl upload-prod-discord",
"deploy-prod-translation": "cpl publish-translation; cpl upload-prod-translation",
"pre-deploy-exp": "cpl sv $ARGS; cpl spu --environment=staging;",
"deploy-exp": "cpl deploy-exp-cli; cpl deploy-exp-core; cpl deploy-exp-discord; cpl deploy-exp-query; cpl deploy-exp-translation;",
"de": "cpl deploy-exp $ARGS",
"deploy-exp-cli": "cpl publish-cli; cpl upload-exp-cli",
"deploy-exp-core": "cpl publish-core; cpl upload-exp-core",
"deploy-exp-discord": "cpl publish-discord; cpl upload-exp-discord",
"deploy-exp-query": "cpl publish-query; cpl upload-exp-query",
"deploy-exp-translation": "cpl publish-translation; cpl upload-exp-translation",
"pre-deploy-dev": "cpl sv $ARGS; cpl spu --environment=development;",
"deploy-dev": "cpl deploy-dev-cli; cpl deploy-dev-core; cpl deploy-dev-discord; cpl deploy-dev-query; cpl deploy-dev-translation;",
"dd": "cpl deploy-dev $ARGS",
"deploy-dev-cli": "cpl publish-cli; cpl upload-dev-cli",
"deploy-dev-core": "cpl publish-core; cpl upload-dev-core",
"deploy-dev-discord": "cpl publish-discord; cpl upload-dev-discord",
"deploy-dev-query": "cpl publish-query; cpl upload-dev-query",
"deploy-dev-translation": "cpl publish-query; cpl upload-dev-translation",
"dev-install": "cpl di-core; cpl di-cli; cpl di-query; cpl di-translation;",
"di": "cpl dev-install",
"di-core": "pip install cpl-core --pre --upgrade --extra-index-url https://pip-dev.sh-edraft.de",
"di-cli": "pip install cpl-cli --pre --upgrade --extra-index-url https://pip-dev.sh-edraft.de",
"di-discord": "pip install cpl-discord --pre --upgrade --extra-index-url https://pip-dev.sh-edraft.de",
"di-query": "pip install cpl-query --pre --upgrade --extra-index-url https://pip-dev.sh-edraft.de",
"di-translation": "pip install cpl-translation --pre --upgrade --extra-index-url https://pip-dev.sh-edraft.de",
"prod-install": "cpl pi-core; cpl pi-cli; cpl pi-query; cpl pi-translation;",
"pi": "cpl prod-install",
"pi-core": "pip install cpl-core --pre --upgrade --extra-index-url https://pip.sh-edraft.de",
"pi-cli": "pip install cpl-cli --pre --upgrade --extra-index-url https://pip.sh-edraft.de",
"pi-discord": "pip install cpl-discord --pre --upgrade --extra-index-url https://pip.sh-edraft.de",
"pi-query": "pip install cpl-query --pre --upgrade --extra-index-url https://pip.sh-edraft.de",
"pi-translation": "pip install cpl-translation --pre --upgrade --extra-index-url https://pip.sh-edraft.de"
}
}
}

View File

@@ -1,56 +0,0 @@
{
"ProjectSettings": {
"Name": "sh_cpl",
"Version": {
"Major": "2021",
"Minor": "04",
"Micro": "01-15"
},
"Author": "Sven Heidemann",
"AuthorEmail": "sven.heidemann@sh-edraft.de",
"Description": "sh-edraft Common Python library",
"LongDescription": "sh-edraft Common Python library",
"URL": "https://www.sh-edraft.de",
"CopyrightDate": "2020 - 2021",
"CopyrightName": "sh-edraft.de",
"LicenseName": "MIT",
"LicenseDescription": "MIT, see LICENSE for more details.",
"Dependencies": [
"colorama==0.4.4",
"mysql-connector==2.2.9",
"psutil==5.8.0",
"packaging==20.9",
"pyfiglet==0.8.post1",
"pynput==1.7.3",
"SQLAlchemy==1.4.0",
"setuptools==54.1.2",
"tabulate==0.8.9",
"termcolor==1.1.0",
"watchdog==2.0.2",
"wheel==0.36.2"
],
"PythonVersion": ">=3.8",
"PythonPath": {},
"Classifiers": []
},
"BuildSettings": {
"SourcePath": "src",
"OutputPath": "dist",
"Main": "cpl_cli.main",
"EntryPoint": "cpl",
"IncludePackageData": true,
"Included": [
"*/templates"
],
"Excluded": [
"*/__pycache__",
"*/logs",
"*/tests"
],
"PackageData": {
"cpl_cli": [
"*.json"
]
}
}
}

View File

@@ -1,19 +0,0 @@
prefix: cpl
commands:
build
generate:
abc | a
class | c
configmodel | cm
enum | e
service | s
help
new
console
start
publish
update
version

View File

@@ -1,2 +0,0 @@
python setup.py install # for install
python setup.py sdist bdist_wheel # for build

View File

@@ -1,11 +0,0 @@
upload:
prod:
twine upload --repository-url https://pip.sh-edraft.de dist/publish/setup/*
twine upload -r pip.sh-edraft.de dist/publish/setup/*
dev:
twine upload --repository-url https://pip-dev.sh-edraft.de dist/publish/setup/*
twine upload -r pip-dev.sh-edraft.de dist/publish/setup/*
install:
pip install --extra-index-url https://pip.sh-edraft.de/ sh_cpl

2
pyproject.toml Normal file
View File

@@ -0,0 +1,2 @@
[tool.black]
line-length = 120

View File

@@ -1,25 +0,0 @@
# -*- 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__ = 'sh_cpl.cpl'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
__version__ = '2021.4.1.post15'
from collections import namedtuple
# imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2021', minor='04', micro='01-15')

View File

@@ -1,31 +0,0 @@
# -*- 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.application'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
__version__ = '2021.4.1.post15'
from collections import namedtuple
# imports:
from .application_abc import ApplicationABC
from .application_builder import ApplicationBuilder
from .application_builder_abc import ApplicationBuilderABC
from .application_runtime import ApplicationRuntime
from .application_runtime_abc import ApplicationRuntimeABC
from .startup_abc import StartupABC
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2021', minor='04', micro='01-15')

View File

@@ -1,46 +0,0 @@
from abc import ABC, abstractmethod
from typing import Optional
from cpl.application.application_runtime_abc import ApplicationRuntimeABC
from cpl.configuration.configuration_abc import ConfigurationABC
from cpl.console.console import Console
from cpl.dependency_injection.service_provider_abc import ServiceProviderABC
class ApplicationABC(ABC):
@abstractmethod
def __init__(self, config: ConfigurationABC, runtime: ApplicationRuntimeABC, services: ServiceProviderABC):
"""
ABC of application
"""
self._configuration: Optional[ConfigurationABC] = config
self._runtime: Optional[ApplicationRuntimeABC] = runtime
self._services: Optional[ServiceProviderABC] = services
def run(self):
"""
Entry point
:return:
"""
try:
self.configure()
self.main()
except KeyboardInterrupt:
Console.close()
@abstractmethod
def configure(self):
"""
Prepare the application
:return:
"""
pass
@abstractmethod
def main(self):
"""
Custom entry point
:return:
"""
pass

View File

@@ -1,42 +0,0 @@
from typing import Type, Optional
from cpl.application.application_abc import ApplicationABC
from cpl.application.application_builder_abc import ApplicationBuilderABC
from cpl.application.application_runtime import ApplicationRuntime
from cpl.application.startup_abc import StartupABC
from cpl.configuration import Configuration
from cpl.dependency_injection import ServiceProvider
class ApplicationBuilder(ApplicationBuilderABC):
def __init__(self, app: Type[ApplicationABC]):
"""
Builder class for application
"""
ApplicationBuilderABC.__init__(self)
self._app = app
self._startup: Optional[StartupABC] = None
self._configuration = Configuration()
self._runtime = ApplicationRuntime()
self._services = ServiceProvider(self._configuration, self._runtime)
def use_startup(self, startup: Type[StartupABC]):
"""
Sets the used startup class
:param startup:
:return:
"""
self._startup = startup(self._configuration, self._runtime, self._services)
def build(self) -> ApplicationABC:
"""
Creates application host and runtime
:return:
"""
if self._startup is not None:
self._startup.configure_configuration()
self._startup.configure_services()
return self._app(self._configuration, self._runtime, self._services)

View File

@@ -1,30 +0,0 @@
from abc import ABC, abstractmethod
from typing import Type
from cpl.application.application_abc import ApplicationABC
from cpl.application.startup_abc import StartupABC
class ApplicationBuilderABC(ABC):
def __init__(self, *args):
"""
ABC of application builder
"""
@abstractmethod
def use_startup(self, startup: Type[StartupABC]):
"""
Sets the used startup class
:param startup:
:return:
"""
pass
@abstractmethod
def build(self) -> ApplicationABC:
"""
Creates application host and runtime
:return:
"""
pass

View File

@@ -1,52 +0,0 @@
import pathlib
from datetime import datetime
from cpl.application.application_runtime_abc import ApplicationRuntimeABC
class ApplicationRuntime(ApplicationRuntimeABC):
def __init__(self):
"""
Representation of the application runtime
"""
ApplicationRuntimeABC.__init__(self)
self._start_time: datetime = datetime.now()
self._end_time: datetime = datetime.now()
self._working_directory = pathlib.Path().absolute()
self._runtime_directory = pathlib.Path(__file__).parent.absolute()
@property
def start_time(self) -> datetime:
return self._start_time
@property
def end_time(self) -> datetime:
return self._end_time
@end_time.setter
def end_time(self, end_time: datetime):
self._end_time = end_time
@property
def date_time_now(self) -> datetime:
return datetime.now()
@property
def working_directory(self) -> str:
return self._working_directory
def set_working_directory(self, path: str = ''):
if path != '':
self._working_directory = path
return
self._working_directory = pathlib.Path().absolute()
@property
def runtime_directory(self) -> str:
return self._runtime_directory
def set_runtime_directory(self, file: str):
self._runtime_directory = pathlib.Path(file).parent.absolute()

View File

@@ -1,49 +0,0 @@
from abc import ABC, abstractmethod
from datetime import datetime
class ApplicationRuntimeABC(ABC):
@abstractmethod
def __init__(self):
"""
ABC for application runtime
"""
pass
@property
@abstractmethod
def start_time(self) -> datetime: pass
@start_time.setter
@abstractmethod
def start_time(self, start_time: datetime): pass
@property
@abstractmethod
def end_time(self): pass
@end_time.setter
@abstractmethod
def end_time(self, end_time: datetime): pass
@property
@abstractmethod
def date_time_now(self) -> datetime: pass
@property
@abstractmethod
def working_directory(self) -> str: pass
@property
@abstractmethod
def runtime_directory(self) -> str: pass
@abstractmethod
def set_runtime_directory(self, runtime_directory: str):
"""
Sets the current runtime directory
:param runtime_directory:
:return:
"""
pass

View File

@@ -1,29 +0,0 @@
from abc import ABC, abstractmethod
from cpl.configuration.configuration_abc import ConfigurationABC
from cpl.dependency_injection.service_provider_abc import ServiceProviderABC
class StartupABC(ABC):
@abstractmethod
def __init__(self, *args):
"""
ABC for a startup class
"""
@abstractmethod
def configure_configuration(self) -> ConfigurationABC:
"""
Creates configuration of application
:return: configuration
"""
pass
@abstractmethod
def configure_services(self) -> ServiceProviderABC:
"""
Creates service provider
:return: service provider
"""
pass

View File

@@ -1,30 +0,0 @@
# -*- 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.configuration'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
__version__ = '2021.4.1.post15'
from collections import namedtuple
# imports:
from .configuration import Configuration
from .configuration_abc import ConfigurationABC
from .configuration_model_abc import ConfigurationModelABC
from .configuration_variable_name_enum import ConfigurationVariableNameEnum
from .console_argument import ConsoleArgument
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2021', minor='04', micro='01-15')

View File

@@ -1,357 +0,0 @@
import json
import os
import sys
from collections import Callable
from typing import Union, Type, Optional
from cpl.configuration.configuration_abc import ConfigurationABC
from cpl.configuration.configuration_model_abc import ConfigurationModelABC
from cpl.configuration.configuration_variable_name_enum import ConfigurationVariableNameEnum
from cpl.configuration.console_argument import ConsoleArgument
from cpl.console.console import Console
from cpl.console.foreground_color_enum import ForegroundColorEnum
from cpl.environment.application_environment import ApplicationEnvironment
from cpl.environment.environment_abc import ApplicationEnvironmentABC
from cpl.environment.environment_name_enum import EnvironmentNameEnum
class Configuration(ConfigurationABC):
def __init__(self):
"""
Representation of configuration
"""
ConfigurationABC.__init__(self)
self._application_environment = ApplicationEnvironment()
self._config: dict[Union[type, str], Union[ConfigurationModelABC, str]] = {}
self._argument_types: list[ConsoleArgument] = []
self._additional_arguments: list[str] = []
self._argument_error_function: Optional[Callable] = None
self._handled_args = []
@property
def environment(self) -> ApplicationEnvironmentABC:
return self._application_environment
@property
def additional_arguments(self) -> list[str]:
return self._additional_arguments
@property
def argument_error_function(self) -> Optional[Callable]:
return self._argument_error_function
@argument_error_function.setter
def argument_error_function(self, argument_error_function: Callable):
self._argument_error_function = argument_error_function
@staticmethod
def _print_info(name: str, message: str):
"""
Prints an info message
:param name:
:param message:
:return:
"""
Console.set_foreground_color(ForegroundColorEnum.green)
Console.write_line(f'[{name}] {message}')
Console.set_foreground_color(ForegroundColorEnum.default)
@staticmethod
def _print_warn(name: str, message: str):
"""
Prints a warning
:param name:
:param message:
:return:
"""
Console.set_foreground_color(ForegroundColorEnum.yellow)
Console.write_line(f'[{name}] {message}')
Console.set_foreground_color(ForegroundColorEnum.default)
@staticmethod
def _print_error(name: str, message: str):
"""
Prints an error
:param name:
:param message:
:return:
"""
Console.set_foreground_color(ForegroundColorEnum.red)
Console.write_line(f'[{name}] {message}')
Console.set_foreground_color(ForegroundColorEnum.default)
def _set_variable(self, name: str, value: str):
"""
Sets variable to given value
:param name:
:param value:
:return:
"""
if name == ConfigurationVariableNameEnum.environment.value:
self._application_environment.environment_name = EnvironmentNameEnum(value)
elif name == ConfigurationVariableNameEnum.name.value:
self._application_environment.application_name = value
elif name == ConfigurationVariableNameEnum.customer.value:
self._application_environment.customer = value
else:
self._config[name] = value
def _validate_argument_child(self, argument: str, argument_type: ConsoleArgument,
next_arguments: Optional[list[str]]) -> bool:
"""
Validates the child arguments of argument
:param argument:
:param argument_type:
:param next_arguments:
:return:
"""
if argument_type.console_arguments is not None and len(argument_type.console_arguments) > 0:
found = False
for child_argument_type in argument_type.console_arguments:
found = self._validate_argument_by_argument_type(argument, child_argument_type, next_arguments)
if found and child_argument_type.name not in self._additional_arguments:
self._additional_arguments.append(child_argument_type.name)
if not found:
raise Exception(f'Invalid argument: {argument}')
return found
return True
def _validate_argument_by_argument_type(self, argument: str, argument_type: ConsoleArgument,
next_arguments: list[str] = None) -> bool:
"""
Validate argument by argument type
:param argument:
:param argument_type:
:param next_arguments:
:return:
"""
argument_name = ''
value = ''
result = False
if argument_type.value_token != '' and argument_type.value_token in argument:
# ?new=value
found = False
for alias in argument_type.aliases:
if alias in argument:
found = True
if argument_type.name not in argument_name and not found:
return False
if argument_type.is_value_token_optional is not None and argument_type.is_value_token_optional:
if argument_type.name not in self._additional_arguments:
self._additional_arguments.append(argument_type.name)
result = True
if argument_type.token != '' and argument.startswith(argument_type.token):
# --new=value
argument_name = argument.split(argument_type.token)[1].split(argument_type.value_token)[0]
else:
# new=value
argument_name = argument.split(argument_type.token)[1]
result = True
if argument_type.is_value_token_optional is True:
is_valid = False
name_list = argument.split(argument_type.token)
if len(name_list) > 1:
value_list = name_list[1].split(argument_type.value_token)
if len(value_list) > 1:
is_valid = True
value = argument.split(argument_type.token)[1].split(argument_type.value_token)[1]
if not is_valid:
if argument_type.name not in self._additional_arguments:
self._additional_arguments.append(argument_type.name)
result = True
else:
value = argument.split(argument_type.token)[1].split(argument_type.value_token)[1]
if argument_name != argument_type.name and argument_name not in argument_type.aliases:
return False
self._set_variable(argument_type.name, value)
result = True
elif argument_type.value_token == ' ':
# ?new value
found = False
for alias in argument_type.aliases:
if alias in argument:
found = True
if argument_type.name not in argument and not found:
return False
if (next_arguments is None or len(next_arguments) == 0) and \
argument_type.is_value_token_optional is not True:
raise Exception(f'Invalid argument: {argument}')
if (next_arguments is None or len(next_arguments) == 0) and argument_type.is_value_token_optional is True:
value = ''
else:
value = next_arguments[0]
self._handled_args.append(value)
if argument_type.token != '' and argument.startswith(argument_type.token):
# --new value
argument_name = argument.split(argument_type.token)[1]
else:
# new value
argument_name = argument
if argument_name != argument_type.name and argument_name not in argument_type.aliases:
return False
if value == '':
if argument_type.name not in self._additional_arguments:
self._additional_arguments.append(argument_type.name)
else:
self._set_variable(argument_type.name, value)
result = True
elif argument_type.name == argument or argument in argument_type.aliases:
# new
self._additional_arguments.append(argument_type.name)
result = True
if result:
self._handled_args.append(argument)
if next_arguments is not None and len(next_arguments) > 0:
next_args = []
if len(next_arguments) > 1:
next_args = next_arguments[1:]
result = self._validate_argument_child(next_arguments[0], argument_type, next_args)
return result
def add_environment_variables(self, prefix: str):
for variable in ConfigurationVariableNameEnum.to_list():
var_name = f'{prefix}{variable}'
if var_name in [key.upper() for key in os.environ.keys()]:
self._set_variable(variable, os.environ[var_name])
def add_console_argument(self, argument: ConsoleArgument):
self._argument_types.append(argument)
def add_console_arguments(self, error: bool = None):
for arg_name in ConfigurationVariableNameEnum.to_list():
self.add_console_argument(ConsoleArgument('--', str(arg_name).upper(), [str(arg_name).lower()], '='))
arg_list = sys.argv[1:]
for i in range(0, len(arg_list)):
argument = arg_list[i]
next_arguments = []
error_message = ''
if argument in self._handled_args:
break
if i + 1 < len(arg_list):
next_arguments = arg_list[i + 1:]
found = False
for argument_type in self._argument_types:
try:
found = self._validate_argument_by_argument_type(argument, argument_type, next_arguments)
if found:
break
except Exception as e:
error_message = e
if not found and error_message == '' and error is not False:
error_message = f'Invalid argument: {argument}'
if self._argument_error_function is not None:
self._argument_error_function(error_message)
else:
self._print_error(__name__, error_message)
exit()
def add_json_file(self, name: str, optional: bool = None, output: bool = True, path: str = None):
path_root = self._application_environment.content_root_path
if path is not None:
path_root = path
if str(path_root).endswith('/') and not name.startswith('/'):
file_path = f'{path_root}{name}'
else:
file_path = f'{path_root}/{name}'
if not os.path.isfile(file_path):
if optional is not True:
if output:
self._print_error(__name__, f'File not found: {file_path}')
exit()
if output:
self._print_warn(__name__, f'Not Loaded config file: {file_path}')
return None
config_from_file = self._load_json_file(file_path, output)
for sub in ConfigurationModelABC.__subclasses__():
for key, value in config_from_file.items():
if sub.__name__ == key or sub.__name__.replace('Settings', '') == key:
configuration = sub()
configuration.from_dict(value)
self.add_configuration(sub, configuration)
def _load_json_file(self, file: str, output: bool) -> dict:
"""
Reads the json file
:param file:
:param output:
:return:
"""
try:
# open config file, create if not exists
with open(file, encoding='utf-8') as cfg:
# load json
json_cfg = json.load(cfg)
if output:
self._print_info(__name__, f'Loaded config file: {file}')
return json_cfg
except Exception as e:
self._print_error(__name__, f'Cannot load config file: {file}! -> {e}')
return {}
def add_configuration(self, key_type: type, value: ConfigurationModelABC):
self._config[key_type] = value
def get_configuration(self, search_type: Union[str, Type[ConfigurationModelABC]]) -> Union[
str, Callable[ConfigurationModelABC]]:
if type(search_type) is str:
if search_type == ConfigurationVariableNameEnum.environment.value:
return self._application_environment.environment_name
elif search_type == ConfigurationVariableNameEnum.name.value:
return self._application_environment.application_name
elif search_type == ConfigurationVariableNameEnum.customer.value:
return self._application_environment.customer
if search_type not in self._config:
return None
for config_model in self._config:
if config_model == search_type:
return self._config[config_model]

View File

@@ -1,92 +0,0 @@
from abc import abstractmethod, ABC
from collections import Callable
from typing import Type, Union, Optional
from cpl.configuration.console_argument import ConsoleArgument
from cpl.configuration.configuration_model_abc import ConfigurationModelABC
from cpl.environment.environment_abc import ApplicationEnvironmentABC
class ConfigurationABC(ABC):
@abstractmethod
def __init__(self):
"""
ABC of configuration
"""
pass
@property
@abstractmethod
def environment(self) -> ApplicationEnvironmentABC: pass
@property
@abstractmethod
def additional_arguments(self) -> list[str]: pass
@property
@abstractmethod
def argument_error_function(self) -> Optional[Callable]: pass
@argument_error_function.setter
@abstractmethod
def argument_error_function(self, argument_error_function: Callable): pass
@abstractmethod
def add_environment_variables(self, prefix: str):
"""
Reads the environment variables
:param prefix:
:return:
"""
pass
@abstractmethod
def add_console_argument(self, argument: ConsoleArgument):
"""
Adds console argument to known console arguments
:param argument:
:return:
"""
pass
@abstractmethod
def add_console_arguments(self, error: bool = None):
"""
Reads the console arguments
:param error: defines is invalid argument error will be shown or not
:return:
"""
pass
@abstractmethod
def add_json_file(self, name: str, optional: bool = None, output: bool = True, path: str = None):
"""
Reads and saves settings from given json file
:param name:
:param optional:
:param output:
:param path:
:return:
"""
pass
@abstractmethod
def add_configuration(self, key_type: type, value: object):
"""
Add configuration object
:param key_type:
:param value:
:return:
"""
pass
@abstractmethod
def get_configuration(self, search_type: Union[str, Type[ConfigurationModelABC]]) -> Union[
str, Callable[ConfigurationModelABC]]:
"""
Returns value in configuration by given type
:param search_type:
:return:
"""
pass

View File

@@ -1,20 +0,0 @@
from abc import ABC, abstractmethod
class ConfigurationModelABC(ABC):
@abstractmethod
def __init__(self):
"""
ABC for settings representation
"""
pass
@abstractmethod
def from_dict(self, settings: dict):
"""
Converts attributes to dict
:param settings:
:return:
"""
pass

View File

@@ -1,49 +0,0 @@
class ConsoleArgument:
def __init__(self,
token: str,
name: str,
aliases: list[str],
value_token: str,
is_value_token_optional: bool = None,
console_arguments: list['ConsoleArgument'] = None
):
"""
Representation of an console argument
:param token:
:param name:
:param aliases:
:param value_token:
:param is_value_token_optional:
:param console_arguments:
"""
self._token = token
self._name = name
self._aliases = aliases
self._value_token = value_token
self._is_value_token_optional = is_value_token_optional
self._console_arguments = console_arguments
@property
def token(self) -> str:
return self._token
@property
def name(self) -> str:
return self._name
@property
def aliases(self) -> list[str]:
return self._aliases
@property
def value_token(self) -> str:
return self._value_token
@property
def is_value_token_optional(self) -> bool:
return self._is_value_token_optional
@property
def console_arguments(self) -> list['ConsoleArgument']:
return self._console_arguments

View File

@@ -1,30 +0,0 @@
# -*- 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.console'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
__version__ = '2021.4.1.post15'
from collections import namedtuple
# imports:
from .background_color_enum import BackgroundColorEnum
from .console import Console
from .console_call import ConsoleCall
from .foreground_color_enum import ForegroundColorEnum
from .spinner_thread import SpinnerThread
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2021', minor='04', micro='01-15')

View File

@@ -1,14 +0,0 @@
from enum import Enum
class BackgroundColorEnum(Enum):
default = 'on_default'
grey = 'on_grey'
red = 'on_red'
green = 'on_green'
yellow = 'on_yellow'
blue = 'on_blue'
magenta = 'on_magenta'
cyan = 'on_cyan'
white = 'on_white'

View File

@@ -1,528 +0,0 @@
import os
import sys
import time
from collections import Callable
from typing import Union, Optional
import colorama
import pyfiglet
from pynput import keyboard
from pynput.keyboard import Key
from tabulate import tabulate
from termcolor import colored
from cpl.console.background_color_enum import BackgroundColorEnum
from cpl.console.console_call import ConsoleCall
from cpl.console.foreground_color_enum import ForegroundColorEnum
from cpl.console.spinner_thread import SpinnerThread
class Console:
"""
Useful functions for handling with input and output
"""
colorama.init()
_is_first_write = True
_background_color: BackgroundColorEnum = BackgroundColorEnum.default
_foreground_color: ForegroundColorEnum = ForegroundColorEnum.default
_x: Optional[int] = None
_y: Optional[int] = None
_disabled: bool = False
_hold_back = False
_hold_back_calls: list[ConsoleCall] = []
_select_menu_items: list[str] = []
_is_first_select_menu_output = True
_selected_menu_item_index: int = 0
_selected_menu_item_char: str = ''
_selected_menu_option_foreground_color: ForegroundColorEnum = ForegroundColorEnum.default
_selected_menu_option_background_color: BackgroundColorEnum = BackgroundColorEnum.default
_selected_menu_cursor_foreground_color: ForegroundColorEnum = ForegroundColorEnum.default
_selected_menu_cursor_background_color: BackgroundColorEnum = BackgroundColorEnum.default
"""
Properties
"""
@classmethod
@property
def background_color(cls) -> str:
return str(cls._background_color.value)
@classmethod
@property
def foreground_color(cls) -> str:
return str(cls._foreground_color.value)
"""
Settings
"""
@classmethod
def set_hold_back(cls, value: bool):
cls._hold_back = value
@classmethod
def set_background_color(cls, color: Union[BackgroundColorEnum, str]):
"""
Sets the background color
:param color:
:return:
"""
if type(color) is str:
cls._background_color = BackgroundColorEnum[color]
else:
cls._background_color = color
@classmethod
def set_foreground_color(cls, color: Union[ForegroundColorEnum, str]):
"""
Sets the foreground color
:param color:
:return:
"""
if type(color) is str:
cls._foreground_color = ForegroundColorEnum[color]
else:
cls._foreground_color = color
@classmethod
def reset_cursor_position(cls):
"""
Resets cursor position
:return:
"""
cls._x = None
cls._y = None
@classmethod
def set_cursor_position(cls, x: int, y: int):
"""
Sets cursor position
:param x:
:param y:
:return:
"""
cls._x = x
cls._y = y
"""
Useful protected methods
"""
@classmethod
def _output(cls, string: str, x: int = None, y: int = None, end: str = None):
"""
Prints given output with given format
:param string:
:param x:
:param y:
:param end:
:return:
"""
if cls._is_first_write:
cls._is_first_write = False
if end is None:
end = '\n'
args = []
colored_args = []
if x is not None and y is not None:
args.append(f'\033[{y};{x}H')
elif cls._x is not None and cls._y is not None:
args.append(f'\033[{cls._y};{cls._x}H')
colored_args.append(string)
if cls._foreground_color != ForegroundColorEnum.default and cls._background_color == BackgroundColorEnum.default:
colored_args.append(cls._foreground_color.value)
elif cls._foreground_color == ForegroundColorEnum.default and cls._background_color != BackgroundColorEnum.default:
colored_args.append(cls._background_color.value)
elif cls._foreground_color != ForegroundColorEnum.default and cls._background_color != BackgroundColorEnum.default:
colored_args.append(cls._foreground_color.value)
colored_args.append(cls._background_color.value)
args.append(colored(*colored_args))
print(*args, end=end)
@classmethod
def _show_select_menu(cls):
"""
Shows the select menu
:return:
"""
if not cls._is_first_select_menu_output:
for _ in range(0, len(cls._select_menu_items) + 1):
sys.stdout.write('\x1b[1A\x1b[2K')
else:
cls._is_first_select_menu_output = False
for i in range(0, len(cls._select_menu_items)):
Console.set_foreground_color(cls._selected_menu_cursor_foreground_color)
Console.set_background_color(cls._selected_menu_cursor_background_color)
placeholder = ''
for _ in cls._selected_menu_item_char:
placeholder += ' '
Console.write_line(
f'{cls._selected_menu_item_char if cls._selected_menu_item_index == i else placeholder} ')
Console.set_foreground_color(cls._selected_menu_option_foreground_color)
Console.set_background_color(cls._selected_menu_option_background_color)
Console.write(f'{cls._select_menu_items[i]}')
Console.write_line()
@classmethod
def _select_menu_key_press(cls, key: Key):
"""
Event function when key press is detected
:param key:
:return:
"""
if key == Key.down:
if cls._selected_menu_item_index == len(cls._select_menu_items) - 1:
return
cls._selected_menu_item_index += 1
cls._show_select_menu()
elif key == Key.up:
if cls._selected_menu_item_index == 0:
return
cls._selected_menu_item_index -= 1
cls._show_select_menu()
elif key == Key.enter:
return False
"""
Useful public methods
"""
@classmethod
def banner(cls, string: str):
"""
Prints the string as a banner
:param string:
:return:
"""
if cls._disabled:
return
if cls._hold_back:
cls._hold_back_calls.append(ConsoleCall(cls.banner, string))
return
ascii_banner = pyfiglet.figlet_format(string)
cls.write_line(ascii_banner)
@classmethod
def color_reset(cls):
"""
Resets color
:return:
"""
cls._background_color = BackgroundColorEnum.default
cls._foreground_color = ForegroundColorEnum.default
@classmethod
def clear(cls):
"""
Clears the console
:return:
"""
if cls._hold_back:
cls._hold_back_calls.append(ConsoleCall(cls.clear))
return
os.system('cls' if os.name == 'nt' else 'clear')
@classmethod
def close(cls):
"""
Close the application
:return:
"""
if cls._disabled:
return
if cls._hold_back:
cls._hold_back_calls.append(ConsoleCall(cls.close))
return
Console.color_reset()
Console.write('\n\n\nPress any key to continue...')
Console.read()
exit()
@classmethod
def disable(cls):
"""
Disable console interaction
:return:
"""
cls._disabled = True
@classmethod
def error(cls, string: str, tb: str = None):
"""
Prints an error with traceback
:param string:
:param tb:
:return:
"""
if cls._disabled:
return
if cls._hold_back:
cls._hold_back_calls.append(ConsoleCall(cls.error, string, tb))
return
cls.set_foreground_color('red')
if tb is not None:
cls.write_line(f'{string} -> {tb}')
else:
cls.write_line(string)
cls.set_foreground_color('default')
@classmethod
def enable(cls):
"""
Enable console interaction
:return:
"""
cls._disabled = False
@classmethod
def read(cls, output: str = None) -> str:
"""
Read in line
:param output:
:return:
"""
if output is not None and not cls._hold_back:
cls.write_line(output)
return input()
@classmethod
def read_line(cls, output: str = None) -> str:
"""
Reads in next line
:param output:
:return:
"""
if cls._disabled and not cls._hold_back:
return ''
if output is not None:
cls.write_line(output)
cls._output('\n', end='')
return input()
@classmethod
def table(cls, header: list[str], values: list[list[str]]):
"""
Prints a table with header and values
:param header:
:param values:
:return:
"""
if cls._disabled:
return
if cls._hold_back:
cls._hold_back_calls.append(ConsoleCall(cls.table, header, values))
return
table = tabulate(values, headers=header)
Console.write_line(table)
Console.write('\n')
@classmethod
def select(cls, char: str, message: str, options: list[str],
header_foreground_color: Union[str, ForegroundColorEnum] = ForegroundColorEnum.default,
header_background_color: Union[str, BackgroundColorEnum] = BackgroundColorEnum.default,
option_foreground_color: Union[str, ForegroundColorEnum] = ForegroundColorEnum.default,
option_background_color: Union[str, BackgroundColorEnum] = BackgroundColorEnum.default,
cursor_foreground_color: Union[str, ForegroundColorEnum] = ForegroundColorEnum.default,
cursor_background_color: Union[str, BackgroundColorEnum] = BackgroundColorEnum.default
) -> str:
"""
Prints select menu
:param char:
:param message:
:param options:
:param header_foreground_color:
:param header_background_color:
:param option_foreground_color:
:param option_background_color:
:param cursor_foreground_color:
:param cursor_background_color:
:return: Selected option as str
"""
cls._selected_menu_item_char = char
cls.options = options
cls._select_menu_items = cls.options
if option_foreground_color is not None:
cls._selected_menu_option_foreground_color = option_foreground_color
if option_background_color is not None:
cls._selected_menu_option_background_color = option_background_color
if cursor_foreground_color is not None:
cls._selected_menu_cursor_foreground_color = cursor_foreground_color
if cursor_background_color is not None:
cls._selected_menu_cursor_background_color = cursor_background_color
Console.set_foreground_color(header_foreground_color)
Console.set_background_color(header_background_color)
Console.write_line(message, '\n')
cls._show_select_menu()
with keyboard.Listener(
on_press=cls._select_menu_key_press, suppress=True) as listener:
listener.join()
Console.color_reset()
return cls._select_menu_items[cls._selected_menu_item_index]
@classmethod
def spinner(cls, message: str, call: Callable, *args, text_foreground_color: Union[str, ForegroundColorEnum] = None,
spinner_foreground_color: Union[str, ForegroundColorEnum] = None,
text_background_color: Union[str, BackgroundColorEnum] = None,
spinner_background_color: Union[str, BackgroundColorEnum] = None, **kwargs) -> any:
"""
Shows spinner and calls given function
When function has ended the spinner stops
:param message:
:param call:
:param args:
:param text_foreground_color:
:param spinner_foreground_color:
:param text_background_color:
:param spinner_background_color:
:param kwargs:
:return: Return value of call
"""
if cls._hold_back:
cls._hold_back_calls.append(ConsoleCall(cls.spinner, message, call, *args))
return
if text_foreground_color is not None:
cls.set_foreground_color(text_foreground_color)
if text_background_color is not None:
cls.set_background_color(text_background_color)
if type(spinner_foreground_color) is str:
spinner_foreground_color = ForegroundColorEnum[spinner_foreground_color]
if type(spinner_background_color) is str:
spinner_background_color = BackgroundColorEnum[spinner_background_color]
cls.write_line(message)
cls.set_hold_back(True)
spinner = SpinnerThread(len(message), spinner_foreground_color, spinner_background_color)
spinner.start()
return_value = None
try:
return_value = call(*args, **kwargs)
except KeyboardInterrupt:
spinner.exit()
cls.close()
spinner.stop_spinning()
cls.set_hold_back(False)
cls.set_foreground_color(ForegroundColorEnum.default)
cls.set_background_color(BackgroundColorEnum.default)
for call in cls._hold_back_calls:
call.function(*call.args)
time.sleep(0.1)
return return_value
@classmethod
def write(cls, *args, end=''):
"""
Prints in active line
:param args:
:param end:
:return:
"""
if cls._disabled:
return
if cls._hold_back:
cls._hold_back_calls.append(ConsoleCall(cls.write, args))
return
string = ' '.join(map(str, args))
cls._output(string, end=end)
@classmethod
def write_at(cls, x: int, y: int, *args):
"""
Prints at given position
:param x:
:param y:
:param args:
:return:
"""
if cls._disabled:
return
if cls._hold_back:
cls._hold_back_calls.append(ConsoleCall(cls.write_at, x, y, args))
return
string = ' '.join(map(str, args))
cls._output(string, x, y, end='')
@classmethod
def write_line(cls, *args):
"""
Prints to new line
:param args:
:return:
"""
if cls._disabled:
return
if cls._hold_back:
cls._hold_back_calls.append(ConsoleCall(cls.write_line, args))
return
string = ' '.join(map(str, args))
if not cls._is_first_write:
cls._output('')
cls._output(string, end='')
@classmethod
def write_line_at(cls, x: int, y: int, *args):
"""
Prints new line at given position
:param x:
:param y:
:param args:
:return:
"""
if cls._disabled:
return
if cls._hold_back:
cls._hold_back_calls.append(ConsoleCall(cls.write_line_at, x, y, args))
return
string = ' '.join(map(str, args))
if not cls._is_first_write:
cls._output('', end='')
cls._output(string, x, y, end='')

View File

@@ -1,14 +0,0 @@
from enum import Enum
class ForegroundColorEnum(Enum):
default = 'default'
grey = 'grey'
red = 'red'
green = 'green'
yellow = 'yellow'
blue = 'blue'
magenta = 'magenta'
cyan = 'cyan'
white = 'white'

View File

@@ -1,28 +0,0 @@
# -*- 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.database'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
__version__ = '2021.4.1.post15'
from collections import namedtuple
# imports:
from .database_model import DatabaseModel
from .database_settings import DatabaseSettings
from .database_settings_name_enum import DatabaseSettingsNameEnum
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2021', minor='04', micro='01-15')

View File

@@ -1,27 +0,0 @@
# -*- 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.database.connection'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
__version__ = '2021.4.1.post15'
from collections import namedtuple
# imports:
from .database_connection import DatabaseConnection
from .database_connection_abc import DatabaseConnectionABC
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2021', minor='04', micro='01-15')

View File

@@ -1,62 +0,0 @@
from typing import Optional
from sqlalchemy import engine, create_engine
from sqlalchemy.orm import Session, sessionmaker
from cpl.console.console import Console
from cpl.console.foreground_color_enum import ForegroundColorEnum
from cpl.database.connection.database_connection_abc import DatabaseConnectionABC
from cpl.database.database_settings import DatabaseSettings
class DatabaseConnection(DatabaseConnectionABC):
def __init__(self, database_settings: DatabaseSettings):
"""
Represents an connection to a database
:param database_settings:
"""
DatabaseConnectionABC.__init__(self)
self._db_settings = database_settings
self._engine: Optional[engine] = None
self._session: Optional[Session] = None
self._credentials: Optional[str] = None
@property
def engine(self) -> engine:
return self._engine
@property
def session(self) -> Session:
return self._session
def connect(self, connection_string: str):
try:
self._engine = create_engine(connection_string)
if self._db_settings.auth_plugin is not None:
self._engine = create_engine(connection_string, connect_args={'auth_plugin': self._db_settings.auth_plugin})
if self._db_settings.encoding is not None:
self._engine.encoding = self._db_settings.encoding
if self._db_settings.case_sensitive is not None:
self._engine.case_sensitive = self._db_settings.case_sensitive
if self._db_settings.echo is not None:
self._engine.echo = self._db_settings.echo
self._engine.connect()
db_session = sessionmaker(bind=self._engine)
self._session = db_session()
Console.set_foreground_color(ForegroundColorEnum.green)
Console.write_line(f'[{__name__}] Connected to database')
Console.set_foreground_color(ForegroundColorEnum.default)
except Exception as e:
Console.set_foreground_color(ForegroundColorEnum.red)
Console.write_line(f'[{__name__}] Database connection failed -> {e}')
Console.set_foreground_color(ForegroundColorEnum.default)
exit()

View File

@@ -1,27 +0,0 @@
from abc import abstractmethod, ABC
from sqlalchemy import engine
from sqlalchemy.orm import Session
class DatabaseConnectionABC(ABC):
@abstractmethod
def __init__(self): pass
@property
@abstractmethod
def engine(self) -> engine: pass
@property
@abstractmethod
def session(self) -> Session: pass
@abstractmethod
def connect(self, connection_string: str):
"""
Connects to a database by connection string
:param connection_string:
:return:
"""
pass

View File

@@ -1,27 +0,0 @@
# -*- 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.database.context'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
__version__ = '2021.4.1.post15'
from collections import namedtuple
# imports:
from .database_context import DatabaseContext
from .database_context_abc import DatabaseContextABC
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2021', minor='04', micro='01-15')

View File

@@ -1,47 +0,0 @@
from sqlalchemy import engine, Table
from sqlalchemy.orm import Session
from cpl.console.console import Console
from cpl.console.foreground_color_enum import ForegroundColorEnum
from cpl.database.connection.database_connection import DatabaseConnection
from cpl.database.connection.database_connection_abc import DatabaseConnectionABC
from cpl.database.context.database_context_abc import DatabaseContextABC
from cpl.database.database_settings import DatabaseSettings
from cpl.database.database_model import DatabaseModel
class DatabaseContext(DatabaseContextABC):
def __init__(self, database_settings: DatabaseSettings):
DatabaseContextABC.__init__(self)
self._db: DatabaseConnectionABC = DatabaseConnection(database_settings)
self._tables: list[Table] = []
@property
def engine(self) -> engine:
return self._db.engine
@property
def session(self) -> Session:
return self._db.session
def connect(self, connection_string: str):
self._db.connect(connection_string)
self._create_tables()
def _create_tables(self):
try:
for subclass in DatabaseModel.__subclasses__():
self._tables.append(subclass.__table__)
DatabaseModel.metadata.drop_all(self._db.engine, self._tables)
DatabaseModel.metadata.create_all(self._db.engine, self._tables, checkfirst=True)
Console.set_foreground_color(ForegroundColorEnum.green)
Console.write_line(f'[{__name__}] Created tables')
Console.set_foreground_color(ForegroundColorEnum.default)
except Exception as e:
Console.set_foreground_color(ForegroundColorEnum.red)
Console.write_line(f'[{__name__}] Creating tables failed -> {e}')
Console.set_foreground_color(ForegroundColorEnum.default)
exit()

View File

@@ -1,32 +0,0 @@
from abc import abstractmethod, ABC
from sqlalchemy import engine
from sqlalchemy.orm import Session
class DatabaseContextABC(ABC):
@property
@abstractmethod
def engine(self) -> engine: pass
@property
@abstractmethod
def session(self) -> Session: pass
@abstractmethod
def connect(self, connection_string: str):
"""
Connects to a database with connection string
:param connection_string:
:return:
"""
pass
@abstractmethod
def _create_tables(self):
"""
Create all tables for application from database model
:return:
"""
pass

View File

@@ -1,3 +0,0 @@
from sqlalchemy.ext.declarative import declarative_base
DatabaseModel: declarative_base = declarative_base()

View File

@@ -1,90 +0,0 @@
import traceback
from typing import Optional
from cpl.configuration.configuration_model_abc import ConfigurationModelABC
from cpl.console.console import Console
from cpl.console.foreground_color_enum import ForegroundColorEnum
from cpl.database.database_settings_name_enum import DatabaseSettingsNameEnum
class DatabaseSettings(ConfigurationModelABC):
def __init__(self):
ConfigurationModelABC.__init__(self)
self._auth_plugin: Optional[str] = None
self._connection_string: Optional[str] = None
self._credentials: Optional[str] = None
self._encoding: Optional[str] = None
self._case_sensitive: Optional[bool] = None
self._echo: Optional[bool] = None
@property
def auth_plugin(self) -> str:
return self._auth_plugin
@auth_plugin.setter
def auth_plugin(self, auth_plugin: str):
self._auth_plugin = auth_plugin
@property
def connection_string(self) -> str:
return self._connection_string
@connection_string.setter
def connection_string(self, connection_string: str):
self._connection_string = connection_string
@property
def credentials(self) -> str:
return self._credentials
@credentials.setter
def credentials(self, credentials: str):
self._credentials = credentials
@property
def encoding(self) -> str:
return self._encoding
@encoding.setter
def encoding(self, encoding: str) -> None:
self._encoding = encoding
@property
def case_sensitive(self) -> bool:
return self._case_sensitive
@case_sensitive.setter
def case_sensitive(self, case_sensitive: bool) -> None:
self._case_sensitive = case_sensitive
@property
def echo(self) -> bool:
return self._echo
@echo.setter
def echo(self, echo: bool) -> None:
self._echo = echo
def from_dict(self, settings: dict):
try:
self._connection_string = settings[DatabaseSettingsNameEnum.connection_string.value]
self._credentials = settings[DatabaseSettingsNameEnum.credentials.value]
if DatabaseSettingsNameEnum.auth_plugin.value in settings:
self._auth_plugin = settings[DatabaseSettingsNameEnum.auth_plugin.value]
if DatabaseSettingsNameEnum.encoding.value in settings:
self._encoding = settings[DatabaseSettingsNameEnum.encoding.value]
if DatabaseSettingsNameEnum.case_sensitive.value in settings:
self._case_sensitive = bool(settings[DatabaseSettingsNameEnum.case_sensitive.value])
if DatabaseSettingsNameEnum.echo.value in settings:
self._echo = bool(settings[DatabaseSettingsNameEnum.echo.value])
except Exception as e:
Console.set_foreground_color(ForegroundColorEnum.red)
Console.write_line(f'[ ERROR ] [ {__name__} ]: Reading error in {self.__name__} settings')
Console.write_line(f'[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}')
Console.set_foreground_color(ForegroundColorEnum.default)

View File

@@ -1,11 +0,0 @@
from enum import Enum
class DatabaseSettingsNameEnum(Enum):
connection_string = 'ConnectionString'
credentials = 'Credentials'
encoding = 'Encoding'
case_sensitive = 'CaseSensitive'
echo = 'Echo'
auth_plugin = 'AuthPlugin'

View File

@@ -1,28 +0,0 @@
# -*- 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.dependency_injection'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
__version__ = '2021.4.1.post15'
from collections import namedtuple
# imports:
from .service_abc import ServiceABC
from .service_provider import ServiceProvider
from .service_provider_abc import ServiceProviderABC
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2021', minor='04', micro='01-15')

View File

@@ -1,122 +0,0 @@
from collections import Callable
from inspect import signature, Parameter
from typing import Type, Optional, Union
from cpl.application.application_runtime_abc import ApplicationRuntimeABC
from cpl.configuration.configuration_abc import ConfigurationABC
from cpl.configuration.configuration_model_abc import ConfigurationModelABC
from cpl.database.context.database_context_abc import DatabaseContextABC
from cpl.dependency_injection.service_abc import ServiceABC
from cpl.dependency_injection.service_provider_abc import ServiceProviderABC
from cpl.environment.environment_abc import ApplicationEnvironmentABC
class ServiceProvider(ServiceProviderABC):
def __init__(self, config: ConfigurationABC, runtime: ApplicationRuntimeABC):
"""
Service for service providing
:param runtime:
"""
ServiceProviderABC.__init__(self)
self._configuration: ConfigurationABC = config
self._runtime: ApplicationRuntimeABC = runtime
self._database_context: Optional[DatabaseContextABC] = None
self._transient_services: dict[Type[ServiceABC], Callable[ServiceABC]] = {}
self._scoped_services: dict[Type[ServiceABC], Callable[ServiceABC]] = {}
self._singleton_services: dict[Type[ServiceABC], Callable[ServiceABC], ServiceABC] = {}
def _create_instance(self, service: Union[Callable[ServiceABC], ServiceABC]) -> Callable[ServiceABC]:
"""
Creates an instance of given type
:param service:
:return:
"""
sig = signature(service.__init__)
params = []
for param in sig.parameters.items():
parameter = param[1]
if parameter.name != 'self' and parameter.annotation != Parameter.empty:
if issubclass(parameter.annotation, ApplicationRuntimeABC):
params.append(self._runtime)
elif issubclass(parameter.annotation, ApplicationEnvironmentABC):
params.append(self._configuration.environment)
elif issubclass(parameter.annotation, DatabaseContextABC):
params.append(self._database_context)
elif issubclass(parameter.annotation, ConfigurationModelABC):
params.append(self._configuration.get_configuration(parameter.annotation))
elif issubclass(parameter.annotation, ConfigurationABC):
params.append(self._configuration)
elif issubclass(parameter.annotation, ServiceProviderABC):
params.append(self)
else:
params.append(self.get_service(parameter.annotation))
return service(*params)
def add_db_context(self, db_context: Type[DatabaseContextABC]):
self._database_context = self._create_instance(db_context)
def get_db_context(self) -> Callable[DatabaseContextABC]:
return self._database_context
def add_transient(self, service_type: Type[ServiceABC], service: Callable[ServiceABC] = None):
if service is None:
self._transient_services[service_type] = service_type
else:
self._transient_services[service_type] = service
def add_scoped(self, service_type: Type[ServiceABC], service: Callable[ServiceABC] = None):
if service is None:
self._scoped_services[service_type] = service_type
else:
self._scoped_services[service_type] = service
def add_singleton(self, service_type: Type[ServiceABC], service: Callable[ServiceABC] = None):
for known_service in self._singleton_services:
if type(known_service) == service_type:
raise Exception(f'Service with type {service_type} already exists')
if service is None:
self._singleton_services[service_type] = self._create_instance(service_type)
else:
self._singleton_services[service_type] = self._create_instance(service)
def get_service(self, instance_type: Type) -> Callable[ServiceABC]:
if issubclass(instance_type, ServiceProviderABC):
return self
for service in self._transient_services:
if service == instance_type and isinstance(self._transient_services[service], type(instance_type)):
return self._create_instance(self._transient_services[service])
for service in self._scoped_services:
if service == instance_type and isinstance(self._scoped_services[service], type(instance_type)):
return self._create_instance(self._scoped_services[service])
for service in self._singleton_services:
if service == instance_type and isinstance(self._singleton_services[service], instance_type):
return self._singleton_services[service]
def remove_service(self, instance_type: Type[ServiceABC]):
for service in self._transient_services:
if service == instance_type and isinstance(self._transient_services[service], type(instance_type)):
del self._transient_services[service]
return
for service in self._scoped_services:
if service == instance_type and isinstance(self._scoped_services[service], type(instance_type)):
del self._scoped_services[service]
return
for service in self._singleton_services:
if service == instance_type and isinstance(self._singleton_services[service], instance_type):
del self._singleton_services[service]
return

View File

@@ -1,81 +0,0 @@
from abc import abstractmethod, ABC
from collections import Callable
from typing import Type
from cpl.database.context.database_context_abc import DatabaseContextABC
from cpl.dependency_injection.service_abc import ServiceABC
class ServiceProviderABC(ABC):
@abstractmethod
def __init__(self):
"""
ABC for service providing
"""
pass
@abstractmethod
def add_db_context(self, db_context: Type[DatabaseContextABC]):
"""
Adds database context
:param db_context:
:return:
"""
pass
@abstractmethod
def get_db_context(self) -> Callable[DatabaseContextABC]:
""""
Returns database context
:return Callable[DatabaseContextABC]:
"""
pass
@abstractmethod
def add_transient(self, service_type: Type, service: Callable = None):
"""
Adds a service with transient lifetime
:param service_type:
:param service:
:return:
"""
pass
@abstractmethod
def add_scoped(self, service_type: Type, service: Callable = None):
"""
Adds a service with scoped lifetime
:param service_type:
:param service:
:return:
"""
pass
@abstractmethod
def add_singleton(self, service_type: Type, service: Callable = None):
"""
Adds a service with singleton lifetime
:param service_type:
:param service:
:return:
"""
pass
@abstractmethod
def get_service(self, instance_type: Type) -> Callable[ServiceABC]:
"""
Returns instance of given type
:param instance_type:
:return:
"""
pass
@abstractmethod
def remove_service(self, instance_type: type):
"""
Removes service
:param instance_type:
:return:
"""
pass

View File

@@ -1,28 +0,0 @@
# -*- 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.environment'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
__version__ = '2021.4.1.post15'
from collections import namedtuple
# imports:
from .environment_abc import ApplicationEnvironmentABC
from .environment_name_enum import EnvironmentNameEnum
from .application_environment import ApplicationEnvironment
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2021', minor='04', micro='01-15')

View File

@@ -1,57 +0,0 @@
from socket import gethostname
from typing import Optional
from cpl.environment.environment_abc import ApplicationEnvironmentABC
from cpl.environment.environment_name_enum import EnvironmentNameEnum
class ApplicationEnvironment(ApplicationEnvironmentABC):
def __init__(self, name: EnvironmentNameEnum = EnvironmentNameEnum.production, crp: str = './'):
"""
Represents environment of the application
:param name:
:param crp:
"""
ApplicationEnvironmentABC.__init__(self)
self._environment_name: Optional[EnvironmentNameEnum] = name
self._app_name: Optional[str] = None
self._customer: Optional[str] = None
self._content_root_path: Optional[str] = crp
@property
def environment_name(self) -> str:
return str(self._environment_name.value)
@environment_name.setter
def environment_name(self, environment_name: str):
self._environment_name = EnvironmentNameEnum(environment_name)
@property
def application_name(self) -> str:
return self._app_name if self._app_name is not None else ''
@application_name.setter
def application_name(self, application_name: str):
self._app_name = application_name
@property
def customer(self) -> str:
return self._customer if self._customer is not None else ''
@customer.setter
def customer(self, customer: str):
self._customer = customer
@property
def content_root_path(self) -> str:
return self._content_root_path
@content_root_path.setter
def content_root_path(self, content_root_path: str):
self._content_root_path = content_root_path
@property
def host_name(self):
return gethostname()

View File

@@ -1,47 +0,0 @@
from abc import ABC, abstractmethod
class ApplicationEnvironmentABC(ABC):
@abstractmethod
def __init__(self):
"""
ABC of application environment
"""
pass
@property
@abstractmethod
def environment_name(self) -> str: pass
@environment_name.setter
@abstractmethod
def environment_name(self, environment_name: str): pass
@property
@abstractmethod
def application_name(self) -> str: pass
@application_name.setter
@abstractmethod
def application_name(self, application_name: str): pass
@property
@abstractmethod
def customer(self) -> str: pass
@customer.setter
@abstractmethod
def customer(self, customer: str): pass
@property
@abstractmethod
def content_root_path(self) -> str: pass
@content_root_path.setter
@abstractmethod
def content_root_path(self, content_root_path: str): pass
@property
@abstractmethod
def host_name(self) -> str: pass

View File

@@ -1,9 +0,0 @@
from enum import Enum
class EnvironmentNameEnum(Enum):
production = 'production'
staging = 'staging'
testing = 'testing'
development = 'development'

View File

@@ -1,30 +0,0 @@
# -*- 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.logging'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
__version__ = '2021.4.1.post15'
from collections import namedtuple
# imports:
from .logger_service import Logger
from .logger_abc import LoggerABC
from .logging_level_enum import LoggingLevelEnum
from .logging_settings import LoggingSettings
from .logging_settings_name_enum import LoggingSettingsNameEnum
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2021', minor='04', micro='01-15')

View File

@@ -1,84 +0,0 @@
from abc import abstractmethod
from cpl.dependency_injection.service_abc import ServiceABC
class LoggerABC(ServiceABC):
@abstractmethod
def __init__(self):
"""
ABC for logging
"""
ServiceABC.__init__(self)
@abstractmethod
def header(self, string: str):
"""
Writes a header message
:param string:
:return:
"""
pass
@abstractmethod
def trace(self, name: str, message: str):
"""
Writes a trace message
:param name:
:param message:
:return:
"""
pass
@abstractmethod
def debug(self, name: str, message: str):
"""
Writes a debug message
:param name:
:param message:
:return:
"""
pass
@abstractmethod
def info(self, name: str, message: str):
"""
Writes an information
:param name:
:param message:
:return:
"""
pass
@abstractmethod
def warn(self, name: str, message: str):
"""
Writes an warning
:param name:
:param message:
:return:
"""
pass
@abstractmethod
def error(self, name: str, message: str, ex: Exception = None):
"""
Writes an error
:param name:
:param message:
:param ex:
:return:
"""
pass
@abstractmethod
def fatal(self, name: str, message: str, ex: Exception = None):
"""
Writes an error and exits
:param name:
:param message:
:param ex:
:return:
"""
pass

View File

@@ -1,12 +0,0 @@
from enum import Enum
class LoggingLevelEnum(Enum):
OFF = 0 # Nothing
FATAL = 1 # Error that cause exit
ERROR = 2 # Non fatal error
WARN = 3 # Error that can later be fatal
INFO = 4 # Normal information's
DEBUG = 5 # Detailed app state
TRACE = 6 # Detailed app information's

View File

@@ -1,62 +0,0 @@
import traceback
from typing import Optional
from cpl.configuration.configuration_model_abc import ConfigurationModelABC
from cpl.console.console import Console
from cpl.console.foreground_color_enum import ForegroundColorEnum
from cpl.logging.logging_level_enum import LoggingLevelEnum
from cpl.logging.logging_settings_name_enum import LoggingSettingsNameEnum
class LoggingSettings(ConfigurationModelABC):
def __init__(self):
ConfigurationModelABC.__init__(self)
self._path: Optional[str] = None
self._filename: Optional[str] = None
self._console: Optional[LoggingLevelEnum] = None
self._level: Optional[LoggingLevelEnum] = None
@property
def path(self) -> str:
return self._path
@path.setter
def path(self, path: str) -> None:
self._path = path
@property
def filename(self) -> str:
return self._filename
@filename.setter
def filename(self, filename: str) -> None:
self._filename = filename
@property
def console(self) -> LoggingLevelEnum:
return self._console
@console.setter
def console(self, console: LoggingLevelEnum) -> None:
self._console = console
@property
def level(self) -> LoggingLevelEnum:
return self._level
@level.setter
def level(self, level: LoggingLevelEnum) -> None:
self._level = level
def from_dict(self, settings: dict):
try:
self._path = settings[LoggingSettingsNameEnum.path.value]
self._filename = settings[LoggingSettingsNameEnum.filename.value]
self._console = LoggingLevelEnum[settings[LoggingSettingsNameEnum.console_level.value]]
self._level = LoggingLevelEnum[settings[LoggingSettingsNameEnum.file_level.value]]
except Exception as e:
Console.set_foreground_color(ForegroundColorEnum.red)
Console.write_line(f'[ ERROR ] [ {__name__} ]: Reading error in {self.__name__} settings')
Console.write_line(f'[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}')
Console.set_foreground_color(ForegroundColorEnum.default)

View File

@@ -1,9 +0,0 @@
from enum import Enum
class LoggingSettingsNameEnum(Enum):
path = 'Path'
filename = 'Filename'
console_level = 'ConsoleLogLevel'
file_level = 'FileLogLevel'

View File

@@ -1,30 +0,0 @@
# -*- 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.mailing'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
__version__ = '2021.4.1.post15'
from collections import namedtuple
# imports:
from .email import EMail
from .email_client_service import EMailClient
from .email_client_abc import EMailClientABC
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='04', micro='01-15')

View File

@@ -1,31 +0,0 @@
from abc import abstractmethod
from cpl.dependency_injection.service_abc import ServiceABC
from cpl.mailing.email import EMail
class EMailClientABC(ServiceABC):
@abstractmethod
def __init__(self):
"""
ABC to send emails
"""
ServiceABC.__init__(self)
@abstractmethod
def connect(self):
"""
Connects to server
:return:
"""
pass
@abstractmethod
def send_mail(self, email: EMail):
"""
Sends email
:param email:
:return:
"""
pass

View File

@@ -1,84 +0,0 @@
import ssl
from smtplib import SMTP
from typing import Optional
from cpl.environment.environment_abc import ApplicationEnvironmentABC
from cpl.logging.logger_abc import LoggerABC
from cpl.mailing.email import EMail
from cpl.mailing.email_client_abc import EMailClientABC
from cpl.mailing.email_client_settings import EMailClientSettings
from cpl.utils.credential_manager import CredentialManager
class EMailClient(EMailClientABC):
def __init__(self, environment: ApplicationEnvironmentABC, logger: LoggerABC, mail_settings: EMailClientSettings):
"""
Service to send emails
:param environment:
:param logger:
:param mail_settings:
"""
EMailClientABC.__init__(self)
self._environment = environment
self._mail_settings = mail_settings
self._logger = logger
self._server: Optional[SMTP] = None
self.create()
def create(self):
"""
Creates connection
:return:
"""
self._logger.trace(__name__, f'Started {__name__}.create')
self.connect()
self._logger.trace(__name__, f'Stopped {__name__}.create')
def connect(self):
self._logger.trace(__name__, f'Started {__name__}.connect')
try:
self._logger.debug(__name__, f'Try to connect to {self._mail_settings.host}:{self._mail_settings.port}')
self._server = SMTP(self._mail_settings.host, self._mail_settings.port)
self._logger.info(__name__, f'Connected to {self._mail_settings.host}:{self._mail_settings.port}')
self._logger.debug(__name__, 'Try to start tls')
self._server.starttls(context=ssl.create_default_context())
self._logger.info(__name__, 'Started tls')
except Exception as e:
self._logger.error(__name__, 'Cannot connect to mail server', e)
self._logger.trace(__name__, f'Stopped {__name__}.connect')
def login(self):
"""
Login to server
:return:
"""
self._logger.trace(__name__, f'Started {__name__}.login')
try:
self._logger.debug(__name__, f'Try to login {self._mail_settings.user_name}@{self._mail_settings.host}:{self._mail_settings.port}')
self._server.login(self._mail_settings.user_name, CredentialManager.decrypt(self._mail_settings.credentials))
self._logger.info(__name__, f'Logged on as {self._mail_settings.user_name} to {self._mail_settings.host}:{self._mail_settings.port}')
except Exception as e:
self._logger.error(__name__, 'Cannot login to mail server', e)
self._logger.trace(__name__, f'Stopped {__name__}.login')
def send_mail(self, email: EMail):
self._logger.trace(__name__, f'Started {__name__}.send_mail')
try:
self.login()
email.body += f'\n\nDies ist eine automatische E-Mail.' \
f'\nGesendet von {self._environment.application_name}-{self._environment.environment_name}@{self._environment.host_name} für ' \
f'{self._environment.customer}.'
self._logger.debug(__name__, f'Try to send email to {email.receiver_list}')
self._server.sendmail(self._mail_settings.user_name, email.receiver_list, email.get_content(self._mail_settings.user_name))
self._logger.info(__name__, f'Sent email to {email.receiver_list}')
except Exception as e:
self._logger.error(__name__, f'Cannot send mail to {email.receiver_list}', e)
self._logger.trace(__name__, f'Stopped {__name__}.send_mail')

View File

@@ -1,59 +0,0 @@
import traceback
from cpl.configuration.configuration_model_abc import ConfigurationModelABC
from cpl.console.console import Console
from cpl.mailing.email_client_settings_name_enum import EMailClientSettingsNameEnum
class EMailClientSettings(ConfigurationModelABC):
def __init__(self):
ConfigurationModelABC.__init__(self)
self._host: str = ''
self._port: int = 0
self._user_name: str = ''
self._credentials: str = ''
@property
def host(self) -> str:
return self._host
@host.setter
def host(self, host: str) -> None:
self._host = host
@property
def port(self) -> int:
return self._port
@port.setter
def port(self, port: int) -> None:
self._port = port
@property
def user_name(self) -> str:
return self._user_name
@user_name.setter
def user_name(self, user_name: str) -> None:
self._user_name = user_name
@property
def credentials(self) -> str:
return self._credentials
@credentials.setter
def credentials(self, credentials: str) -> None:
self._credentials = credentials
def from_dict(self, settings: dict):
try:
self._host = settings[EMailClientSettingsNameEnum.host.value]
self._port = settings[EMailClientSettingsNameEnum.port.value]
self._user_name = settings[EMailClientSettingsNameEnum.user_name.value]
self._credentials = settings[EMailClientSettingsNameEnum.credentials.value]
except Exception as e:
Console.error(f'[ ERROR ] [ {__name__} ]: Reading error in {self.__name__} settings')
Console.error(f'[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}')

View File

@@ -1,9 +0,0 @@
from enum import Enum
class EMailClientSettingsNameEnum(Enum):
host = 'Host'
port = 'Port'
user_name = 'UserName'
credentials = 'Credentials'

View File

@@ -1,27 +0,0 @@
# -*- 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.time'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
__version__ = '2021.4.1.post15'
from collections import namedtuple
# imports:
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='04', micro='01-15')

View File

@@ -1,61 +0,0 @@
import traceback
from typing import Optional
from cpl.configuration.configuration_model_abc import ConfigurationModelABC
from cpl.console.console import Console
from cpl.console.foreground_color_enum import ForegroundColorEnum
from cpl.time.time_format_settings_names_enum import TimeFormatSettingsNamesEnum
class TimeFormatSettings(ConfigurationModelABC):
def __init__(self):
ConfigurationModelABC.__init__(self)
self._date_format: Optional[str] = None
self._time_format: Optional[str] = None
self._date_time_format: Optional[str] = None
self._date_time_log_format: Optional[str] = None
@property
def date_format(self) -> str:
return self._date_format
@date_format.setter
def date_format(self, date_format: str) -> None:
self._date_format = date_format
@property
def time_format(self) -> str:
return self._time_format
@time_format.setter
def time_format(self, time_format: str):
self._time_format = time_format
@property
def date_time_format(self) -> str:
return self._date_time_format
@date_time_format.setter
def date_time_format(self, date_time_format: str) -> None:
self._date_time_format = date_time_format
@property
def date_time_log_format(self):
return self._date_time_log_format
@date_time_log_format.setter
def date_time_log_format(self, date_time_now_format: str) -> None:
self._date_time_log_format = date_time_now_format
def from_dict(self, settings: dict):
try:
self._date_format = settings[TimeFormatSettingsNamesEnum.date_format.value]
self._time_format = settings[TimeFormatSettingsNamesEnum.time_format.value]
self._date_time_format = settings[TimeFormatSettingsNamesEnum.date_time_format.value]
self._date_time_log_format = settings[TimeFormatSettingsNamesEnum.date_time_log_format.value]
except Exception as e:
Console.set_foreground_color(ForegroundColorEnum.red)
Console.write_line(f'[ ERROR ] [ {__name__} ]: Reading error in {self.__name__} settings')
Console.write_line(f'[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}')
Console.set_foreground_color(ForegroundColorEnum.default)

View File

@@ -1,9 +0,0 @@
from enum import Enum
class TimeFormatSettingsNamesEnum(Enum):
date_format = 'DateFormat'
time_format = 'TimeFormat'
date_time_format = 'DateTimeFormat'
date_time_log_format = 'DateTimeLogFormat'

View File

@@ -1,28 +0,0 @@
# -*- 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.utils'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
__version__ = '2021.4.1.post15'
from collections import namedtuple
# imports:
from .credential_manager import CredentialManager
from .string import String
from .pip import Pip
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2021', minor='04', micro='01-15')

View File

@@ -1,36 +0,0 @@
import base64
class CredentialManager:
"""
Handles credentials
"""
@staticmethod
def encrypt(string: str) -> str:
"""
Encode with base64
:param string:
:return:
"""
return base64.b64encode(string.encode('utf-8')).decode('utf-8')
@staticmethod
def decrypt(string: str) -> str:
"""
Decode with base64
:param string:
:return:
"""
return base64.b64decode(string).decode('utf-8')
@staticmethod
def build_string(string: str, credentials: str):
"""
Builds string with credentials in it
:param string:
:param credentials:
:return:
"""
return string.replace('$credentials', CredentialManager.decrypt(credentials))

View File

@@ -1,113 +0,0 @@
import subprocess
import sys
from contextlib import suppress
from typing import Optional
class Pip:
"""
Executes pip commands
"""
_executable = sys.executable
"""
Getter
"""
@classmethod
def get_executable(cls) -> str:
return cls._executable
"""
Setter
"""
@classmethod
def set_executable(cls, executable: str):
"""
Sets the executable
:param executable:
:return:
"""
if executable is not None:
cls._executable = executable
@classmethod
def reset_executable(cls):
"""
Resets the executable to system standard
:return:
"""
cls._executable = sys.executable
"""
Public utils functions
"""
@classmethod
def get_package(cls, package: str) -> Optional[str]:
"""
Gets given package py local pip list
:param package:
:return:
"""
result = None
with suppress(Exception):
result = subprocess.check_output([cls._executable, "-m", "pip", "show", package], stderr=subprocess.DEVNULL)
if result is None:
return None
new_package: list[str] = str(result, 'utf-8').lower().split('\n')
new_version = ''
for atr in new_package:
if 'version' in atr:
new_version = atr.split(': ')[1]
if new_version != '':
return f'{package}=={new_version}'
return package
@classmethod
def get_outdated(cls) -> bytes:
"""
Gets table of outdated packages
:return:
"""
return subprocess.check_output([cls._executable, "-m", "pip", "list", "--outdated"])
@classmethod
def install(cls, package: str, *args, source: str = None, stdout=None, stderr=None):
"""
Installs given package
:param package:
:param args:
:param source:
:param stdout:
:param stderr:
:return:
"""
pip_args = [cls._executable, "-m", "pip", "install"]
for arg in args:
pip_args.append(arg)
if source is not None:
pip_args.append(f'--extra-index-url')
pip_args.append(source)
pip_args.append(package)
subprocess.run(pip_args, stdout=stdout, stderr=stderr)
@classmethod
def uninstall(cls, package: str, stdout=None, stderr=None):
"""
Uninstalls given package
:param package:
:param stdout:
:param stderr:
:return:
"""
subprocess.run([cls._executable, "-m", "pip", "uninstall", "--yes", package], stdout=stdout, stderr=stderr)

View File

@@ -1,37 +0,0 @@
import re
class String:
"""
Useful functions for strings
"""
@staticmethod
def convert_to_snake_case(name: str) -> str:
"""
Converts string to snake case
:param name:
:return:
"""
pattern1 = re.compile(r'(.)([A-Z][a-z]+)')
pattern2 = re.compile(r'([a-z0-9])([A-Z])')
file_name = re.sub(pattern1, r'\1_\2', name)
return re.sub(pattern2, r'\1_\2', file_name).lower()
@staticmethod
def first_to_upper(string: str) -> str:
"""
Converts first char to upper
:param string:
:return:
"""
return f'{string[0].upper()}{string[1:]}'
@staticmethod
def first_to_lower(string: str) -> str:
"""
Converts first char to lower
:param string:
:return:
"""
return f'{string[0].lower()}{string[1:]}'

View File

@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
"""
cpl-cli CPL CLI
~~~~~~~~~~~~~~~~~~~
CPL Command Line Interface
:copyright: (c) 2020 - 2024 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = "cpl_cli"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2020 - 2024 sh-edraft.de"
__version__ = "2024.10.0"
from collections import namedtuple
# imports:
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="2024", minor="10", micro="0")

View File

@@ -0,0 +1,69 @@
from cpl_cli.abc.project_type_abc import ProjectTypeABC
from cpl_cli.configuration import WorkspaceSettings
from cpl_core.utils import String
class Console(ProjectTypeABC):
def __init__(
self,
base_path: str,
project_name: str,
workspace: WorkspaceSettings,
use_application_api: bool,
use_startup: bool,
use_service_providing: bool,
use_async: bool,
project_file_data: dict,
):
from project_file import ProjectFile
from project_file_appsettings import ProjectFileAppsettings
from project_file_code_application import ProjectFileApplication
from project_file_code_main import ProjectFileMain
from project_file_code_startup import ProjectFileStartup
from project_file_readme import ProjectFileReadme
from project_file_license import ProjectFileLicense
from schematic_init import Init
ProjectTypeABC.__init__(
self,
base_path,
project_name,
workspace,
use_application_api,
use_startup,
use_service_providing,
use_async,
project_file_data,
)
project_path = f'{base_path}{String.convert_to_snake_case(project_name.split("/")[-1])}/'
self.add_template(ProjectFile(project_name.split("/")[-1], project_path, project_file_data))
if workspace is None:
self.add_template(ProjectFileLicense(""))
self.add_template(ProjectFileReadme(""))
self.add_template(Init("", "init", f"{base_path}tests/"))
self.add_template(Init("", "init", project_path))
self.add_template(ProjectFileAppsettings(project_path))
if use_application_api:
self.add_template(
ProjectFileApplication(project_path, use_application_api, use_startup, use_service_providing, use_async)
)
if use_startup:
self.add_template(
ProjectFileStartup(project_path, use_application_api, use_startup, use_service_providing, use_async)
)
self.add_template(
ProjectFileMain(
project_name.split("/")[-1],
project_path,
use_application_api,
use_startup,
use_service_providing,
use_async,
)
)

View File

@@ -0,0 +1,13 @@
import json
from cpl_cli.abc.file_template_abc import FileTemplateABC
class ProjectFile(FileTemplateABC):
def __init__(self, name: str, path: str, code: dict):
FileTemplateABC.__init__(self, "", path, "{}")
self._name = f"{name}.json"
self._code = code
def get_code(self) -> str:
return json.dumps(self._code, indent=2)

View File

@@ -0,0 +1,29 @@
import textwrap
from cpl_cli.abc.file_template_abc import FileTemplateABC
class ProjectFileAppsettings(FileTemplateABC):
def __init__(self, path: str):
FileTemplateABC.__init__(self, "", path, "{}")
self._name = "appsettings.json"
def get_code(self) -> str:
return 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"
}
}
"""
)

View File

@@ -0,0 +1,56 @@
from cpl_cli.abc.code_file_template_abc import CodeFileTemplateABC
class ProjectFileApplication(CodeFileTemplateABC):
def __init__(
self, path: str, use_application_api: bool, use_startup: bool, use_service_providing: bool, use_async: bool
):
CodeFileTemplateABC.__init__(
self, "application", path, "", use_application_api, use_startup, use_service_providing, use_async
)
def get_code(self) -> str:
import textwrap
if self._use_async:
return 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)
async def configure(self):
pass
async def main(self):
Console.write_line('Hello World')
"""
)
return 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')
"""
)

View File

@@ -0,0 +1,107 @@
from cpl_cli.abc.code_file_template_abc import CodeFileTemplateABC
from cpl_core.utils import String
class ProjectFileMain(CodeFileTemplateABC):
def __init__(
self,
name: str,
path: str,
use_application_api: bool,
use_startup: bool,
use_service_providing: bool,
use_async: bool,
):
CodeFileTemplateABC.__init__(
self, "main", path, "", use_application_api, use_startup, use_service_providing, use_async
)
import textwrap
import_pkg = f"{String.convert_to_snake_case(name)}."
self._main_with_application_host_and_startup = textwrap.dedent(
f"""\
{"import asyncio" if self._use_async else ''}
from cpl_core.application import ApplicationBuilder
from {import_pkg}application import Application
from {import_pkg}startup import Startup
{self._async()}def main():
app_builder = ApplicationBuilder(Application)
app_builder.use_startup(Startup)
{"app: Application = await app_builder.build_async()" if self._use_async else ""}
{"await app.run_async()" if self._use_async else "app_builder.build().run()"}
if __name__ == '__main__':
{"asyncio.run(main())" if self._use_async else "main()"}
"""
)
self._main_with_application_base = textwrap.dedent(
f"""\
{"import asyncio" if self._use_async else ''}
from cpl_core.application import ApplicationBuilder
from {import_pkg}application import Application
{self._async()}def main():
app_builder = ApplicationBuilder(Application)
{"app: Application = await app_builder.build_async()" if self._use_async else ""}
{"await app.run_async()" if self._use_async else "app_builder.build().run()"}
if __name__ == '__main__':
{"asyncio.run(main())" if self._use_async else "main()"}
"""
)
self._main_with_dependency_injection = textwrap.dedent(
f"""\
{"import asyncio" if self._use_async else ''}
from cpl_core.application import ApplicationBuilder
{self._async()}def configure_configuration() -> ConfigurationABC:
config = Configuration()
return config
{self._async()}def configure_services(config: ConfigurationABC) -> ServiceProviderABC:
services = ServiceCollection(config)
return services.build_service_provider()
{self._async()}def main():
config = {self._async()}configure_configuration()
provider = {self._async()}configure_services(config)
Console.write_line('Hello World')
if __name__ == '__main__':
{"asyncio.run(main())" if self._use_async else "main()"}
"""
)
def _async(self) -> str:
if self._use_async:
return "async "
return ""
def get_code(self) -> str:
if self._use_application_api and self._use_startup:
return self._main_with_application_host_and_startup
if self._use_application_api:
return self._main_with_application_base
if self._use_service_providing:
return self._main_with_dependency_injection
return self._main_with_application_base

View File

@@ -0,0 +1,34 @@
from cpl_cli.abc.code_file_template_abc import CodeFileTemplateABC
class ProjectFileStartup(CodeFileTemplateABC):
def __init__(
self, path: str, use_application_api: bool, use_startup: bool, use_service_providing: bool, use_async: bool
):
CodeFileTemplateABC.__init__(
self, "startup", path, "", use_application_api, use_startup, use_service_providing, use_async
)
def get_code(self) -> str:
import textwrap
return 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()
"""
)

View File

@@ -0,0 +1,66 @@
from cpl_cli.abc.code_file_template_abc import CodeFileTemplateABC
class ProjectFileTestApplication(CodeFileTemplateABC):
def __init__(
self, path: str, use_application_api: bool, use_startup: bool, use_service_providing: bool, use_async: bool
):
CodeFileTemplateABC.__init__(
self, "application", path, "", use_application_api, use_startup, use_service_providing, use_async
)
def get_code(self) -> str:
import textwrap
if self._use_async:
return textwrap.dedent(
"""\
import unittest
from unittest import TestSuite
from cpl_core.application import ApplicationABC
from cpl_core.configuration import ConfigurationABC
from cpl_core.dependency_injection import ServiceProviderABC
from unittests.test_case import TestCase
class Application(ApplicationABC):
def __init__(self, config: ConfigurationABC, services: ServiceProviderABC):
ApplicationABC.__init__(self, config, services)
self._suite: TestSuite = unittest.TestSuite()
async def configure(self):
self._suite.addTest(TestCase('test_equal'))
async def main(self):
runner = unittest.TextTestRunner()
runner.run(self._suite)
"""
)
return textwrap.dedent(
"""\
import unittest
from unittest import TestSuite
from cpl_core.application import ApplicationABC
from cpl_core.configuration import ConfigurationABC
from cpl_core.dependency_injection import ServiceProviderABC
from unittests.test_case import TestCase
class Application(ApplicationABC):
def __init__(self, config: ConfigurationABC, services: ServiceProviderABC):
ApplicationABC.__init__(self, config, services)
self._suite: TestSuite = unittest.TestSuite()
def configure(self):
self._suite.addTest(TestCase('test_equal'))
def main(self):
runner = unittest.TextTestRunner()
runner.run(self._suite)
"""
)

View File

@@ -0,0 +1,44 @@
from cpl_cli.abc.code_file_template_abc import CodeFileTemplateABC
class ProjectFileTestCase(CodeFileTemplateABC):
def __init__(
self, path: str, use_application_api: bool, use_startup: bool, use_service_providing: bool, use_async: bool
):
CodeFileTemplateABC.__init__(
self, "test_case", path, "", use_application_api, use_startup, use_service_providing, use_async
)
def get_code(self) -> str:
import textwrap
if self._use_async:
return textwrap.dedent(
"""\
import unittest
class TestCase(unittest.TestCase):
async def setUp(self) -> None:
pass
async def test_equal(self):
self.assertEqual(True, True)
"""
)
return textwrap.dedent(
"""\
import unittest
class TestCase(unittest.TestCase):
def setUp(self) -> None:
pass
def test_equal(self):
self.assertEqual(True, True)
"""
)

View File

@@ -0,0 +1,10 @@
from cpl_cli.abc.file_template_abc import FileTemplateABC
class ProjectFileLicense(FileTemplateABC):
def __init__(self, path: str):
FileTemplateABC.__init__(self, "", path, "")
self._name = "LICENSE"
def get_code(self) -> str:
return self._code

View File

@@ -0,0 +1,10 @@
from cpl_cli.abc.file_template_abc import FileTemplateABC
class ProjectFileReadme(FileTemplateABC):
def __init__(self, path: str):
FileTemplateABC.__init__(self, "", path, "")
self._name = "README.md"
def get_code(self) -> str:
return self._code

View File

@@ -0,0 +1,46 @@
import os
from cpl_cli.abc.project_type_abc import ProjectTypeABC
from cpl_cli.configuration import WorkspaceSettings
from cpl_core.utils import String
class Library(ProjectTypeABC):
def __init__(
self,
base_path: str,
project_name: str,
workspace: WorkspaceSettings,
use_application_api: bool,
use_startup: bool,
use_service_providing: bool,
use_async: bool,
project_file_data: dict,
):
from project_file import ProjectFile
from project_file_readme import ProjectFileReadme
from project_file_license import ProjectFileLicense
from schematic_init import Init
from schematic_class import Class
ProjectTypeABC.__init__(
self,
base_path,
project_name,
workspace,
use_application_api,
use_startup,
use_service_providing,
use_async,
project_file_data,
)
project_path = f'{base_path}{String.convert_to_snake_case(project_name.split("/")[-1])}/'
self.add_template(ProjectFile(project_name.split("/")[-1], project_path, project_file_data))
if workspace is None:
self.add_template(ProjectFileLicense(""))
self.add_template(ProjectFileReadme(""))
self.add_template(Init("", "init", project_path))
self.add_template(Class("Class1", "class", project_path))

View File

@@ -0,0 +1,64 @@
import os
from cpl_cli.abc.project_type_abc import ProjectTypeABC
from cpl_cli.configuration import WorkspaceSettings
from cpl_core.utils import String
class Unittest(ProjectTypeABC):
def __init__(
self,
base_path: str,
project_name: str,
workspace: WorkspaceSettings,
use_application_api: bool,
use_startup: bool,
use_service_providing: bool,
use_async: bool,
project_file_data: dict,
):
from project_file import ProjectFile
from project_file_code_application import ProjectFileApplication
from project_file_code_main import ProjectFileMain
from project_file_code_test_case import ProjectFileTestCase
from project_file_readme import ProjectFileReadme
from project_file_license import ProjectFileLicense
from schematic_init import Init
ProjectTypeABC.__init__(
self,
base_path,
project_name,
workspace,
use_application_api,
use_startup,
use_service_providing,
use_async,
project_file_data,
)
project_path = f'{base_path}{String.convert_to_snake_case(project_name.split("/")[-1])}/'
self.add_template(ProjectFile(project_name.split("/")[-1], project_path, project_file_data))
if workspace is None:
self.add_template(ProjectFileLicense(""))
self.add_template(ProjectFileReadme(""))
self.add_template(Init("", "init", f"{base_path}tests/"))
self.add_template(Init("", "init", project_path))
self.add_template(
ProjectFileApplication(project_path, use_application_api, use_startup, use_service_providing, use_async)
)
self.add_template(
ProjectFileMain(
project_name.split("/")[-1],
project_path,
use_application_api,
use_startup,
use_service_providing,
use_async,
)
)
self.add_template(
ProjectFileTestCase(project_path, use_application_api, use_startup, use_service_providing, use_async)
)

View File

@@ -0,0 +1,27 @@
from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
from cpl_core.utils import String
class ABC(GenerateSchematicABC):
def __init__(self, name: str, schematic: str, path: str):
GenerateSchematicABC.__init__(self, name, schematic, path)
self._class_name = name
if name != "":
self._class_name = f'{String.first_to_upper(name.replace(schematic, ""))}ABC'
def get_code(self) -> str:
code = """\
from abc import ABC, abstractmethod
class $Name(ABC):
@abstractmethod
def __init__(self): pass
"""
x = self.build_code_str(code, Name=self._class_name)
return x
@classmethod
def register(cls):
GenerateSchematicABC.register(cls, "abc", ["a", "A"])

View File

@@ -0,0 +1,34 @@
import textwrap
from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
class Application(GenerateSchematicABC):
def __init__(self, *args: str):
GenerateSchematicABC.__init__(self, *args)
def get_code(self) -> str:
code = """\
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 $Name(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')
"""
x = self.build_code_str(code, Name=self._class_name)
return x
@classmethod
def register(cls):
GenerateSchematicABC.register(cls, "application", ["app", "APP"])

View File

@@ -0,0 +1,31 @@
import textwrap
from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
from cpl_core.utils import String
class ApplicationExtension(GenerateSchematicABC):
def __init__(self, *args: str):
GenerateSchematicABC.__init__(self, *args)
def get_code(self) -> str:
code = """\
from cpl_core.application import ApplicationExtensionABC
from cpl_core.configuration import ConfigurationABC
from cpl_core.dependency_injection import ServiceProviderABC
class $Name(ApplicationExtensionABC):
def __init__(self):
ApplicationExtensionABC.__init__(self)
def run(self, config: ConfigurationABC, services: ServiceProviderABC):
pass
"""
x = self.build_code_str(code, Name=String.convert_to_camel_case(self._class_name))
return x
@classmethod
def register(cls):
GenerateSchematicABC.register(cls, "application-extension", ["appex", "APPEX"])

View File

@@ -0,0 +1,23 @@
from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
from cpl_core.utils import String
class Class(GenerateSchematicABC):
def __init__(self, name: str, schematic: str, path: str):
GenerateSchematicABC.__init__(self, name, schematic, path)
self._name = f"{String.convert_to_snake_case(name)}.py"
self._class_name = f"{String.first_to_upper(name)}"
def get_code(self) -> str:
code = """\
class $Name:
def __init__(self):
pass
"""
x = self.build_code_str(code, Name=self._class_name)
return x
@classmethod
def register(cls):
GenerateSchematicABC.register(cls, "class", ["c", "C"])

View File

@@ -0,0 +1,35 @@
import textwrap
from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
class ConfigModel(GenerateSchematicABC):
def __init__(self, *args: str):
GenerateSchematicABC.__init__(self, *args)
def get_code(self) -> str:
code = """\
import traceback
from cpl_core.configuration.configuration_model_abc import ConfigurationModelABC
from cpl_core.console import Console
class $Name(ConfigurationModelABC):
def __init__(self, atr: str = None):
ConfigurationModelABC.__init__(self)
self._atr = atr
@property
def atr(self) -> str:
return self._atr
"""
x = self.build_code_str(code, Name=self._class_name)
return x
@classmethod
def register(cls):
GenerateSchematicABC.register(cls, "settings", ["st", "ST"])

View File

@@ -0,0 +1,25 @@
from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
class Enum(GenerateSchematicABC):
def __init__(self, *args: str):
GenerateSchematicABC.__init__(self, *args)
def get_code(self) -> str:
import textwrap
code = textwrap.dedent(
"""\
from enum import Enum
class $Name(Enum):
atr = 0
"""
)
return self.build_code_str(code, Name=self._class_name)
@classmethod
def register(cls):
GenerateSchematicABC.register(cls, "enum", ["e", "E"])

View File

@@ -0,0 +1,20 @@
import textwrap
from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
class Init(GenerateSchematicABC):
def __init__(self, *args: str):
GenerateSchematicABC.__init__(self, *args)
self._name = f"__init__.py"
def get_code(self) -> str:
code = """\
# imports
"""
x = self.build_code_str(code, Name=self._class_name)
return x
@classmethod
def register(cls):
GenerateSchematicABC.register(cls, "init", [])

View File

@@ -0,0 +1,27 @@
import textwrap
from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
class Pipe(GenerateSchematicABC):
def __init__(self, *args: str):
GenerateSchematicABC.__init__(self, *args)
def get_code(self) -> str:
code = """\
from cpl_core.pipes.pipe_abc import PipeABC
class $Name(PipeABC):
def __init__(self): pass
def transform(self, value: any, *args):
return value
"""
x = self.build_code_str(code, Name=self._class_name)
return x
@classmethod
def register(cls):
GenerateSchematicABC.register(cls, "pipe", ["p", "P"])

View File

@@ -0,0 +1,46 @@
from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
from cpl_core.utils import String
class Schematic(GenerateSchematicABC):
def __init__(self, name: str, path: str, schematic: str):
GenerateSchematicABC.__init__(self, name, path, schematic)
self._name = f"schematic_{String.convert_to_snake_case(name)}.py"
self._path = ".cpl/"
self._class_name = String.convert_to_camel_case(name)
def get_code(self) -> str:
code = """\
from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
class $Name(GenerateSchematicABC):
def __init__(self, *args: str):
GenerateSchematicABC.__init__(self, *args)
def get_code(self) -> str:
import textwrap
code = textwrap.dedent(\"\"\"\\
from enum import Enum
class $Name(Enum):
atr = 0
\"\"\")
return self.build_code_str(code, Name=self._class_name)
@classmethod
def register(cls):
GenerateSchematicABC.register(
cls,
'$NameLower',
[]
)
"""
return self.build_code_str(code, Name=self._class_name, NameLower=self._class_name.lower())
@classmethod
def register(cls):
GenerateSchematicABC.register(cls, "schematic", ["scheme", "SCHEME"])

View File

@@ -0,0 +1,22 @@
import textwrap
from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
class Service(GenerateSchematicABC):
def __init__(self, *args: str):
GenerateSchematicABC.__init__(self, *args)
def get_code(self) -> str:
code = """\
class $Name:
def __init__(self):
pass
"""
x = self.build_code_str(code, Name=self._class_name)
return x
@classmethod
def register(cls):
GenerateSchematicABC.register(cls, "service", ["s", "S"])

View File

@@ -0,0 +1,34 @@
import textwrap
from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
class Startup(GenerateSchematicABC):
def __init__(self, *args: str):
GenerateSchematicABC.__init__(self, *args)
def get_code(self) -> str:
code = """\
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 $Name(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()
"""
x = self.build_code_str(code, Name=self._class_name)
return x
@classmethod
def register(cls):
GenerateSchematicABC.register(cls, "startup", ["stup", "STUP"])

View File

@@ -0,0 +1,35 @@
import textwrap
from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
from cpl_core.utils import String
class StartupExtension(GenerateSchematicABC):
def __init__(self, *args: str):
GenerateSchematicABC.__init__(self, *args)
def get_code(self) -> str:
code = """\
from cpl_core.application.startup_extension_abc import StartupExtensionABC
from cpl_core.configuration.configuration_abc import ConfigurationABC
from cpl_core.dependency_injection.service_collection_abc import ServiceCollectionABC
from cpl_core.environment.application_environment_abc import ApplicationEnvironmentABC
class $Name(StartupExtensionABC):
def __init__(self):
pass
def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironmentABC):
pass
def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC):
pass
"""
x = self.build_code_str(code, Name=String.convert_to_camel_case(self._class_name))
return x
@classmethod
def register(cls):
GenerateSchematicABC.register(cls, "startup-extension", ["stupex", "STUPEX"])

View File

@@ -0,0 +1,28 @@
import textwrap
from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
from cpl_core.utils import String
class TestCase(GenerateSchematicABC):
def __init__(self, *args: str):
GenerateSchematicABC.__init__(self, *args)
def get_code(self) -> str:
code = """\
import unittest
class $Name(unittest.TestCase):
def setUp(self):
pass
def test_equal(self):
pass
"""
return self.build_code_str(code, Name=String.convert_to_camel_case(self._class_name))
@classmethod
def register(cls):
GenerateSchematicABC.register(cls, "test-case", ["tc", "TC"])

View File

@@ -0,0 +1,28 @@
import textwrap
from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
class Thread(GenerateSchematicABC):
def __init__(self, *args: str):
GenerateSchematicABC.__init__(self, *args)
def get_code(self) -> str:
code = """\
import threading
class $Name(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
def run(self) -> None:
pass
"""
x = self.build_code_str(code, Name=self._class_name)
return x
@classmethod
def register(cls):
GenerateSchematicABC.register(cls, "thread", ["t", "T"])

View File

@@ -0,0 +1,28 @@
import textwrap
from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
class Validator(GenerateSchematicABC):
def __init__(self, *args: str):
GenerateSchematicABC.__init__(self, *args)
def get_code(self) -> str:
code = """\
from cpl_core.configuration.validator_abc import ValidatorABC
class $Name(ValidatorABC):
def __init__(self):
ValidatorABC.__init__(self)
def validate(self) -> bool:
return True
"""
x = self.build_code_str(code, Name=self._class_name)
return x
@classmethod
def register(cls):
GenerateSchematicABC.register(cls, "validator", ["v", "V"])

View File

@@ -1,32 +1,31 @@
# -*- coding: utf-8 -*-
"""
sh_cpl sh-edraft Common Python library
cpl-cli CPL CLI
~~~~~~~~~~~~~~~~~~~
sh-edraft Common Python library
CPL Command Line Interface
:copyright: (c) 2020 - 2021 sh-edraft.de
:copyright: (c) 2020 - 2024 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'sh_cpl.cpl_cli'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
__version__ = '2021.4.1.post15'
__title__ = "cpl_cli"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2020 - 2024 sh-edraft.de"
__version__ = "2024.10.0"
from collections import namedtuple
# imports:
from .cli import CLI
from .command_abc import CommandABC
from .command_handler_service import CommandHandler
from .command_model import CommandModel
from .error import Error
from .main import main
from .startup import Startup
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2021', minor='04', micro='01-15')
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="2024", minor="10", micro="0")

View File

@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
"""
cpl-cli CPL CLI
~~~~~~~~~~~~~~~~~~~
CPL Command Line Interface
:copyright: (c) 2020 - 2024 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = "cpl_cli._templates"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2020 - 2024 sh-edraft.de"
__version__ = "2024.10.0"
from collections import namedtuple
# imports:
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="2024", minor="10", micro="0")

View File

@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
"""
cpl-cli CPL CLI
~~~~~~~~~~~~~~~~~~~
CPL Command Line Interface
:copyright: (c) 2020 - 2024 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = "cpl_cli._templates.build"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2020 - 2024 sh-edraft.de"
__version__ = "2024.10.0"
from collections import namedtuple
# imports:
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="2024", minor="10", micro="0")

View File

@@ -2,10 +2,10 @@ import textwrap
class InitTemplate:
@staticmethod
def get_init_py() -> str:
string = textwrap.dedent("""\
string = textwrap.dedent(
"""\
# -*- coding: utf-8 -*-
\"\"\"
@@ -19,18 +19,20 @@ class InitTemplate:
\"\"\"
__title__ = '$Title'
__author__ = '$Author'
__license__ = '$LicenseName'
__copyright__ = 'Copyright (c) $CopyrightDate $CopyrightName'
__version__ = '$Version'
__title__ = "$Title"
__author__ = "$Author"
__license__ = "$LicenseName"
__copyright__ = "Copyright (c) $CopyrightDate $CopyrightName"
__version__ = "$Version"
from collections import namedtuple
$Imports
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='$Major', minor='$Minor', micro='$Micro')
""")
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="$Major", minor="$Minor", micro="$Micro")
"""
)
return string

View File

@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
"""
cpl-cli CPL CLI
~~~~~~~~~~~~~~~~~~~
CPL Command Line Interface
:copyright: (c) 2020 - 2024 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = "cpl_cli._templates.publish"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2020 - 2024 sh-edraft.de"
__version__ = "2024.10.0"
from collections import namedtuple
# imports:
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="2024", minor="10", micro="0")

View File

@@ -2,10 +2,10 @@ import textwrap
class SetupTemplate:
@staticmethod
def get_setup_py() -> str:
string = textwrap.dedent("""\
string = textwrap.dedent(
"""\
\"\"\"
This file is generated by CPL CLI
\"\"\"
@@ -27,6 +27,7 @@ class SetupTemplate:
entry_points=$EntryPoints,
package_data=$PackageData
)
""")
"""
)
return string

View File

@@ -2,18 +2,21 @@ from abc import ABC, abstractmethod
class TemplateFileABC(ABC):
@abstractmethod
def __init__(self): pass
def __init__(self):
pass
@property
@abstractmethod
def name(self) -> str: pass
def name(self) -> str:
pass
@property
@abstractmethod
def path(self) -> str: pass
def path(self) -> str:
pass
@property
@abstractmethod
def value(self) -> str: pass
def value(self) -> str:
pass

View File

@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
"""
cpl-cli CPL CLI
~~~~~~~~~~~~~~~~~~~
CPL Command Line Interface
:copyright: (c) 2020 - 2024 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = "cpl_cli.abc"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2020 - 2024 sh-edraft.de"
__version__ = "2024.10.0"
from collections import namedtuple
# imports
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="2024", minor="10", micro="0")

View File

@@ -0,0 +1,23 @@
from abc import ABC, abstractmethod
from cpl_cli.abc.file_template_abc import FileTemplateABC
from cpl_core.utils import String
class CodeFileTemplateABC(FileTemplateABC):
@abstractmethod
def __init__(
self,
name: str,
path: str,
code: str,
use_application_api: bool,
use_startup: bool,
use_service_providing: bool,
use_async: bool,
):
FileTemplateABC.__init__(self, name, path, code)
self._use_application_api = use_application_api
self._use_startup = use_startup
self._use_service_providing = use_service_providing
self._use_async = use_async

View File

@@ -0,0 +1,34 @@
from abc import ABC, abstractmethod
from cpl_core.utils import String
class FileTemplateABC(ABC):
@abstractmethod
def __init__(self, name: str, path: str, code: str):
self._name = f"{String.convert_to_snake_case(name)}.py"
self._path = path
self._code = code
def __repr__(self):
return f"<{type(self).__name__} {self._path}{self._name}>"
@property
def name(self) -> str:
return self._name
@property
def path(self) -> str:
return self._path
@path.setter
def path(self, value: str):
self._path = value
@property
def value(self) -> str:
return self.get_code()
@abstractmethod
def get_code(self) -> str:
pass

View File

@@ -0,0 +1,40 @@
import textwrap
from abc import abstractmethod
from string import Template
from cpl_cli.abc.file_template_abc import FileTemplateABC
from cpl_cli.configuration.schematic_collection import SchematicCollection
from cpl_core.utils import String
class GenerateSchematicABC(FileTemplateABC):
def __init__(self, name: str, schematic: str, path: str):
FileTemplateABC.__init__(self, name, path, "")
self._name = f"{String.convert_to_snake_case(name)}_{schematic}.py"
if schematic in name.lower():
self._name = f"{String.convert_to_snake_case(name)}.py"
self._class_name = name
if name != "":
self._class_name = f"{String.first_to_upper(name)}{String.first_to_upper(schematic)}"
if schematic in name.lower():
self._class_name = f"{String.first_to_upper(name)}"
@property
def class_name(self) -> str:
return self._class_name
@abstractmethod
def get_code(self) -> str:
pass
@classmethod
def build_code_str(cls, code: str, **kwargs) -> str:
text = textwrap.dedent(code)
return Template(text).substitute(**kwargs)
@classmethod
@abstractmethod
def register(cls, *args):
SchematicCollection.register(*args)

View File

@@ -0,0 +1,36 @@
from abc import ABC, abstractmethod
from typing import Optional
from cpl_cli.abc.file_template_abc import FileTemplateABC
from cpl_cli.configuration import WorkspaceSettings
class ProjectTypeABC(ABC):
@abstractmethod
def __init__(
self,
base_path: str,
project_name: str,
workspace: Optional[WorkspaceSettings],
use_application_api: bool,
use_startup: bool,
use_service_providing: bool,
use_async: bool,
project_file_data: dict,
):
self._templates: list[FileTemplateABC] = []
self._base_path = base_path
self._project_name = project_name
self._workspace = workspace
self._use_application_api = use_application_api
self._use_startup = use_startup
self._use_service_providing = use_service_providing
self._use_async = use_async
self._project_file_data = project_file_data
@property
def templates(self) -> list[FileTemplateABC]:
return self._templates
def add_template(self, t: FileTemplateABC):
self._templates.append(t)

Some files were not shown because too many files have changed in this diff Show More