FastAPI wrapper exposing easystitch pipeline as HTTP service #1
Labels
No labels
blocked:needs-attention
blocked:needs-decision
bug
feature-request
in-progress
needs-decompose
quickfix
triage-approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Mark/easystitch-service#1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
Implement the FastAPI app that wraps
~/Projects/easystitch/'sEmbroideryPipelineand exposes the three endpoints specified in Kimi_Agent_Brother_10_Digitizing_App#11:POST /v1/digitize— raster in, regions + stitch objects outPOST /v1/export— stitch objects in, embroidery file bytes out (PES/DST/EXP/JEF)POST /v1/threads/resolve— ΔE-2000 thread palette lookupImplementation
app.pyis the FastAPI entrypoint. Importssrc.main_pipeline.EmbroideryPipelineand the relevant modules fromMark/easystitch(src/embroidery_converter/,src/output_generators/,src/post_processing/,src/embroidery_converter/thread_manager.py).run_in_executorper request, with a thread pool sized to N=CPU cores. Reject beyond-queue-depth requests with503.413). Settings validated via pydantic (stitchPreference,fillDensityMm, etc. as in #11's spec).http://localhost:3000(ThreadCraft dev) and the production ThreadCraft origin only. Tailnet is trusted; no auth.GET /healthzreturns{"status": "ok", "version": "..."}for node_hub liveness.processingMsandtotalStitcheson/v1/digitizeresponses.Files to create
app.py— FastAPI app, endpoint handlers, lifespan managementmodels.py— pydantic request/response modelspipeline_runner.py— thread-pool wrapper aroundEmbroideryPipelinerequirements.txt— fastapi, uvicorn[standard], pydantic, python-multipart, plus easystitch's own deps (or rely on the easystitch Docker base image)Out of scope (this issue)
Acceptance
POST /v1/digitizeon a 1024×1024 PNG returns stitch objects within 5 seconds on a dev box (CPU-only is fine).POST /v1/exportwithformat=pesreturns a file that loads in an embroidery viewer.POST /v1/threads/resolvereturns ΔE-2000 distances.GET /healthzreturns 200 with version./openapi.jsonreflects all endpoints.Dependencies
Mark/easystitchis a sibling repo. Either:pip install -e ../easystitchin dev, orFROM mark/easystitch:latest(see Dockerfile issue).Dependency
Depends on easystitch#82 — version accessor.
Why: /healthz needs easystitch_version.
This is one of 8 easystitch issues opened against
Mark/easystitchto unblock the service:All eight are triaged-approved on
Mark/easystitch. Until they land,/v1/digitizeand/v1/threads/resolvecannot return the contract shape.