Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use qualibrate config package #28

Merged
merged 2 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,6 @@ cython_debug/
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
.idea/

calibrations/
calibrations/
1,316 changes: 659 additions & 657 deletions poetry.lock

Large diffs are not rendered by default.

15 changes: 9 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ readme = "README.md"
[tool.poetry.dependencies]
python = "^3.9,<3.12"
fastapi = "^0.115.2"
# TODO: uvicorn 0.34
uvicorn = "^0.32.0"
pydantic = "^2.7.4"
pydantic-settings = "^2.3.4"
Expand All @@ -19,13 +20,15 @@ tomli-w = "^1.0.0"
qualibrate-core = "^0.2.3"
qualibrate-runner = "^0.2.3"
qualibrate-app = "^0.2.3"
qualibrate-config = "^0.1.0"

[tool.poetry.group.dev.dependencies]
mypy = "^1.8.0"
ruff = "^0.7.0"
poethepoet = "^0.25.0"

#[tool.poetry.group.qm-dev.dependencies]
#qualibrate-config = {path = "../qualibrate-config", develop = true}
#qualibrate-app = {path = "../qualibrate-app/backend", develop = true}
#qualibrate-runner = {path = "../qualibrate-runner", develop = true}
#qualibrate-core = {path = "../qualibrate-core", develop = true}
Expand Down Expand Up @@ -61,12 +64,12 @@ target-version = "py39"

[tool.ruff.lint]
select = [
"E", # pycodestyle
"F", # Pyflakes
"UP", # pyupgrade
"B", # flake8-bugbear
"SIM", # flake8-simplify
"I", # isort
"E", # pycodestyle
"F", # Pyflakes
"UP", # pyupgrade
"B", # flake8-bugbear
"SIM", # flake8-simplify
"I", # isort
]

[tool.ruff.lint.pycodestyle]
Expand Down
3 changes: 2 additions & 1 deletion qualibrate_composite/__main__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import click
from qualibrate_config.cli.config import config_command

from qualibrate_composite.cli import config_command, start_command
from qualibrate_composite.cli import start_command


@click.group()
Expand Down
7 changes: 4 additions & 3 deletions qualibrate_composite/api/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

from fastapi import APIRouter, Body, Depends, Response, status
from fastapi.responses import JSONResponse
from qualibrate_config.models import QualibrateConfig

from qualibrate_composite.api.auth_middleware import encoded_password
from qualibrate_composite.config import QualibrateSettings, get_settings
from qualibrate_composite.config import get_settings

base_router = APIRouter()

Expand All @@ -13,7 +14,7 @@

@base_router.get("/login_required")
def login_required(
settings: Annotated[QualibrateSettings, Depends(get_settings)],
settings: Annotated[QualibrateConfig, Depends(get_settings)],
) -> bool:
return settings.password is not None

Expand All @@ -22,7 +23,7 @@ def login_required(
def login(
password: Annotated[Optional[str], Body()] = None,
*,
settings: Annotated[QualibrateSettings, Depends(get_settings)],
settings: Annotated[QualibrateConfig, Depends(get_settings)],
) -> Response:
if settings.password is None or password == settings.password:
response = Response()
Expand Down
8 changes: 6 additions & 2 deletions qualibrate_composite/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@
)
app.include_router(base_router)

if _settings.runner.spawn:

composite = _settings.composite
if composite is None:
raise RuntimeError("There is no config for qualibrate composite")
if composite.runner.spawn:
try:
from qualibrate_runner.app import app as runner_app
except ImportError as ex:
Expand All @@ -46,7 +50,7 @@
runner_app.add_middleware(RunnerAuthMiddleware)
app.mount("/execution", runner_app, name="qualibrate_runner")

if _settings.app.spawn:
if composite is not None and composite.app.spawn:
try:
from qualibrate_app.app import app as qualibrate_app_app
except ImportError as ex:
Expand Down
8 changes: 6 additions & 2 deletions qualibrate_composite/cli/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
from .config import config_command
from .start import start_command

__all__ = ["start_command", "config_command"]
# from .config import config_command

__all__ = [
"start_command",
# "config_command"
]
42 changes: 0 additions & 42 deletions qualibrate_composite/cli/_sub_configs.py

This file was deleted.

Loading