From 74ff09fefe304977f903afde1094941119558225 Mon Sep 17 00:00:00 2001 From: gabdevele Date: Wed, 3 Jun 2026 01:21:38 +0200 Subject: [PATCH] Clean dev tooling layout --- .gitignore | 1 + AGENTS.md | 2 +- CMakeLists.txt | 4 +-- README.md | 11 ++++---- docs/ARCHITECTURE.md | 12 ++++----- docs/MILESTONE_03.md | 2 +- .../generate.py => generate_openapi.py | 0 {tools/visione-lab => lab}/app.py | 0 {tools => lab}/pyproject.toml | 3 ++- {tools => lab}/uv.lock | 26 +++++++++++-------- 10 files changed, 33 insertions(+), 28 deletions(-) rename tools/drogon-openapi-gen/generate.py => generate_openapi.py (100%) rename {tools/visione-lab => lab}/app.py (100%) rename {tools => lab}/pyproject.toml (68%) rename {tools => lab}/uv.lock (99%) diff --git a/.gitignore b/.gitignore index 55e768b..c5821eb 100644 --- a/.gitignore +++ b/.gitignore @@ -95,6 +95,7 @@ build/ .cache/ .env uploads/ +lab/.venv/ ### CMake Patch ### # External projects diff --git a/AGENTS.md b/AGENTS.md index 1c09a07..eda246c 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -24,7 +24,7 @@ - Build: `cmake --build build` - Test: `ctest --test-dir build --output-on-failure` - OpenAPI: `cmake --build build --target openapi` -- Lab frontend: `streamlit run tools/visione-lab/app.py` +- Lab frontend: `cd lab && uv run streamlit run app.py` - Local services: `docker compose up -d` - App: `./build/visione-backend` diff --git a/CMakeLists.txt b/CMakeLists.txt index e0730b3..fb119ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,13 +77,13 @@ set(OPENAPI_OUTPUT ${CMAKE_BINARY_DIR}/openapi/visione.openapi.json) add_custom_command( OUTPUT ${OPENAPI_OUTPUT} COMMAND ${Python3_EXECUTABLE} - ${CMAKE_CURRENT_SOURCE_DIR}/tools/drogon-openapi-gen/generate.py + ${CMAKE_CURRENT_SOURCE_DIR}/generate_openapi.py --controllers ${CMAKE_CURRENT_SOURCE_DIR}/controllers --out ${OPENAPI_OUTPUT} --title "Visione API" --version ${PROJECT_VERSION} DEPENDS - ${CMAKE_CURRENT_SOURCE_DIR}/tools/drogon-openapi-gen/generate.py + ${CMAKE_CURRENT_SOURCE_DIR}/generate_openapi.py ${CONTROLLER_HEADERS} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} VERBATIM diff --git a/README.md b/README.md index 3c7ce0e..bad99cc 100644 --- a/README.md +++ b/README.md @@ -90,14 +90,13 @@ The app serves the generated JSON at `/api/v1/openapi.json` and Swagger UI at ## Visione Lab -`tools/visione-lab` is a small Streamlit frontend used only to test the backend -visually while the real frontend is not ready. +`lab/` is a small Streamlit frontend used only to test the backend visually +while the real frontend is not ready. ```bash -python3 -m venv .venv-lab -. .venv-lab/bin/activate -pip install -r tools/visione-lab/requirements.txt -streamlit run tools/visione-lab/app.py +cd lab +uv sync +uv run streamlit run app.py ``` Keep the backend running on `http://127.0.0.1:5555`. The lab calls the API from diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 7ba23f7..0e6bb85 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -6,7 +6,7 @@ - `repositories/`: database helpers and migrations. - `common/`: reusable HTTP, auth, crypto, email and validation utilities. - `migrations/`: versioned SQL files. -- `tools/`: local developer tools such as OpenAPI generation. +- `lab/`: local Streamlit frontend for visual endpoint testing. - `docs/`: product, API, schema and milestone documentation. ## Drogon Usage @@ -29,8 +29,8 @@ available through OpenSSL, which is already a Drogon dependency in this project. Legacy `sha256$` password hashes are rejected instead of silently accepted. ## OpenAPI Generation -`tools/drogon-openapi-gen/generate.py` scans Drogon `ADD_METHOD_TO` route macros -in `controllers/*.h` and generates `build/openapi/visione.openapi.json`. +`generate_openapi.py` scans Drogon `ADD_METHOD_TO` route macros in +`controllers/*.h` and generates `build/openapi/visione.openapi.json`. This is a contract-last generator: the source of truth is the C++ controller route list, not a manually maintained static Swagger document. The current tool @@ -39,6 +39,6 @@ multipart request bodies. Deeper request/response schemas can be added later by teaching the generator project-specific conventions or comments. ## Visione Lab -`tools/visione-lab` is a Streamlit dev frontend for visual endpoint testing. It -is intentionally separate from the real product frontend and should stay small: -forms, uploads and response rendering only. +`lab/` is a Streamlit dev frontend for visual endpoint testing. It is +intentionally separate from the real product frontend and should stay small: +forms, uploads and response rendering only. Run it with uv from `lab/`. diff --git a/docs/MILESTONE_03.md b/docs/MILESTONE_03.md index 4bac00a..a991570 100644 --- a/docs/MILESTONE_03.md +++ b/docs/MILESTONE_03.md @@ -14,7 +14,7 @@ ## To do next - Add richer OpenAPI schema metadata for request and response bodies. -- Consider extracting `tools/drogon-openapi-gen` into an open-source standalone +- Consider extracting `generate_openapi.py` into an open-source standalone project once the conventions stabilize. - Add minimal media upload integration tests after endpoint contracts settle. - Keep API and docs on `media` terminology only. diff --git a/tools/drogon-openapi-gen/generate.py b/generate_openapi.py similarity index 100% rename from tools/drogon-openapi-gen/generate.py rename to generate_openapi.py diff --git a/tools/visione-lab/app.py b/lab/app.py similarity index 100% rename from tools/visione-lab/app.py rename to lab/app.py diff --git a/tools/pyproject.toml b/lab/pyproject.toml similarity index 68% rename from tools/pyproject.toml rename to lab/pyproject.toml index 91360f0..290f95e 100644 --- a/tools/pyproject.toml +++ b/lab/pyproject.toml @@ -1,7 +1,8 @@ [project] -name = "tools" +name = "visione-lab" version = "0.1.0" requires-python = ">=3.13" dependencies = [ + "requests>=2.32.5", "streamlit>=1.58.0", ] diff --git a/tools/uv.lock b/lab/uv.lock similarity index 99% rename from tools/uv.lock rename to lab/uv.lock index 442f79d..7d87487 100644 --- a/tools/uv.lock +++ b/lab/uv.lock @@ -784,17 +784,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/44/6f/7120676b6d73228c96e17f1f794d8ab046fc910d781c8d151120c3f1569e/toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b", size = 16588, upload-time = "2020-11-01T01:40:20.672Z" }, ] -[[package]] -name = "tools" -version = "0.1.0" -source = { virtual = "." } -dependencies = [ - { name = "streamlit" }, -] - -[package.metadata] -requires-dist = [{ name = "streamlit", specifier = ">=1.58.0" }] - [[package]] name = "typing-extensions" version = "4.15.0" @@ -835,6 +824,21 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/01/be/72532be3da7acc5fdfbccdb95215cd04f995a0886532a5b423f929cda4cc/uvicorn-0.48.0-py3-none-any.whl", hash = "sha256:48097851328b87ec36117d3d575234519eb58c2b22d79666e9bbc6c49a761dad", size = 71410, upload-time = "2026-05-24T12:08:40.258Z" }, ] +[[package]] +name = "visione-lab" +version = "0.1.0" +source = { virtual = "." } +dependencies = [ + { name = "requests" }, + { name = "streamlit" }, +] + +[package.metadata] +requires-dist = [ + { name = "requests", specifier = ">=2.32.5" }, + { name = "streamlit", specifier = ">=1.58.0" }, +] + [[package]] name = "watchdog" version = "6.0.0"