Spaces:
Build error
Build error
Claude commited on
docs: Sprint Fix 5 — sync README, CLAUDE.md, add conftest.py
Browse files3 issues fixed:
- #31: Update README.md provider table: remove obsolete AI_PROVIDER
concept and google_ai_api/google_vertex references, add Mistral
and Vertex service account. Update test count 477→563. Add
frontend to repo structure.
- #32: Sync CLAUDE.md pyproject.toml section with actual backend
pyproject.toml (name, version, all dependencies). Update tree
to show Dockerfile at root, frontend directory, docker-compose
in infra/.
- #33: Create tests/conftest.py that re-exports fixtures from
conftest_api.py for pytest auto-discovery.
563 tests pass, 0 regressions.
https://claude.ai/code/session_01UB4he7RdRPHLvNjky4X8Sw
- CLAUDE.md +30 -16
- README.md +17 -11
- backend/tests/conftest.py +3 -0
CLAUDE.md
CHANGED
|
@@ -38,34 +38,36 @@ latin carolingien, XIe siècle). Le Beatus est un profil parmi d'autres — pas
|
|
| 38 |
|
| 39 |
```toml
|
| 40 |
[project]
|
| 41 |
-
name = "iiif-studio"
|
| 42 |
-
version = "0.
|
| 43 |
requires-python = ">=3.11"
|
| 44 |
|
| 45 |
dependencies = [
|
| 46 |
-
"
|
|
|
|
|
|
|
| 47 |
"pydantic-settings>=2.0",
|
| 48 |
-
"fastapi>=0.104",
|
| 49 |
-
"uvicorn>=0.24",
|
| 50 |
-
"python-multipart>=0.0.6",
|
| 51 |
-
"google-genai>=0.3",
|
| 52 |
-
"lxml>=4.9",
|
| 53 |
-
"Pillow>=10.0",
|
| 54 |
-
"httpx>=0.25",
|
| 55 |
"sqlalchemy>=2.0",
|
| 56 |
-
"aiosqlite>=0.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
]
|
| 58 |
|
| 59 |
[project.optional-dependencies]
|
| 60 |
dev = [
|
| 61 |
-
"pytest>=
|
| 62 |
-
"pytest-cov>=
|
| 63 |
-
"pytest-asyncio>=0.
|
| 64 |
]
|
| 65 |
|
| 66 |
[tool.pytest.ini_options]
|
| 67 |
-
testpaths = ["tests"]
|
| 68 |
asyncio_mode = "auto"
|
|
|
|
| 69 |
```
|
| 70 |
|
| 71 |
---
|
|
@@ -170,8 +172,20 @@ iiif-studio/
|
|
| 170 |
│ ├── alto.xml
|
| 171 |
│ └── annotations.json
|
| 172 |
│
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 173 |
└── infra/
|
| 174 |
-
└──
|
| 175 |
```
|
| 176 |
|
| 177 |
---
|
|
|
|
| 38 |
|
| 39 |
```toml
|
| 40 |
[project]
|
| 41 |
+
name = "iiif-studio-backend"
|
| 42 |
+
version = "0.2.0"
|
| 43 |
requires-python = ">=3.11"
|
| 44 |
|
| 45 |
dependencies = [
|
| 46 |
+
"fastapi>=0.111",
|
| 47 |
+
"uvicorn[standard]>=0.29",
|
| 48 |
+
"pydantic>=2.7",
|
| 49 |
"pydantic-settings>=2.0",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
"sqlalchemy>=2.0",
|
| 51 |
+
"aiosqlite>=0.20",
|
| 52 |
+
"google-genai>=1.0",
|
| 53 |
+
"google-auth>=2.0",
|
| 54 |
+
"httpx>=0.27",
|
| 55 |
+
"lxml>=5.2",
|
| 56 |
+
"Pillow>=10.3",
|
| 57 |
+
"python-multipart>=0.0.9",
|
| 58 |
+
"mistralai>=1.0",
|
| 59 |
]
|
| 60 |
|
| 61 |
[project.optional-dependencies]
|
| 62 |
dev = [
|
| 63 |
+
"pytest>=8.2",
|
| 64 |
+
"pytest-cov>=5.0",
|
| 65 |
+
"pytest-asyncio>=0.23",
|
| 66 |
]
|
| 67 |
|
| 68 |
[tool.pytest.ini_options]
|
|
|
|
| 69 |
asyncio_mode = "auto"
|
| 70 |
+
testpaths = ["tests"]
|
| 71 |
```
|
| 72 |
|
| 73 |
---
|
|
|
|
| 172 |
│ ├── alto.xml
|
| 173 |
│ └── annotations.json
|
| 174 |
│
|
| 175 |
+
├── frontend/ ← React + TypeScript + Vite
|
| 176 |
+
│ ├── src/
|
| 177 |
+
│ │ ├── App.tsx
|
| 178 |
+
│ │ ├── main.tsx
|
| 179 |
+
│ │ ├── lib/api.ts ← client API typé
|
| 180 |
+
│ │ ├── pages/ ← Home, Reader, Editor, Admin
|
| 181 |
+
│ │ └── components/ ← Viewer, retro/, SearchBar, etc.
|
| 182 |
+
│ ├── package.json
|
| 183 |
+
│ └── vite.config.ts
|
| 184 |
+
│
|
| 185 |
+
├── Dockerfile ← multi-stage (frontend + backend)
|
| 186 |
+
│
|
| 187 |
└── infra/
|
| 188 |
+
└── docker-compose.yml ← dev local uniquement
|
| 189 |
```
|
| 190 |
|
| 191 |
---
|
README.md
CHANGED
|
@@ -26,12 +26,13 @@ iiif-studio/
|
|
| 26 |
│ │ ├── models/ # tables SQLAlchemy (SQLite async)
|
| 27 |
│ │ ├── schemas/ # modèles Pydantic v2
|
| 28 |
│ │ └── services/ # ingest / image / ai / export / search
|
| 29 |
-
│ ├── tests/ # suite pytest (
|
| 30 |
│ └── pyproject.toml
|
|
|
|
| 31 |
├── profiles/ # 4 profils de corpus JSON
|
| 32 |
├── prompts/ # templates de prompts par profil
|
| 33 |
-
├── infra/ #
|
| 34 |
-
├── Dockerfile #
|
| 35 |
└── data/ # artefacts runtime — NON versionné
|
| 36 |
```
|
| 37 |
|
|
@@ -66,7 +67,7 @@ pip install -e ".[dev]"
|
|
| 66 |
pytest tests/ -v --cov=app
|
| 67 |
```
|
| 68 |
|
| 69 |
-
Résultat attendu : **
|
| 70 |
|
| 71 |
---
|
| 72 |
|
|
@@ -86,15 +87,20 @@ curl http://localhost:7860/api/v1/profiles
|
|
| 86 |
|
| 87 |
---
|
| 88 |
|
| 89 |
-
## Providers
|
| 90 |
|
| 91 |
-
|
|
|
|
|
|
|
| 92 |
|
| 93 |
-
| Provider | Variable
|
| 94 |
-
|----------|------------------------
|
| 95 |
-
| Google AI Studio
|
| 96 |
-
|
|
| 97 |
-
|
|
|
|
|
|
|
|
|
|
|
| 98 |
|
| 99 |
Les clés ne doivent **jamais** figurer dans le code, les commits ou l'image Docker.
|
| 100 |
Sur HuggingFace Spaces, les renseigner dans **Settings → Repository secrets**.
|
|
|
|
| 26 |
│ │ ├── models/ # tables SQLAlchemy (SQLite async)
|
| 27 |
│ │ ├── schemas/ # modèles Pydantic v2
|
| 28 |
│ │ └── services/ # ingest / image / ai / export / search
|
| 29 |
+
│ ├── tests/ # suite pytest (563 tests)
|
| 30 |
│ └── pyproject.toml
|
| 31 |
+
├── frontend/ # React + TypeScript + Vite (design rétro)
|
| 32 |
├── profiles/ # 4 profils de corpus JSON
|
| 33 |
├── prompts/ # templates de prompts par profil
|
| 34 |
+
├── infra/ # docker-compose (dev local)
|
| 35 |
+
├── Dockerfile # image multi-stage (frontend + backend)
|
| 36 |
└── data/ # artefacts runtime — NON versionné
|
| 37 |
```
|
| 38 |
|
|
|
|
| 67 |
pytest tests/ -v --cov=app
|
| 68 |
```
|
| 69 |
|
| 70 |
+
Résultat attendu : **563 passed, 3 skipped**.
|
| 71 |
|
| 72 |
---
|
| 73 |
|
|
|
|
| 87 |
|
| 88 |
---
|
| 89 |
|
| 90 |
+
## Providers IA
|
| 91 |
|
| 92 |
+
Le backend détecte automatiquement quels providers sont disponibles selon les
|
| 93 |
+
variables d'environnement présentes. Pas de sélecteur global `AI_PROVIDER` —
|
| 94 |
+
le modèle est choisi par corpus depuis l'interface d'administration.
|
| 95 |
|
| 96 |
+
| Provider | Variable d'environnement |
|
| 97 |
+
|----------|--------------------------|
|
| 98 |
+
| Google AI Studio | `GOOGLE_AI_STUDIO_API_KEY` |
|
| 99 |
+
| Vertex AI (clé API) | `VERTEX_API_KEY` |
|
| 100 |
+
| Vertex AI (compte de service) | `VERTEX_SERVICE_ACCOUNT_JSON` |
|
| 101 |
+
| Mistral AI | `MISTRAL_API_KEY` |
|
| 102 |
+
|
| 103 |
+
Au moins **une** clé est nécessaire pour que le pipeline fonctionne.
|
| 104 |
|
| 105 |
Les clés ne doivent **jamais** figurer dans le code, les commits ou l'image Docker.
|
| 106 |
Sur HuggingFace Spaces, les renseigner dans **Settings → Repository secrets**.
|
backend/tests/conftest.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Re-export des fixtures partagées pour la découverte automatique par pytest.
|
| 2 |
+
# Le fichier conftest_api.py contient les vraies définitions (async_client, etc.).
|
| 3 |
+
from tests.conftest_api import * # noqa: F401, F403
|