fix: Imports
This commit is contained in:
parent
501f45525b
commit
c9a755206e
12 changed files with 40 additions and 37 deletions
|
|
@ -32,7 +32,7 @@ dev = [
|
|||
]
|
||||
|
||||
[project.scripts]
|
||||
karl = "karl:main"
|
||||
karl = "karl.main:run"
|
||||
|
||||
[build-system]
|
||||
requires = ["uv_build>=0.8.23,<0.9.0"]
|
||||
|
|
|
|||
|
|
@ -1,2 +1,19 @@
|
|||
from config import get_settings
|
||||
|
||||
|
||||
def main() -> None:
|
||||
print("Hello from karl!")
|
||||
import uvicorn
|
||||
|
||||
settings = get_settings()
|
||||
uvicorn.run(
|
||||
"karl.main:run",
|
||||
factory=True,
|
||||
host=settings.app.host,
|
||||
port=settings.app.port,
|
||||
reload=settings.app.reload,
|
||||
log_config=None,
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@ from fastapi import APIRouter, Depends
|
|||
from fastapi_utils.cbv import cbv
|
||||
from starlette.responses import JSONResponse, Response
|
||||
|
||||
from app.api.models import Request
|
||||
from app.core.injects import AutowireSupport
|
||||
from app.core.woodpecker import Woodpecker
|
||||
from app.model.webhook import WoodpeckerEvent
|
||||
from api.models import Request
|
||||
from core.injects import AutowireSupport
|
||||
from core.woodpecker import Woodpecker
|
||||
from model.webhook import WoodpeckerEvent
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class Settings(BaseSettings):
|
|||
kp: KeePassConfig = KeePassConfig()
|
||||
|
||||
@classmethod
|
||||
def from_yaml(cls, path: Path | str = "config/config.yaml") -> "Settings":
|
||||
def from_yaml(cls, path: Path | str = "../../config/config.yaml") -> "Settings":
|
||||
p = Path(path)
|
||||
data = {}
|
||||
if p.exists():
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
from injectable import inject
|
||||
|
||||
from app.core.woodpecker import Woodpecker
|
||||
from core.woodpecker import Woodpecker
|
||||
|
||||
|
||||
class AutowireSupport:
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@ from typing import Annotated
|
|||
|
||||
from injectable import injectable, Autowired, autowired
|
||||
|
||||
from app.config import get_settings
|
||||
from app.model.webhook import WoodpeckerEvent
|
||||
from app.services import GitService, DockerService
|
||||
from app.services.mo import Mo
|
||||
from config import get_settings
|
||||
from model.webhook import WoodpeckerEvent
|
||||
from services import GitService, DockerService
|
||||
from services.mo import Mo
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ import logging
|
|||
from fastapi import FastAPI
|
||||
from injectable import load_injection_container
|
||||
|
||||
from app.config import get_settings
|
||||
from app.util.logging import HandlerFactory
|
||||
from config import get_settings
|
||||
from util.logging import HandlerFactory
|
||||
|
||||
|
||||
class KarlApplication:
|
||||
|
|
@ -45,13 +45,13 @@ class KarlApplication:
|
|||
logging_logger.propagate = False
|
||||
|
||||
def _set_middlewares(self, app: FastAPI):
|
||||
from app.web.middlewares import LoggingMiddleware
|
||||
from web.middlewares import LoggingMiddleware
|
||||
app.add_middleware(LoggingMiddleware)
|
||||
|
||||
def _set_routes(self, app: FastAPI):
|
||||
from app.core.router import router as core_router
|
||||
from core.router import router as core_router
|
||||
app.include_router(core_router)
|
||||
from app.api.v1 import router as api_v1_router
|
||||
from api.v1 import router as api_v1_router
|
||||
app.include_router(api_v1_router, prefix="/api/v1", tags=["v1"])
|
||||
pass
|
||||
|
||||
|
|
@ -61,17 +61,3 @@ class KarlApplication:
|
|||
|
||||
def run():
|
||||
return KarlApplication()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import uvicorn
|
||||
|
||||
settings = get_settings()
|
||||
uvicorn.run(
|
||||
"app.main:run",
|
||||
factory=True,
|
||||
host=settings.app.host,
|
||||
port=settings.app.port,
|
||||
reload=settings.app.reload,
|
||||
log_config=None,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import docker
|
|||
from docker.models.containers import Container
|
||||
from injectable import injectable
|
||||
|
||||
from app.model.containers import Tree, Compose, SimpleContainer
|
||||
from model.containers import Tree, Compose, SimpleContainer
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ from typing import Annotated
|
|||
|
||||
from injectable import injectable, autowired, Autowired
|
||||
|
||||
from app.services import Passwords
|
||||
from services import Passwords
|
||||
|
||||
|
||||
class ValueTemplate(Template):
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class KeyRequest:
|
|||
@injectable(singleton=True)
|
||||
class Passwords:
|
||||
def __init__(self):
|
||||
from app.config import get_settings
|
||||
from config import get_settings
|
||||
settings = get_settings()
|
||||
|
||||
with open(settings.kp.secret, "r") as fh:
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
from git import Repo, Remote
|
||||
from injectable import injectable
|
||||
|
||||
from app.config import GitConfig, get_settings
|
||||
from config import GitConfig, get_settings
|
||||
|
||||
|
||||
@injectable(singleton=True)
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ from pathlib import Path
|
|||
import pytest
|
||||
import yaml
|
||||
|
||||
from app.services import Passwords
|
||||
from app.services.mo import Mo
|
||||
from karl.services import Passwords
|
||||
from karl.services.mo import Mo
|
||||
|
||||
|
||||
@pytest.fixture(scope='class')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue