15 Commits
dev ... v0.1.4

Author SHA1 Message Date
Gitea CI
e3cc82568a Bump version: 0.1.3 → 0.1.4 2025-11-25 13:34:37 +00:00
4ad04cdf49 Merge pull request 'feat: add redis caching' (#9) from dev into main
Reviewed-on: #9
2025-11-25 13:33:52 +00:00
Gitea CI
d0dafec4cb Bump version: 0.1.2 → 0.1.3 2025-11-25 10:06:03 +00:00
075041f371 Update pyproject.toml 2025-11-25 10:00:51 +00:00
981d5211b6 Merge pull request 'Add new env variable to use prefixes in url [release-patch]' (#8) from dev into main
Reviewed-on: #8
2025-11-25 09:57:16 +00:00
d5cf0a8636 Merge pull request 'dev' (#7) from dev into main
Reviewed-on: #7
2025-11-25 09:51:05 +00:00
5a1c19ccbe Merge pull request 'dev [release-patch]' (#6) from dev into main
Reviewed-on: #6
2025-11-25 09:05:53 +00:00
59c90ca471 Merge pull request 'chore: replace apk with apt [release-patch]' (#5) from dev into main
Reviewed-on: #5
2025-11-25 08:00:20 +00:00
1e7d45ec49 Merge pull request 'test: inspired by other Dockerfile [release-patch]' (#4) from dev into main
Reviewed-on: #4
2025-11-25 07:51:22 +00:00
69e463c9a4 Merge pull request 'test: add path, switch to uv [release-patch]' (#3) from dev into main
Reviewed-on: #3
2025-11-25 07:39:30 +00:00
b1cdeffb4c Update pyproject.toml 2025-11-25 07:39:24 +00:00
e2cd6d7ba3 Update pyproject.toml 2025-11-25 07:38:30 +00:00
Gitea CI
70a867e4a1 Bump version: 0.1.0 → 0.1.1 2025-11-25 04:13:49 +00:00
16b1c131a4 Merge pull request 'change dockerfile' (#2) from dev into main
Reviewed-on: #2
2025-11-25 04:13:20 +00:00
809ce9bdd9 Merge pull request 'add versioning' (#1) from dev into main
Reviewed-on: #1
2025-11-25 03:52:15 +00:00
5 changed files with 9 additions and 27 deletions

View File

@@ -58,7 +58,7 @@ jobs:
fetch-tags: true # Fetch all tags (refs/tags)
- name: Install uv
uses: astral-sh/setup-uv@v7
uses: astral-sh/setup-uv@v5
- name: Set up Python
run: uv python install
with:

View File

@@ -16,7 +16,7 @@ jobs:
uses: docker/setup-buildx-action@v2
- name: Install uv
uses: astral-sh/setup-uv@v7
uses: astral-sh/setup-uv@v5
- name: (optional) Prepare dependencies
run: |

13
.vscode/settings.json vendored
View File

@@ -1,13 +0,0 @@
{
"cSpell.words": [
"buildx",
"Buildx",
"elif",
"gitea",
"Gitea",
"github",
"linux",
"pyproject",
"semapform"
]
}

View File

@@ -4,19 +4,17 @@ This can run independently to support the PHP application.
"""
from __future__ import annotations
import asyncio
from contextlib import asynccontextmanager
import json
import logging
import os
import re
import time
import urllib.parse
from contextlib import asynccontextmanager
from typing import TYPE_CHECKING, Any
from typing import Any, TYPE_CHECKING
if TYPE_CHECKING:
from collections.abc import AsyncIterator, Awaitable, Callable
from collections.abc import AsyncIterator, Callable, Awaitable
# Avoid importing heavy modules at top-level to keep `import api_service` lightweight
from fastapi import FastAPI, Query, Request, Response
@@ -31,7 +29,7 @@ redis_client = None
@asynccontextmanager
async def _lifespan(_app: FastAPI) -> AsyncIterator[None]:
"""Lifespan handler: connect to Redis on startup and close on shutdown."""
global redis_client # type: ignore[PLW0603]
global redis_client
if REDIS_URL:
try:
import redis.asyncio as aioredis
@@ -161,10 +159,6 @@ async def _cache_set(key: str, value: CacheValue, ttl: int = CACHE_TTL_SECONDS)
async def validate_signature(signature: str = Query(...)) -> JSONResponse:
"""Validate a book signature and return total pages."""
# check cache first
# ensure signature is stripped of leading/trailing whitespace
signature = signature.strip()
# enforce url quotes
signature = urllib.parse.quote(signature)
cache_key = f"signature:{signature}"
cached = await _cache_get(cache_key)
if cached is not None:

View File

@@ -1,12 +1,13 @@
[project]
name = "semapform-api"
version = "0.2.0"
version = "0.1.4"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.13"
dependencies = [
"bibapi[catalogue]>=0.0.6",
"fastapi>=0.122.0",
"pip>=25.3",
"uvicorn>=0.38.0",
"redis>=4.6.0",
]
@@ -15,7 +16,7 @@ name = "gitea"
url = "https://git.theprivateserver.de/api/packages/PHB/pypi/simple/"
[tool.bumpversion]
current_version = "0.1.3"
current_version = "0.1.4"
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
serialize = ["{major}.{minor}.{patch}"]
search = "{current_version}"