xmas-app 0.11.0__tar.gz → 0.11.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xmas-app
3
- Version: 0.11.0
3
+ Version: 0.11.1
4
4
  Summary: The XLeitstelle model-driven application schema app.
5
5
  License: EUPL-1.2-or-later
6
6
  License-File: LICENSE
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "xmas-app"
3
- version = "0.11.0"
3
+ version = "0.11.1"
4
4
  description = "The XLeitstelle model-driven application schema app."
5
5
  authors = [{ name = "Tobias Kraft", email = "tobias.kraft@gv.hamburg.de" }]
6
6
  classifiers = [
@@ -58,6 +58,7 @@ args = [
58
58
  ]
59
59
  cmd = """
60
60
  pixi workspace version {{version}}
61
+ && git pull
61
62
  && pixi lock
62
63
  && git add pyproject.toml pixi.lock
63
64
  && git commit -m "bump to $(pixi workspace version get)"
@@ -3,36 +3,48 @@ import importlib
3
3
  import inspect
4
4
  import io
5
5
  import logging
6
- import os
7
6
  import re
8
7
  from contextlib import asynccontextmanager
9
8
  from functools import partial
10
9
  from pathlib import Path
11
- from tempfile import NamedTemporaryFile
10
+ from tempfile import NamedTemporaryFile, gettempdir
12
11
  from typing import Any, Literal
13
12
  from uuid import uuid4
14
13
 
15
14
  import pydantic
16
15
  import pydantic_core
16
+ from fastapi import APIRouter, Depends, HTTPException, Request, status
17
+ from nicegui import app, run, ui
18
+ from nicegui.events import ClickEventArguments, ValueChangeEventArguments
17
19
  from nicegui.observables import ObservableSet
18
20
  from pydantic import ValidationError
19
21
  from starlette.applications import Starlette
20
- from xplan_tools.util import get_geometry_type_from_wkt
22
+ from xplan_tools.interface import repo_factory
23
+ from xplan_tools.interface.db import DBRepository
24
+ from xplan_tools.interface.gml import GMLRepository
25
+ from xplan_tools.model import model_factory
26
+ from xplan_tools.util import (
27
+ cast_geom_to_multi,
28
+ cast_geom_to_single,
29
+ get_geometry_type_from_wkt,
30
+ )
21
31
 
32
+ from xmas_app.db import get_db_feature_ids, get_nodes
22
33
  from xmas_app.deps.version_guard import enforce_plugin_version
34
+ from xmas_app.form import ModelForm
35
+ from xmas_app.models.crud import InsertPayload, UpdatePayload
23
36
  from xmas_app.schema import ErrorDetail, ErrorResponse, SplitPayload, SplitSuccess
37
+ from xmas_app.services import crud
38
+ from xmas_app.settings import get_appschema, settings
24
39
  from xmas_app.split_service import PlanSplitService, SplitValidationError
25
40
 
26
41
 
27
42
  def _resolve_log_dir() -> Path:
28
- # If launched from QGIS plugin
29
- if os.getenv("XMAS_APP_FROM_PLUGIN") == "1":
30
- plugin_dir = os.getenv("XMAS_APP_PLUGIN_DIR")
31
- if plugin_dir:
32
- return Path(plugin_dir) / "webapp_logs"
33
-
34
- # default: local repo logs (dev)
35
- return Path(__file__).parent / "logs"
43
+ if settings.app_mode == "prod":
44
+ return Path(gettempdir()) / "xmas_log"
45
+ else:
46
+ # dev: local repo logs
47
+ return Path(__file__).parent
36
48
 
37
49
 
38
50
  log_dir = _resolve_log_dir()
@@ -41,33 +53,13 @@ log_file = log_dir / "xmas_app.log"
41
53
 
42
54
  logger = logging.getLogger("xmas_app")
43
55
 
44
- if not logger.handlers:
45
- logger.setLevel(logging.DEBUG)
46
- fh = logging.FileHandler(log_file, mode="w", encoding="utf-8")
47
- formatter = logging.Formatter(
48
- "%(asctime)s - %(levelname)s - %(name)s - %(message)s"
49
- )
50
- fh.setFormatter(formatter)
51
- logger.addHandler(fh)
52
- logger.debug(f"Writing logs to {log_file}")
53
-
54
- from fastapi import APIRouter, Depends, HTTPException, Request, status
55
- from nicegui import app, run, ui
56
- from nicegui.events import ClickEventArguments, ValueChangeEventArguments
57
- from xplan_tools.interface import repo_factory
58
- from xplan_tools.interface.db import DBRepository
59
- from xplan_tools.interface.gml import GMLRepository
60
- from xplan_tools.model import model_factory
61
- from xplan_tools.util import (
62
- cast_geom_to_multi,
63
- cast_geom_to_single,
64
- )
65
-
66
- from xmas_app.db import get_db_feature_ids, get_nodes
67
- from xmas_app.form import ModelForm
68
- from xmas_app.models.crud import InsertPayload, UpdatePayload
69
- from xmas_app.services import crud
70
- from xmas_app.settings import get_appschema, settings
56
+ logger.handlers.clear()
57
+ logger.setLevel(logging.DEBUG if settings.debug else logging.INFO)
58
+ fh = logging.FileHandler(log_file, mode="w", encoding="utf-8")
59
+ formatter = logging.Formatter("%(asctime)s - %(levelname)s - %(name)s - %(message)s")
60
+ fh.setFormatter(formatter)
61
+ logger.addHandler(fh)
62
+ logger.debug(f"Writing logs to {log_file}")
71
63
 
72
64
  ui.element.default_props("dense")
73
65
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes