Compare commits

..

25 Commits

Author SHA1 Message Date
d3b8405f2c Added readme for devs
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 20s
Build on push / cli (push) Successful in 19s
Build on push / dependency (push) Successful in 19s
Build on push / database (push) Successful in 17s
Build on push / application (push) Successful in 17s
Build on push / translation (push) Successful in 21s
Build on push / mail (push) Successful in 21s
Build on push / auth (push) Successful in 15s
Build on push / api (push) Successful in 15s
2025-10-19 19:08:51 +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
367 changed files with 2731 additions and 179 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,18 @@
## 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`
bash install.sh
```
Install cpl-cli as a development package:
```bash
pip install -e src/core
pip install -e src/cli
```
When using Pycharm, mark all directories under `src/` as "Sources Root" and `exa` to ensure proper module resolution.

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.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

@@ -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

@@ -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,7 +1,9 @@
import asyncio
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
@@ -9,6 +11,24 @@ 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()

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>")

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: ...

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