Compare commits

..

36 Commits

Author SHA1 Message Date
17408d5cd2 Added first tests #191
Some checks failed
Test before pr merge / test-lint (pull_request) Failing after 7s
2025-12-10 23:21:52 +01:00
cc76227199 Moved hosted service base
All checks were successful
Test before pr merge / test-lint (pull_request) Successful in 10s
Build on push / prepare (push) Successful in 13s
Build on push / query (push) Successful in 24s
Build on push / core (push) Successful in 25s
Build on push / dependency (push) Successful in 18s
Build on push / cli (push) Successful in 24s
Build on push / application (push) Successful in 18s
Build on push / mail (push) Successful in 19s
Build on push / database (push) Successful in 23s
Build on push / translation (push) Successful in 26s
Build on push / auth (push) Successful in 17s
Build on push / api (push) Successful in 22s
2025-10-22 11:40:25 +02:00
dfbb0a8c1f Updated cpl structure model json handling
All checks were successful
Test before pr merge / test-lint (pull_request) Successful in 7s
Build on push / prepare (push) Successful in 12s
Build on push / query (push) Successful in 19s
Build on push / core (push) Successful in 19s
Build on push / cli (push) Successful in 19s
Build on push / dependency (push) Successful in 19s
Build on push / database (push) Successful in 16s
Build on push / application (push) Successful in 17s
Build on push / translation (push) Successful in 19s
Build on push / mail (push) Successful in 22s
Build on push / auth (push) Successful in 15s
Build on push / api (push) Successful in 15s
2025-10-19 20:17:17 +02:00
472aba5990 Removed ws with_parents
All checks were successful
Test before pr merge / test-lint (pull_request) Successful in 7s
Build on push / prepare (push) Successful in 10s
Build on push / query (push) Successful in 19s
Build on push / core (push) Successful in 22s
Build on push / cli (push) Successful in 16s
Build on push / dependency (push) Successful in 19s
Build on push / mail (push) Successful in 17s
Build on push / application (push) Successful in 21s
Build on push / translation (push) Successful in 20s
Build on push / database (push) Successful in 21s
Build on push / auth (push) Successful in 19s
Build on push / api (push) Successful in 15s
2025-10-19 20:03:43 +02:00
9c75008c9f Add cpl-mail project
All checks were successful
Test before pr merge / test-lint (pull_request) Successful in 8s
Build on push / prepare (push) Successful in 10s
Build on push / query (push) Successful in 18s
Build on push / core (push) Successful in 19s
Build on push / dependency (push) Successful in 19s
Build on push / cli (push) Successful in 24s
Build on push / mail (push) Successful in 17s
Build on push / translation (push) Successful in 16s
Build on push / database (push) Successful in 21s
Build on push / application (push) Successful in 21s
Build on push / auth (push) Successful in 15s
Build on push / api (push) Successful in 15s
2025-10-19 20:03:43 +02:00
df2c2b5b56 Workspace check project existence
All checks were successful
Test before pr merge / test-lint (pull_request) Successful in 6s
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 19s
Build on push / cli (push) Successful in 19s
Build on push / application (push) Successful in 16s
Build on push / translation (push) Successful in 17s
Build on push / database (push) Successful in 20s
Build on push / mail (push) Successful in 20s
Build on push / auth (push) Successful in 15s
Build on push / api (push) Successful in 16s
2025-10-19 19:56:59 +02:00
e3b19c9984 Fixed init command regarding structure
All checks were successful
Test before pr merge / test-lint (pull_request) Successful in 7s
Build on push / prepare (push) Successful in 10s
Build on push / core (push) Successful in 19s
Build on push / query (push) Successful in 19s
Build on push / cli (push) Successful in 16s
Build on push / dependency (push) Successful in 19s
Build on push / application (push) Successful in 20s
Build on push / database (push) Successful in 21s
Build on push / translation (push) Successful in 20s
Build on push / mail (push) Successful in 23s
Build on push / auth (push) Successful in 15s
Build on push / api (push) Successful in 14s
2025-10-19 19:48:41 +02:00
91269f351b Fixed init command regarding package handling
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 / core (push) Successful in 19s
Build on push / query (push) Successful in 23s
Build on push / cli (push) Successful in 16s
Build on push / dependency (push) Successful in 19s
Build on push / database (push) Successful in 16s
Build on push / application (push) Successful in 18s
Build on push / mail (push) Successful in 20s
Build on push / translation (push) Successful in 20s
Build on push / auth (push) Successful in 19s
Build on push / api (push) Successful in 15s
2025-10-19 19:37:13 +02:00
5d07973940 Fixed init command regarding package handling
Some checks failed
Test before pr merge / test-lint (pull_request) Failing after 7s
Build on push / prepare (push) Successful in 11s
Build on push / core (push) Successful in 19s
Build on push / query (push) Successful in 20s
Build on push / cli (push) Successful in 19s
Build on push / dependency (push) Successful in 22s
Build on push / database (push) Successful in 16s
Build on push / translation (push) Successful in 16s
Build on push / mail (push) Successful in 17s
Build on push / application (push) Successful in 17s
Build on push / auth (push) Successful in 18s
Build on push / api (push) Successful in 16s
2025-10-19 19:32:14 +02:00
0a9b7b81be Fixed init command regarding name None
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 24s
Build on push / cli (push) Successful in 19s
Build on push / dependency (push) Successful in 18s
Build on push / database (push) Successful in 17s
Build on push / mail (push) Successful in 18s
Build on push / application (push) Successful in 20s
Build on push / translation (push) Successful in 20s
Build on push / auth (push) Successful in 15s
Build on push / api (push) Successful in 15s
2025-10-19 19:27:18 +02:00
21c88bc442 Fixed install.sh after renaming
All checks were successful
Test before pr merge / test-lint (pull_request) Successful in 7s
Build on push / prepare (push) Successful in 10s
Build on push / query (push) Successful in 19s
Build on push / core (push) Successful in 20s
Build on push / dependency (push) Successful in 15s
Build on push / cli (push) Successful in 18s
Build on push / database (push) Successful in 20s
Build on push / translation (push) Successful in 20s
Build on push / application (push) Successful in 21s
Build on push / mail (push) Successful in 24s
Build on push / auth (push) Successful in 15s
Build on push / api (push) Successful in 18s
2025-10-19 19:17:14 +02:00
04e0884e1c Added readme for devs
Some checks failed
Test before pr merge / test-lint (pull_request) Successful in 6s
Build on push / prepare (push) Successful in 12s
Build on push / core (push) Successful in 19s
Build on push / query (push) Successful in 19s
Build on push / api (push) Has been cancelled
Build on push / application (push) Has been cancelled
Build on push / auth (push) Has been cancelled
Build on push / database (push) Has been cancelled
Build on push / dependency (push) Has been cancelled
Build on push / cli (push) Has been cancelled
Build on push / mail (push) Has been cancelled
Build on push / translation (push) Has been cancelled
2025-10-19 19:16:39 +02:00
2ac7fa4568 Fixed dev build
All checks were successful
Test before pr merge / test-lint (pull_request) Successful in 6s
Build on push / prepare (push) Successful in 14s
Build on push / core (push) Successful in 21s
Build on push / query (push) Successful in 22s
Build on push / cli (push) Successful in 19s
Build on push / dependency (push) Successful in 21s
Build on push / translation (push) Successful in 16s
Build on push / application (push) Successful in 22s
Build on push / mail (push) Successful in 24s
Build on push / database (push) Successful in 26s
Build on push / auth (push) Successful in 15s
Build on push / api (push) Successful in 15s
2025-10-19 14:42:40 +02:00
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
436 changed files with 3095 additions and 3516 deletions

View File

@@ -16,61 +16,68 @@ jobs:
uses: ./.gitea/workflows/package.yaml
needs: [ prepare, application, auth, core, dependency ]
with:
working_directory: src/cpl-api
working_directory: src/api
secrets: inherit
application:
uses: ./.gitea/workflows/package.yaml
needs: [ prepare, core, dependency ]
with:
working_directory: src/cpl-application
working_directory: src/application
secrets: inherit
auth:
uses: ./.gitea/workflows/package.yaml
needs: [ prepare, core, dependency, database ]
with:
working_directory: src/cpl-auth
working_directory: src/auth
secrets: inherit
cli:
uses: ./.gitea/workflows/package.yaml
needs: [ prepare, core ]
with:
working_directory: src/cli
secrets: inherit
core:
uses: ./.gitea/workflows/package.yaml
needs: [prepare]
with:
working_directory: src/cpl-core
working_directory: src/core
secrets: inherit
database:
uses: ./.gitea/workflows/package.yaml
needs: [ prepare, core, dependency ]
with:
working_directory: src/cpl-database
working_directory: src/database
secrets: inherit
dependency:
uses: ./.gitea/workflows/package.yaml
needs: [ prepare, core ]
with:
working_directory: src/cpl-dependency
working_directory: src/dependency
secrets: inherit
mail:
uses: ./.gitea/workflows/package.yaml
needs: [ prepare, core, dependency ]
with:
working_directory: src/cpl-mail
working_directory: src/mail
secrets: inherit
query:
uses: ./.gitea/workflows/package.yaml
needs: [prepare]
with:
working_directory: src/cpl-query
working_directory: src/query
secrets: inherit
translation:
uses: ./.gitea/workflows/package.yaml
needs: [ prepare, core, dependency ]
with:
working_directory: src/cpl-translation
working_directory: src/translation
secrets: inherit

View File

