Skip to content

Commit ad94ab3

Browse files
authored
Merge pull request #111 from offspot/upgrade_deps
2 parents d7c534c + 3991de0 commit ad94ab3

File tree

9 files changed

+142
-128
lines changed

9 files changed

+142
-128
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ repos:
2323
- --config
2424
- frontend/.eslintrc.cjs
2525
- repo: https://github.com/psf/black
26-
rev: "23.12.1"
26+
rev: "24.1.1"
2727
hooks:
2828
- id: black
2929
- repo: https://github.com/astral-sh/ruff-pre-commit
30-
rev: v0.1.11
30+
rev: v0.2.0
3131
hooks:
3232
- id: ruff
3333
- repo: https://github.com/RobertCraigie/pyright-python
34-
rev: v1.1.345
34+
rev: v1.1.349
3535
hooks:
3636
- id: pyright
3737
name: pyright (system)

backend/dev_tools/synthetic_data.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ class AggKindAndValue:
109109

110110

111111
periods_in_db: list[int] = [] # store list of periods already injected in DB
112-
dimensions_in_db: list[
113-
IndicatorData
114-
] = [] # store list of dimensions already injected in DB
112+
dimensions_in_db: list[IndicatorData] = (
113+
[]
114+
) # store list of dimensions already injected in DB
115115

116116

