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