@@ -36,6 +36,12 @@ jobs:
echo "Set version to $(cat /workspace/sh-edraft.de/cpl/version.txt)"
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
run: |
cat > .pip.conf <<'EOF'

View File

@@ -0,0 +1,22 @@
## Prepare for development
After cloning the repository, run the following commands to set up your development environment:
```bash
python -m venv .venv
source .venv/bin/activate
# On Windows use `.venv\Scripts\activate`
# On Windows with git bash use `source .venv/Scripts/activate`
bash install.sh
```
Install cpl-cli as a development package:
```bash
pip install -e src/core
pip install -e src/cli
# test with:
cpl v
```
When using Pycharm, mark all directories under `src/` as "Sources Root" and `exa` to ensure proper module resolution.

13
cpl.workspace.json Normal file
View File

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

View File

@@ -75,9 +75,3 @@ class Application(ApplicationABC):
test_settings1 = Configuration.get(TestSettings)
Console.write_line(test_settings1.value)
# self.test_send_mail()
x = 0
while x < 500:
Console.write_line("Running...")
x += 1
await asyncio.sleep(5)

View File

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

View File

@@ -1,11 +1,13 @@
from application import Application
from cpl.application import ApplicationBuilder
from cpl.core.console import Console
from test_extension import TestExtension
from startup import Startup
from test_startup_extension import TestStartupExtension
def main():
Console.write_line("\n\n--- Application Starting ---\n")
app_builder = ApplicationBuilder(Application)
app_builder.with_startup(Startup)
app_builder.with_extension(TestStartupExtension)

View File

@@ -1,15 +1,15 @@
#!/usr/bin/env bash
set -euo pipefail
# Find and combine requirements from src/cpl-*/requirements.txt,
# Find and combine requirements from src/*/requirements.txt,
# filtering out lines whose *package name* starts with "cpl-".
# Works with pinned versions, extras, markers, editable installs, and VCS refs.
shopt -s nullglob
req_files=(src/cpl-*/requirements.txt)
req_files=(src/*/requirements.txt)
if ((${#req_files[@]} == 0)); then
echo "No requirements files found at src/cpl-*/requirements.txt" >&2
echo "No requirements files found at src/*/requirements.txt" >&2
exit 1
fi

View File

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

View File

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

View File

@@ -22,22 +22,6 @@ class ApplicationABC(ABC):
Contains instances of prepared objects
"""
@classmethod
def extend(cls, name: str | Callable, func: Callable[[Self], Self]):
r"""Extend the Application with a custom method
Parameters:
name: :class:`str`
Name of the method
func: :class:`Callable[[Self], Self]`
Function that takes the Application as a parameter and returns it
"""
if callable(name):
name = name.__name__
setattr(cls, name, func)
return cls
@abstractmethod
def __init__(
self, services: ServiceProvider, loaded_modules: set[TModule], required_modules: list[str | object] = None

View File

@@ -14,7 +14,7 @@ TApp = TypeVar("TApp", bound=ApplicationABC)
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 issubclass(app, ApplicationABC), "app must be an subclass of ApplicationABC or its subclass"

View File

@@ -1,14 +1,34 @@
import asyncio
from typing import Callable
from cpl.dependency import get_provider
from cpl.dependency.hosted.startup_task import StartupTask
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.core.service.startup_task import StartupTask
class Host:
_loop: asyncio.AbstractEventLoop | None = None
_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
def get_loop(cls) -> asyncio.AbstractEventLoop:
if cls._loop is None:
@@ -18,7 +38,7 @@ class Host:
@classmethod
def run_start_tasks(cls):
provider = get_provider()
provider = cls.get_provider()
tasks = provider.get_services(StartupTask)
loop = cls.get_loop()
@@ -30,7 +50,7 @@ class Host:
@classmethod
def run_hosted_services(cls):
provider = get_provider()
provider = cls.get_provider()
services = provider.get_hosted_services()
loop = cls.get_loop()
@@ -49,6 +69,10 @@ class Host:
cls._tasks.clear()
@classmethod
async def wait_for_all(cls):
await asyncio.gather(*cls._tasks.values())
@classmethod
def run_app(cls, func: Callable, *args, **kwargs):
cls.run_start_tasks()
@@ -62,10 +86,9 @@ class Host:
func(*args, **kwargs)
except (KeyboardInterrupt, asyncio.CancelledError):
pass
finally:
await cls._stop_all()
cls.get_loop().run_until_complete(runner())
cls.get_loop().run_until_complete(cls.wait_for_all())
@classmethod
def run(cls, func: Callable, *args, **kwargs):

View File

@@ -4,3 +4,5 @@ from cpl.auth.keycloak.keycloak_client import KeycloakClient as _KeycloakClient
from .auth_module import AuthModule
from .keycloak_settings import KeycloakSettings
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>")

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