Compare commits

...

26 Commits

Author SHA1 Message Date
43947055e5 Merge pull request 'cli' (#199) from cli into dev
Some checks failed
Test before pr merge / test-lint (pull_request) Successful in 7s
Build on push / prepare (push) Successful in 13s
Build on push / core (push) Failing after 9s
Build on push / query (push) Failing after 10s
Build on push / api (push) Has been skipped
Build on push / application (push) Has been skipped
Build on push / auth (push) Has been skipped
Build on push / cli (push) Has been skipped
Build on push / database (push) Has been skipped
Build on push / dependency (push) Has been skipped
Build on push / mail (push) Has been skipped
Build on push / translation (push) Has been skipped
Reviewed-on: #199
2025-10-19 14:40:45 +02:00
ba9edfa3fc Added cli dev build
All checks were successful
Test before pr merge / test-lint (pull_request) Successful in 6s
2025-10-19 14:40:24 +02:00
6d3e435da6 cpl new use venv & install deps on creation
All checks were successful
Test before pr merge / test-lint (pull_request) Successful in 6s
2025-10-19 14:39:27 +02:00
76b44ca517 Added cpl new
All checks were successful
Test before pr merge / test-lint (pull_request) Successful in 7s
2025-10-18 18:19:39 +02:00
8ebac05dd8 Cleanup
Some checks failed
Test before pr merge / test-lint (pull_request) Failing after 7s
2025-10-16 18:19:36 +02:00
98ed458d7c Added cpl generate
All checks were successful
Test before pr merge / test-lint (pull_request) Successful in 7s
2025-10-16 12:47:06 +02:00
8d0bc13cc0 Added live dev server
All checks were successful
Test before pr merge / test-lint (pull_request) Successful in 6s
2025-10-13 06:22:04 +02:00
33728cdec3 Added internal extra url
Some checks failed
Test before pr merge / test-lint (pull_request) Failing after 6s
2025-10-12 20:45:11 +02:00
f1604f1477 Removed ref for dev
Some checks failed
Test before pr merge / test-lint (pull_request) Failing after 7s
2025-10-12 20:22:40 +02:00
a02c101438 Improved spinner
Some checks failed
Test before pr merge / test-lint (pull_request) Failing after 8s
2025-10-12 20:02:45 +02:00
9647923647 Improved build 2025-10-12 18:19:58 +02:00
883fa2d691 Added build command
Some checks failed
Test before pr merge / test-lint (pull_request) Failing after 7s
2025-10-11 18:25:32 +02:00
3c26c73b41 Added run command
Some checks failed
Test before pr merge / test-lint (pull_request) Failing after 7s
2025-10-11 16:31:04 +02:00
faedf328cb Added build command
Some checks failed
Test before pr merge / test-lint (pull_request) Failing after 7s
2025-10-11 15:50:38 +02:00
849dd7a733 [WIP] Started run command 2025-10-11 14:13:28 +02:00
6e0ae1f25e Cleanup & fixes 2025-10-11 11:43:23 +02:00
45dcb400da Added remove & add commands
All checks were successful
Test before pr merge / test-lint (pull_request) Successful in 7s
2025-10-11 11:05:04 +02:00
104b736778 Moved commands by context 2025-10-11 09:39:46 +02:00
90ff8d466d Renamed project dirs
All checks were successful
Test before pr merge / test-lint (pull_request) Successful in 6s
2025-10-11 09:32:13 +02:00
f1aaaf2a5b Set version to all packages
All checks were successful
Test before pr merge / test-lint (pull_request) Successful in 9s
2025-10-09 21:24:25 +02:00
5f8519d4b3 Added version
All checks were successful
Test before pr merge / test-lint (pull_request) Successful in 7s
2025-10-09 21:08:05 +02:00
c4334f32ed Fixed install & added update 2025-10-09 19:59:02 +02:00
0a6a17acf6 Added cpl-cli 2025-10-09 17:17:39 +02:00
c02903b009 Merge pull request 'master' (#198) from master into dev
All checks were successful
Test before pr merge / test-lint (pull_request) Successful in 7s
Build on push / prepare (push) Successful in 11s
Build on push / query (push) Successful in 19s
Build on push / core (push) Successful in 19s
Build on push / dependency (push) Successful in 18s
Build on push / mail (push) Successful in 16s
Build on push / translation (push) Successful in 19s
Build on push / database (push) Successful in 20s
Build on push / application (push) Successful in 29s
Build on push / auth (push) Successful in 15s
Build on push / api (push) Successful in 18s
Reviewed-on: #198
2025-10-08 21:31:55 +02:00
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
366 changed files with 2704 additions and 170 deletions

View File

@@ -33,6 +33,13 @@ jobs:
working_directory: src/cpl-auth working_directory: src/cpl-auth
secrets: inherit secrets: inherit
cli:
uses: ./.gitea/workflows/package.yaml
needs: [ prepare, core ]
with:
working_directory: src/cpl-cli
secrets: inherit
core: core:
uses: ./.gitea/workflows/package.yaml uses: ./.gitea/workflows/package.yaml
needs: [prepare] needs: [prepare]

View File

@@ -36,6 +36,12 @@ jobs:
echo "Set version to $(cat /workspace/sh-edraft.de/cpl/version.txt)" echo "Set version to $(cat /workspace/sh-edraft.de/cpl/version.txt)"
cat pyproject.toml cat pyproject.toml
- name: Set package version
run: |
sed -i -E "s/^__version__ = \".*\"/__version__ = \"$(cat /workspace/sh-edraft.de/cpl/version.txt)\"/" cpl/*/__init__.py
echo "Set version to $(cat /workspace/sh-edraft.de/cpl/version.txt)"
cat cpl/*/__init__.py
- name: Set pip conf - name: Set pip conf
run: | run: |
cat > .pip.conf <<'EOF' cat > .pip.conf <<'EOF'

12
cpl.workspace.json Normal file
View File

@@ -0,0 +1,12 @@
{
"name": "cpl",
"projects": [
"src/cli/cpl.project.json",
"src/core/cpl.project.json",
"test/cpl.project.json"
],
"defaultProject": "cpl-cli",
"scripts": {
"format": "black src"
}
}

View File

@@ -3,8 +3,8 @@ from datetime import datetime
from cpl.core.console import Console from cpl.core.console import Console
from cpl.core.time.cron import Cron from cpl.core.time.cron import Cron
from cpl.dependency.hosted.cronjob import CronjobABC from cpl.core.service.cronjob import CronjobABC
from cpl.dependency.hosted.hosted_service import HostedService from cpl.core.service.hosted_service import HostedService
class Hosted(HostedService): class Hosted(HostedService):

View File

@@ -2,3 +2,5 @@ from .error import APIError, AlreadyExists, EndpointNotImplemented, Forbidden, N
from .logger import APILogger from .logger import APILogger
from .settings import ApiSettings from .settings import ApiSettings
from .api_module import ApiModule from .api_module import ApiModule
__version__ = "1.0.0"

View File

@@ -1,2 +1,4 @@
from .application_builder import ApplicationBuilder from .application_builder import ApplicationBuilder
from .host import Host from .host import Host
__version__ = "1.0.0"

View File

@@ -14,7 +14,7 @@ TApp = TypeVar("TApp", bound=ApplicationABC)
class ApplicationBuilder(Generic[TApp]): class ApplicationBuilder(Generic[TApp]):
def __init__(self, app: Type[ApplicationABC]): def __init__(self, app: Type[TApp]):
assert app is not None, "app must not be None" assert app is not None, "app must not be None"
assert issubclass(app, ApplicationABC), "app must be an subclass of ApplicationABC or its subclass" assert issubclass(app, ApplicationABC), "app must be an subclass of ApplicationABC or its subclass"

View File

@@ -1,7 +1,9 @@
import asyncio import asyncio
from typing import Callable from typing import Callable
from cpl.dependency import get_provider from cpl.core.property import classproperty
from cpl.dependency.context import get_provider, use_root_provider
from cpl.dependency.service_collection import ServiceCollection
from cpl.dependency.hosted.startup_task import StartupTask from cpl.dependency.hosted.startup_task import StartupTask
@@ -9,6 +11,24 @@ class Host:
_loop: asyncio.AbstractEventLoop | None = None _loop: asyncio.AbstractEventLoop | None = None
_tasks: dict = {} _tasks: dict = {}
_service_collection: ServiceCollection | None = None
@classproperty
def services(cls) -> ServiceCollection:
if cls._service_collection is None:
cls._service_collection = ServiceCollection()
return cls._service_collection
@classmethod
def get_provider(cls):
provider = get_provider()
if provider is None:
provider = cls.services.build()
use_root_provider(provider)
return provider
@classmethod @classmethod
def get_loop(cls) -> asyncio.AbstractEventLoop: def get_loop(cls) -> asyncio.AbstractEventLoop:
if cls._loop is None: if cls._loop is None:
@@ -18,7 +38,7 @@ class Host:
@classmethod @classmethod
def run_start_tasks(cls): def run_start_tasks(cls):
provider = get_provider() provider = cls.get_provider()
tasks = provider.get_services(StartupTask) tasks = provider.get_services(StartupTask)
loop = cls.get_loop() loop = cls.get_loop()
@@ -30,7 +50,7 @@ class Host:
@classmethod @classmethod
def run_hosted_services(cls): def run_hosted_services(cls):
provider = get_provider() provider = cls.get_provider()
services = provider.get_hosted_services() services = provider.get_hosted_services()
loop = cls.get_loop() loop = cls.get_loop()
@@ -49,6 +69,10 @@ class Host:
cls._tasks.clear() cls._tasks.clear()
@classmethod
async def wait_for_all(cls):
await asyncio.gather(*cls._tasks.values())
@classmethod @classmethod
def run_app(cls, func: Callable, *args, **kwargs): def run_app(cls, func: Callable, *args, **kwargs):
cls.run_start_tasks() cls.run_start_tasks()

View File

@@ -4,3 +4,5 @@ from cpl.auth.keycloak.keycloak_client import KeycloakClient as _KeycloakClient
from .auth_module import AuthModule from .auth_module import AuthModule
from .keycloak_settings import KeycloakSettings from .keycloak_settings import KeycloakSettings
from .logger import AuthLogger from .logger import AuthLogger
__version__ = "1.0.0"

29
src/cli/cpl.project.json Normal file
View File

@@ -0,0 +1,29 @@
{
"name": "cpl-cli",
"version": "0.1.0",
"type": "console",
"license": "MIT",
"author": "Sven Heidemann",
"description": "CLI for the CPL library",
"homepage": "",
"keywords": [],
"dependencies": {
"click": "~8.3.0"
},
"devDependencies": {
"black": "~25.9"
},
"references": [],
"main": "cpl/cli/main.py",
"directory": "cpl/cli",
"build": {
"include": [
"_templates/"
],
"exclude": [
"**/__pycache__",
"**/logs",
"**/tests"
]
}
}

View File

@@ -0,0 +1,9 @@
from abc import ABC
class <Name>ABC(ABC):
def __init__(self):
ABC.__init__(self)
print("<schematic> <multi_camelName> initialized")

View File

@@ -0,0 +1,16 @@
from cpl.application.abc import ApplicationABC
from cpl.core.environment import Environment
from cpl.core.log import LoggerABC
from cpl.dependency import ServiceProvider
from cpl.dependency.typing import Modules
class <Name>(ApplicationABC):
def __init__(self, services: ServiceProvider, modules: Modules):
ApplicationABC.__init__(self, services, modules)
self._logger = services.get_service(LoggerABC)
async def main(self):
self._logger.debug(f"Host: {Environment.get_host_name()}")
self._logger.debug(f"Environment: {Environment.get_environment()}")

View File

@@ -0,0 +1,10 @@
from cpl.core.configuration import ConfigurationModelABC
class <Name>Config(ConfigurationModelABC):
def __init__(
self,
src: dict = None,
):
ConfigurationModelABC.__init__(self, src)

View File

@@ -0,0 +1,9 @@
from cpl.core.console import Console
from cpl.core.service import CronjobABC
class CronJob(CronjobABC):
def __init__(self):
CronjobABC.__init__(self, Cron("*/1 * * * *"))
async def loop(self):
Console.write_line(f"[{datetime.now()}] Hello, World!")

View File

@@ -0,0 +1,9 @@
from cpl.database.abc import DbModelDaoABC
class <Name>Dao(DbModelDaoABC[<Name>]):
def __init__(self):
DbModelDaoABC.__init__(self, <Name>, "<multi_name>")
self.attribute(<Name>.name, str)

View File

@@ -0,0 +1,23 @@
from datetime import datetime
from typing import Self
from cpl.core.typing import SerialId
from cpl.database.abc import DbModelABC
class <Name>(DbModelABC[Self]):
def __init__(
self,
id: SerialId,
name: str,
deleted: bool = False,
editor_id: SerialId | None = None,
created: datetime | None = None,
updated: datetime | None = None,
):
DbModelABC.__init__(self, id, deleted, editor_id, created, updated)
self._name = name
@property
def name(self) -> str:
return self._name

View File

@@ -0,0 +1,29 @@
from datetime import datetime
from typing import Self
from cpl.core.typing import SerialId
from cpl.database.abc import DbJoinModelABC
class <Name>Join(DbJoinModelABC[Self]):
def __init__(
self,
id: SerialId,
source_id: SerialId,
reference_id: SerialId,
deleted: bool = False,
editor_id: SerialId | None = None,
created: datetime | None = None,
updated: datetime | None = None,
):
DbJoinModelABC.__init__(self, source_id, reference_id, id, deleted, editor_id, created, updated)
self._source_id = source_id
self._reference_id = reference_id
@property
def source_id(self) -> int:
return self._source_id
@property
def reference(self) -> int:
return self._reference_id

View File

@@ -0,0 +1,5 @@
from enum import Enum
class <Name>Enum(Enum):
KEY = "value"

View File

@@ -0,0 +1,13 @@
from cpl.core.console import Console
from cpl.core.service import HostedService
class <Name>(HostedService):
def __init__(self):
HostedService.__init__(self)
async def start(self):
Console.write_line("Hello, World!")
async def stop(self):
Console.write_line("Goodbye, World!")

View File

@@ -0,0 +1,7 @@
from cpl.core.log.wrapped_logger import WrappedLogger
class <Name>Logger(WrappedLogger):
def __init__(self):
WrappedLogger.__init__(self, "<name>")

View File

@@ -0,0 +1,17 @@
from cpl.dependency import ServiceCollection, ServiceProvider
from cpl.dependency.module import Module
class <Name>Module(Module):
dependencies = []
configuration = []
singleton = []
scoped = []
transient = []
hosted = []
@staticmethod
def register(collection: ServiceCollection): ...
@staticmethod
def configure(provider: ServiceProvider): ...

View File

@@ -0,0 +1,9 @@
import multiprocessing
class <Name>(multiprocessing.Process):
def __init__(self):
multiprocessing.Process.__init__(self)
def run(self): ...

View File

@@ -0,0 +1,11 @@
from cpl.core.pipes import PipeABC
from cpl.core.typing import T
class <Name>Pipe(PipeABC):
@staticmethod
def to_str(value: T, *args) -> str: ...
@staticmethod
def from_str(value: str, *args) -> T: ...

View File

@@ -0,0 +1,9 @@
import threading
class <Name>(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
def run(self): ...

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