Compare commits
39 Commits
2025.10.08
...
9c9bbf1760
| Author | SHA1 | Date | |
|---|---|---|---|
| 9c9bbf1760 | |||
| c18777656c | |||
| c8de1284fb | |||
| 17408d5cd2 | |||
| cc76227199 | |||
| dfbb0a8c1f | |||
| 472aba5990 | |||
| 9c75008c9f | |||
| df2c2b5b56 | |||
| e3b19c9984 | |||
| 91269f351b | |||
| 5d07973940 | |||
| 0a9b7b81be | |||
| 21c88bc442 | |||
| 04e0884e1c | |||
| 2ac7fa4568 | |||
| 43947055e5 | |||
| ba9edfa3fc | |||
| 6d3e435da6 | |||
| 76b44ca517 | |||
| 8ebac05dd8 | |||
| 98ed458d7c | |||
| 8d0bc13cc0 | |||
| 33728cdec3 | |||
| f1604f1477 | |||
| a02c101438 | |||
| 9647923647 | |||
| 883fa2d691 | |||
| 3c26c73b41 | |||
| faedf328cb | |||
| 849dd7a733 | |||
| 6e0ae1f25e | |||
| 45dcb400da | |||
| 104b736778 | |||
| 90ff8d466d | |||
| f1aaaf2a5b | |||
| 5f8519d4b3 | |||
| c4334f32ed | |||
| 0a6a17acf6 |
@@ -16,61 +16,68 @@ jobs:
|
|||||||
uses: ./.gitea/workflows/package.yaml
|
uses: ./.gitea/workflows/package.yaml
|
||||||
needs: [ prepare, application, auth, core, dependency ]
|
needs: [ prepare, application, auth, core, dependency ]
|
||||||
with:
|
with:
|
||||||
working_directory: src/cpl-api
|
working_directory: src/api
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
application:
|
application:
|
||||||
uses: ./.gitea/workflows/package.yaml
|
uses: ./.gitea/workflows/package.yaml
|
||||||
needs: [ prepare, core, dependency ]
|
needs: [ prepare, core, dependency ]
|
||||||
with:
|
with:
|
||||||
working_directory: src/cpl-application
|
working_directory: src/application
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
auth:
|
auth:
|
||||||
uses: ./.gitea/workflows/package.yaml
|
uses: ./.gitea/workflows/package.yaml
|
||||||
needs: [ prepare, core, dependency, database ]
|
needs: [ prepare, core, dependency, database ]
|
||||||
with:
|
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
|
secrets: inherit
|
||||||
|
|
||||||
core:
|
core:
|
||||||
uses: ./.gitea/workflows/package.yaml
|
uses: ./.gitea/workflows/package.yaml
|
||||||
needs: [prepare]
|
needs: [prepare]
|
||||||
with:
|
with:
|
||||||
working_directory: src/cpl-core
|
working_directory: src/core
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
database:
|
database:
|
||||||
uses: ./.gitea/workflows/package.yaml
|
uses: ./.gitea/workflows/package.yaml
|
||||||
needs: [ prepare, core, dependency ]
|
needs: [ prepare, core, dependency ]
|
||||||
with:
|
with:
|
||||||
working_directory: src/cpl-database
|
working_directory: src/database
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
dependency:
|
dependency:
|
||||||
uses: ./.gitea/workflows/package.yaml
|
uses: ./.gitea/workflows/package.yaml
|
||||||
needs: [ prepare, core ]
|
needs: [ prepare, core ]
|
||||||
with:
|
with:
|
||||||
working_directory: src/cpl-dependency
|
working_directory: src/dependency
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
mail:
|
mail:
|
||||||
uses: ./.gitea/workflows/package.yaml
|
uses: ./.gitea/workflows/package.yaml
|
||||||
needs: [ prepare, core, dependency ]
|
needs: [ prepare, core, dependency ]
|
||||||
with:
|
with:
|
||||||
working_directory: src/cpl-mail
|
working_directory: src/mail
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
query:
|
query:
|
||||||
uses: ./.gitea/workflows/package.yaml
|
uses: ./.gitea/workflows/package.yaml
|
||||||
needs: [prepare]
|
needs: [prepare]
|
||||||
with:
|
with:
|
||||||
working_directory: src/cpl-query
|
working_directory: src/query
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
translation:
|
translation:
|
||||||
uses: ./.gitea/workflows/package.yaml
|
uses: ./.gitea/workflows/package.yaml
|
||||||
needs: [ prepare, core, dependency ]
|
needs: [ prepare, core, dependency ]
|
||||||
with:
|
with:
|
||||||
working_directory: src/cpl-translation
|
working_directory: src/translation
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
@@ -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'
|
||||||
|
|||||||
@@ -23,4 +23,23 @@ jobs:
|
|||||||
run: python3.12 -m pip install black
|
run: python3.12 -m pip install black
|
||||||
|
|
||||||
- name: Checking black
|
- name: Checking black
|
||||||
run: python3.12 -m black src --check
|
run: python3.12 -m black src --check
|
||||||
|
|
||||||
|
test:
|
||||||
|
runs-on: [ runner ]
|
||||||
|
container: git.sh-edraft.de/sh-edraft.de/act-runner:latest
|
||||||
|
steps:
|
||||||
|
- name: Clone Repository
|
||||||
|
uses: https://github.com/actions/checkout@v3
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.CI_ACCESS_TOKEN }}
|
||||||
|
|
||||||
|
- name: Setting up Python 3.12
|
||||||
|
run: |
|
||||||
|
apt install -y python3.12-dev
|
||||||
|
bash ./install.sh
|
||||||
|
bash ./install.sh -dev
|
||||||
|
|
||||||
|
- name: Testing with pytest
|
||||||
|
run: |
|
||||||
|
python3.12 -m pytest
|
||||||
22
README.md
22
README.md
@@ -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
13
cpl.workspace.json
Normal 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"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -75,9 +75,3 @@ class Application(ApplicationABC):
|
|||||||
test_settings1 = Configuration.get(TestSettings)
|
test_settings1 = Configuration.get(TestSettings)
|
||||||
Console.write_line(test_settings1.value)
|
Console.write_line(test_settings1.value)
|
||||||
# self.test_send_mail()
|
# self.test_send_mail()
|
||||||
|
|
||||||
x = 0
|
|
||||||
while x < 500:
|
|
||||||
Console.write_line("Running...")
|
|
||||||
x += 1
|
|
||||||
await asyncio.sleep(5)
|
|
||||||
|
|||||||
@@ -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):
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
from application import Application
|
from application import Application
|
||||||
from cpl.application import ApplicationBuilder
|
from cpl.application import ApplicationBuilder
|
||||||
|
from cpl.core.console import Console
|
||||||
from test_extension import TestExtension
|
from test_extension import TestExtension
|
||||||
from startup import Startup
|
from startup import Startup
|
||||||
from test_startup_extension import TestStartupExtension
|
from test_startup_extension import TestStartupExtension
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
Console.write_line("\n\n--- Application Starting ---\n")
|
||||||
app_builder = ApplicationBuilder(Application)
|
app_builder = ApplicationBuilder(Application)
|
||||||
app_builder.with_startup(Startup)
|
app_builder.with_startup(Startup)
|
||||||
app_builder.with_extension(TestStartupExtension)
|
app_builder.with_extension(TestStartupExtension)
|
||||||
|
|||||||
43
install.sh
43
install.sh
@@ -1,61 +1,64 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
# Find and combine requirements from src/cpl-*/requirements.txt,
|
# Optionaler Dev-Installationsmodus
|
||||||
# filtering out lines whose *package name* starts with "cpl-".
|
dev_mode=false
|
||||||
# Works with pinned versions, extras, markers, editable installs, and VCS refs.
|
if [[ "${1:-}" == "-dev" ]]; then
|
||||||
|
dev_mode=true
|
||||||
|
fi
|
||||||
|
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
|
|
||||||
req_files=(src/cpl-*/requirements.txt)
|
# Wähle die passende Requirements-Datei
|
||||||
|
pattern='requirements.txt'
|
||||||
|
msg_hint='src/*/requirements.txt'
|
||||||
|
if $dev_mode; then
|
||||||
|
pattern='requirements.dev.txt'
|
||||||
|
msg_hint='src/*/requirements.dev.txt'
|
||||||
|
fi
|
||||||
|
|
||||||
|
req_files=(src/*/"$pattern")
|
||||||
if ((${#req_files[@]} == 0)); then
|
if ((${#req_files[@]} == 0)); then
|
||||||
echo "No requirements files found at src/cpl-*/requirements.txt" >&2
|
echo "Keine Requirements-Dateien gefunden unter '$msg_hint'" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
tmp_combined="$(mktemp)"
|
tmp_combined="$(mktemp)"
|
||||||
trap 'rm -f "$tmp_combined"' EXIT
|
trap 'rm -f "$tmp_combined"' EXIT
|
||||||
|
|
||||||
# Concatenate, trim comments/whitespace, filter out cpl-* packages, dedupe.
|
# Kombiniere, filtere Kommentare/Whitespace, entferne cpl-*, dedupliziere.
|
||||||
# We keep non-package options/flags/constraints as-is.
|
|
||||||
awk '
|
awk '
|
||||||
function trim(s){ sub(/^[[:space:]]+/,"",s); sub(/[[:space:]]+$/,"",s); return s }
|
function trim(s){ sub(/^[[:space:]]+/,"",s); sub(/[[:space:]]+$/,"",s); return s }
|
||||||
|
|
||||||
{
|
{
|
||||||
line=$0
|
line=$0
|
||||||
# drop full-line comments and strip inline comments
|
|
||||||
if (line ~ /^[[:space:]]*#/) next
|
if (line ~ /^[[:space:]]*#/) next
|
||||||
sub(/#[^!].*$/,"",line) # strip trailing comment (simple heuristic)
|
sub(/#[^!].*$/,"",line)
|
||||||
line=trim(line)
|
line=trim(line)
|
||||||
if (line == "") next
|
if (line == "") next
|
||||||
|
|
||||||
# Determine the package *name* even for "-e", extras, pins, markers, or VCS "@"
|
|
||||||
e = line
|
e = line
|
||||||
sub(/^-e[[:space:]]+/,"",e) # remove editable prefix
|
sub(/^-e[[:space:]]+/,"",e)
|
||||||
# Tokenize up to the first of these separators: space, [ < > = ! ~ ; @
|
|
||||||
token = e
|
token = e
|
||||||
sub(/\[.*/,"",token) # remove extras quickly
|
sub(/\[.*/,"",token)
|
||||||
n = split(token, a, /[<>=!~;@[:space:]]/)
|
n = split(token, a, /[<>=!~;@[:space:]]/)
|
||||||
name = tolower(a[1])
|
name = tolower(a[1])
|
||||||
|
|
||||||
# If the first token (name) starts with "cpl-", skip this requirement
|
|
||||||
if (name ~ /^cpl-/) next
|
if (name ~ /^cpl-/) next
|
||||||
|
|
||||||
print line
|
print line
|
||||||
}
|
}
|
||||||
' "${req_files[@]}" | sort -u > "$tmp_combined"
|
' "${req_files[@]}" | sort -u > "$tmp_combined"
|
||||||
|
|
||||||
if ! [ -s "$tmp_combined" ]; then
|
if ! [ -s "$tmp_combined" ]; then
|
||||||
echo "Nothing to install after filtering out cpl-* packages." >&2
|
echo "Nichts zu installieren nach dem Entfernen von cpl-* Paketen." >&2
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Installing dependencies (excluding cpl-*) from:"
|
echo "Installiere Abhängigkeiten (ohne cpl-*) aus:"
|
||||||
printf ' - %s\n' "${req_files[@]}"
|
printf ' - %s\n' "${req_files[@]}"
|
||||||
echo
|
echo
|
||||||
echo "Final set to install:"
|
echo "Finale Menge zur Installation:"
|
||||||
cat "$tmp_combined"
|
cat "$tmp_combined"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
# Use python -m pip for reliability; change to python3 if needed.
|
python -m pip install -r "$tmp_combined"
|
||||||
python -m pip install -r "$tmp_combined"
|
|
||||||
@@ -1,2 +1,18 @@
|
|||||||
[tool.black]
|
[tool.black]
|
||||||
line-length = 120
|
line-length = 120
|
||||||
|
|
||||||
|
[tool.pytest.ini_options]
|
||||||
|
pythonpath = [
|
||||||
|
"src/api",
|
||||||
|
"src/application",
|
||||||
|
"src/auth",
|
||||||
|
"src/cli",
|
||||||
|
"src/core",
|
||||||
|
"src/database",
|
||||||
|
"src/dependency",
|
||||||
|
"src/graphql",
|
||||||
|
"src/mail",
|
||||||
|
"src/query",
|
||||||
|
"src/translation"
|
||||||
|
]
|
||||||
|
testpaths = ["test"]
|
||||||
@@ -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"
|
||||||
@@ -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"
|
||||||
@@ -22,22 +22,6 @@ class ApplicationABC(ABC):
|
|||||||
Contains instances of prepared objects
|
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
|
@abstractmethod
|
||||||
def __init__(
|
def __init__(
|
||||||
self, services: ServiceProvider, loaded_modules: set[TModule], required_modules: list[str | object] = None
|
self, services: ServiceProvider, loaded_modules: set[TModule], required_modules: list[str | object] = None
|
||||||
@@ -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"
|
||||||
|
|
||||||
@@ -1,14 +1,34 @@
|
|||||||
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.hosted.startup_task import StartupTask
|
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:
|
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()
|
||||||
@@ -62,10 +86,9 @@ class Host:
|
|||||||
func(*args, **kwargs)
|
func(*args, **kwargs)
|
||||||
except (KeyboardInterrupt, asyncio.CancelledError):
|
except (KeyboardInterrupt, asyncio.CancelledError):
|
||||||
pass
|
pass
|
||||||
finally:
|
|
||||||
await cls._stop_all()
|
|
||||||
|
|
||||||
cls.get_loop().run_until_complete(runner())
|
cls.get_loop().run_until_complete(runner())
|
||||||
|
cls.get_loop().run_until_complete(cls.wait_for_all())
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls, func: Callable, *args, **kwargs):
|
def run(cls, func: Callable, *args, **kwargs):
|
||||||
@@ -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
29
src/cli/cpl.project.json
Normal 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"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
9
src/cli/cpl/cli/.cpl/generate/abc.py.schematic
Normal file
9
src/cli/cpl/cli/.cpl/generate/abc.py.schematic
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
from abc import ABC
|
||||||
|
|
||||||
|
|
||||||
|
class <Name>ABC(ABC):
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
ABC.__init__(self)
|
||||||
|
|
||||||
|
print("<schematic> <multi_camelName> initialized")
|
||||||
16
src/cli/cpl/cli/.cpl/generate/app.py.schematic
Normal file
16
src/cli/cpl/cli/.cpl/generate/app.py.schematic
Normal 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()}")
|
||||||
10
src/cli/cpl/cli/.cpl/generate/config.py.schematic
Normal file
10
src/cli/cpl/cli/.cpl/generate/config.py.schematic
Normal 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)
|
||||||
9
src/cli/cpl/cli/.cpl/generate/cron_job.py.schematic
Normal file
9
src/cli/cpl/cli/.cpl/generate/cron_job.py.schematic
Normal 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!")
|
||||||
@@ -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)
|
||||||
23
src/cli/cpl/cli/.cpl/generate/db_model.py.schematic
Normal file
23
src/cli/cpl/cli/.cpl/generate/db_model.py.schematic
Normal 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
|
||||||
29
src/cli/cpl/cli/.cpl/generate/db_model_join.py.schematic
Normal file
29
src/cli/cpl/cli/.cpl/generate/db_model_join.py.schematic
Normal 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
|
||||||
5
src/cli/cpl/cli/.cpl/generate/enum.py.schematic
Normal file
5
src/cli/cpl/cli/.cpl/generate/enum.py.schematic
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
from enum import Enum
|
||||||
|
|
||||||
|
|
||||||
|
class <Name>Enum(Enum):
|
||||||
|
KEY = "value"
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user