117117
def clear_db():
@@ -151,13 +151,15 @@ def scale_and_randomize_value(
151151
factor = (
152152
1
153153
if agg_kind == AggKind.YEAR or agg_kind is None
154-
else 12
155-
if agg_kind == AggKind.MONTH
156-
else 52
157-
if agg_kind == AggKind.WEEK
158-
else 365
159-
if agg_kind == AggKind.DAY
160-
else 0
154+
else (
155+
12
156+
if agg_kind == AggKind.MONTH
157+
else (
158+
52
159+
if agg_kind == AggKind.WEEK
160+
else 365 if agg_kind == AggKind.DAY else 0
161+
)
162+
)
161163
)
162164

163165
return max(

backend/pyproject.toml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ classifiers = [
1919
]
2020
dependencies = [
2121
"alembic == 1.13.1",
22-
"fastapi[all] == 0.108.0",
22+
"fastapi[all] == 0.109.2",
2323
"fastapi-pagination == 0.12.14",
24-
"pydantic == 2.5.3", # this is also a sub-dep of fastapi but we rely a lot on it
24+
"pydantic == 2.6.0", # this is also a sub-dep of fastapi but we rely a lot on it
2525
"pyhumps==3.8.0",
2626
"python-dateutil == 2.8.2",
2727
"PyYAML == 6.0.1",
@@ -35,22 +35,22 @@ scripts = [
3535
"invoke == 2.2.0",
3636
]
3737
lint = [
38-
"black == 23.12.1",
39-
"ruff == 0.1.11",
38+
"black == 24.1.1",
39+
"ruff == 0.2.0",
4040
]
4141
check = [
42-
"pyright == 1.1.345",
42+
"pyright == 1.1.349",
4343
]
4444
test = [
45-
"coverage == 7.4.0",
45+
"coverage == 7.4.1",
4646
"httpx == 0.26.0",
47-
"pytest == 7.4.4",
48-
"pytest-asyncio == 0.23.3",
47+
"pytest == 7.4.4", # 8.0.0 not yet available due to pytest-asyncio constraint <8
48+
"pytest-asyncio == 0.23.4",
4949
]
5050
dev = [
5151
"pre-commit == 3.6.0",
5252
"debugpy == 1.8.0",
53-
"ipykernel == 6.28.0",
53+
"ipykernel == 6.29.0",
5454
"offspot_metrics_backend[scripts]",
5555
"offspot_metrics_backend[lint]",
5656
"offspot_metrics_backend[test]",
@@ -113,6 +113,8 @@ target-version = ['py312']
113113
target-version = "py312"
114114
line-length = 88
115115
src = ["src"]
116+
117+
[tool.ruff.lint]
116118
select = [
117119
"A", # flake8-builtins
118120
# "ANN", # flake8-annotations
@@ -191,17 +193,17 @@ unfixable = [
191193
"F401",
192194
]
193195

194-
[tool.ruff.isort]
196+
[tool.ruff.lint.isort]
195197
known-first-party = ["offspot_metrics_backend"]
196198

197-
[tool.ruff.flake8-bugbear]
199+
[tool.ruff.lint.flake8-bugbear]
198200
# add exceptions to B008 for fastapi.
199201
extend-immutable-calls = ["fastapi.Depends", "fastapi.Query"]
200202

201-
[tool.ruff.flake8-tidy-imports]
203+
[tool.ruff.lint.flake8-tidy-imports]
202204
ban-relative-imports = "all"
203205

204-
[tool.ruff.per-file-ignores]
206+
[tool.ruff.lint.per-file-ignores]
205207
# Tests can use magic values, assertions, and relative imports
206208
"tests/**/*" = ["PLR2004", "S101", "TID252"]
207209
# Synthetic data generator is using pseudo-random generator on purpose

backend/src/offspot_metrics_backend/business/caddy_log_converter.py

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -97,21 +97,28 @@ def process(self, line: str) -> ProcessingResult:
9797

9898
ts = datetime.datetime.fromtimestamp(log.ts)
9999
log_data = LogData(
100-
content_type=log.resp_headers.content_type[0]
101-
if log.resp_headers.content_type and len(log.resp_headers.content_type) > 0
102-
else None,
100+
content_type=(
101+
log.resp_headers.content_type[0]
102+
if log.resp_headers.content_type
103+
and len(log.resp_headers.content_type) > 0
104+
else None
105+
),
103106
status=log.status,
104107
uri=log.request.uri,
105108
method=log.request.method,
106109
ts=ts,
107-
x_tfm_files_added=int(log.resp_headers.x_tfm_files_added[0])
108-
if log.resp_headers.x_tfm_files_added
109-
and len(log.resp_headers.x_tfm_files_added) > 0
110-
else None,
111-
x_tfm_files_deleted=int(log.resp_headers.x_tfm_files_deleted[0])
112-
if log.resp_headers.x_tfm_files_deleted
113-
and len(log.resp_headers.x_tfm_files_deleted) > 0
114-
else None,
110+
x_tfm_files_added=(
111+
int(log.resp_headers.x_tfm_files_added[0])
112+
if log.resp_headers.x_tfm_files_added
113+
and len(log.resp_headers.x_tfm_files_added) > 0
114+
else None
115+
),
116+
x_tfm_files_deleted=(
117+
int(log.resp_headers.x_tfm_files_deleted[0])
118+
if log.resp_headers.x_tfm_files_deleted
119+
and len(log.resp_headers.x_tfm_files_deleted) > 0
120+
else None
121+
),
115122
)
116123
inputs: list[Input] = []
117124
for generator in self.generators:

backend/src/offspot_metrics_backend/db/models.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ class IndicatorDimension(Base):
144144
It might have up to 3 values for now, meaning a 3 dimensional indicator"""
145145

146146
__tablename__ = "indicator_dimension"
147-
id: Mapped[int] = mapped_column(init=False, primary_key=True) # noqa: A003
147+
id: Mapped[int] = mapped_column(init=False, primary_key=True)
148148
# only 3 dimension values are supported for now, this is supposed to be way enough
149149
value0: Mapped[str | None] = mapped_column(index=True)
150150
value1: Mapped[str | None]
@@ -161,7 +161,7 @@ class IndicatorRecord(Base):
161161
"""
162162

163163
__tablename__ = "indicator_record"
164-
id: Mapped[int] = mapped_column(init=False, primary_key=True) # noqa: A003
164+
id: Mapped[int] = mapped_column(init=False, primary_key=True)
165165
indicator_id: Mapped[int] = mapped_column(index=True)
166166
value: Mapped[int]
167167

@@ -188,7 +188,7 @@ class IndicatorState(Base):
188188
"""
189189

190190
__tablename__ = "indicator_state"
191-
id: Mapped[int] = mapped_column(init=False, primary_key=True) # noqa: A003
191+
id: Mapped[int] = mapped_column(init=False, primary_key=True)
192192
indicator_id: Mapped[int] = mapped_column(index=True)
193193
state: Mapped[str]
194194

@@ -213,7 +213,7 @@ class KpiRecord(Base):
213213
The kind of aggregration is either D (day), W (week), M (month) or Y (year)"""
214214

215215
__tablename__ = "kpi"
216-
id: Mapped[int] = mapped_column(init=False, primary_key=True) # noqa: A003
216+
id: Mapped[int] = mapped_column(init=False, primary_key=True)
217217
kpi_id: Mapped[int] = mapped_column(index=True)
218218
agg_kind: Mapped[str]
219219
agg_value: Mapped[str]

backend/src/offspot_metrics_backend/migrations/versions/3c40b9f8c0e8_create_all_first_tables.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
Create Date: 2023-07-24 09:52:15.031073
66
77
"""
8+
89
import sqlalchemy as sa
910
from alembic import op
1011

backend/tasks.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,11 @@ def call_alembic(ctx: Context, cmd: str, *, test_db: bool = False):
6060
f"alembic {cmd}",
6161
pty=use_pty,
6262
env={
63-
"DATABASE_URL": os.getenv("TEST_DATABASE_URL")
64-
if test_db
65-
else os.getenv("DATABASE_URL")
63+
"DATABASE_URL": (
64+
os.getenv("TEST_DATABASE_URL")
65+
if test_db
66+
else os.getenv("DATABASE_URL")
67+
)
6668
},
6769
)
6870

frontend/package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,20 @@
1212
"@fortawesome/fontawesome-svg-core": "^6.4.0",
1313
"@fortawesome/free-regular-svg-icons": "^6.4.0",
1414
"@fortawesome/free-solid-svg-icons": "^6.4.0",
15-
"@fortawesome/vue-fontawesome": "^3.0.5",
15+
"@fortawesome/vue-fontawesome": "^3.0.6",
1616
"apexcharts": "^3.45.2",
17-
"axios": "^1.6.0",
17+
"axios": "^1.6.7",
1818
"pinia": "^2.1.4",
1919
"vite-plugin-vuetify": "^2.0.1",
2020
"vue": "^3.4.15",
2121
"vue-router": "4",
2222
"vue3-apexcharts": "^1.4.4",
23-
"vuetify": "^3.5.1"
23+
"vuetify": "^3.5.2"
2424
},
2525
"devDependencies": {
2626
"@types/glob": "^8.1.0",
27-
"@typescript-eslint/eslint-plugin": "^6.19.1",
28-
"@typescript-eslint/parser": "^6.19.1",
27+
"@typescript-eslint/eslint-plugin": "^6.20.0",
28+
"@typescript-eslint/parser": "^6.20.0",
2929
"@vitejs/plugin-vue": "^5.0.3",
3030
"@vue/eslint-config-prettier": "^9.0.0",
3131
"@vue/eslint-config-standard": "^8.0.1",
@@ -34,9 +34,9 @@
3434
"eslint-config-prettier": "^9.1.0",
3535
"eslint-plugin-html": "^7.1.0",
3636
"eslint-plugin-prettier": "^5.1.3",
37-
"eslint-plugin-vue": "^9.20.1",
38-
"marked": "^11.1.1",
39-
"prettier": "^3.2.4",
37+
"eslint-plugin-vue": "^9.21.1",
38+
"marked": "^12.0.0",
39+
"prettier": "^3.2.5",
4040
"ts-node": "^10.9.1",
4141
"typescript": "^5.3.3",
4242
"vite": "^5.0.12",

0 commit comments

Comments
 (0)