Replace flask with fastapi and celery with taskiq#869
Conversation
Remove the old Flask/Celery/eventlet backend (src/, app/, tests/) and replace with the new FastAPI/TaskIQ async codebase. Carried-over files (docs, CI, Docker, misc) will be adapted in subsequent commits. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add authors, license from original ZnDraw - Add docs dependency group (sphinx, furo, etc.) - Add playwright to dev deps for screenshot tests - Add [full] optional dependency (molify) - Remove local uv.sources (editable paths) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Merge guidelines from both old ZnDraw and zndraw-fastapi AGENTS.md into a concise version. CLAUDE.md is a symlink to AGENTS.md. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Drop MongoDB service (deferred) - Add bun setup for frontend build - Keep Redis service, Python matrix, codecov Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove Celery worker service (replaced by built-in TaskIQ workers) - Remove MongoDB service (deferred) - Remove FLASK_SECRET_KEY env var - Keep LMDB storage for both standalone and production Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove --file-browser flags (not in new CLI). Server startup and shutdown commands are otherwise the same. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace Flask-SocketIO → FastAPI with Socket.IO, Celery Workers → TaskIQ Workers in mermaid diagram. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
README is backend-agnostic — all Python API examples use the ZnDraw client which works identically with the new FastAPI backend. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
src/zndraw/static/ is generated by hatch_build.py during wheel build and should not be committed to the repository. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
socket.off() returns Socket which TS rejects as useEffect cleanup. Wrap in block statement to discard return value. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Generated from pyproject.toml with all deps resolving from PyPI. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
TcpFakeServer (fakeredis) speaks RESP3 but redis-py defaults to RESP2, causing Protocol Error on all Redis operations in dev mode. Pass protocol=3 when connecting to the fake server. Also fix shutdown endpoint URL: /v1/shutdown -> /v1/admin/shutdown (admin router has /v1/admin prefix). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Update port from 5000 to 8000 (new DEFAULT_PORT) - Use /v1/health endpoint for server readiness check - Use process.terminate() instead of zndraw --shutdown for cleanup - Update register_extension -> register_job (new client API) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
REST + socket broadcast with ZnDrawTqdm client subclass. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
10-task TDD plan: Redis keys, schemas, routes, client API, ZnDrawTqdm, frontend. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Extract progress_trackers from room join response - Use snake_case field names from backend events - Remove progress_init handler (data comes via join response) - Remove roomId filter (events are room-scoped) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use ZnDrawTqdm to show progress both in terminal and in the ZnDraw UI when uploading frames via extend(). Removes rich dependency for uploads. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace the single `progress: float` percentage field with tqdm-style fields (n, total, elapsed, unit) so the frontend can render item counts, elapsed time, and rate — matching tqdm's display for both known and unknown totals. - Fix snake_case/camelCase mismatch that caused NaN% in frontend (C1) - Remove dead `roomId` field from Progress TS interface (C2) - Add Redis EXPIRE (1h TTL) on progress hash for orphaned cleanup - Rewrite ProgressNotifications to show "42/100 frames [00:05, 8.4/s]" Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Provides the old vis.progress_bar(...) API as a context manager that wraps ZnDrawTqdm, marked with typing_extensions.deprecated so type checkers and runtime both emit deprecation warnings. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…eanup Replace user-id-based edit lock with server-issued UUID lock tokens (Lock-Token header, inspired by WebDAV RFC 4918). Acquire uses atomic Redis SET NX to prevent TOCTOU races. Disconnect handler releases locks immediately when the holding session's socket drops. TTL is configurable via Settings.edit_lock_ttl (ZNDRAW_EDIT_LOCK_TTL env, default 10s). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
35 tests across 10 spec files covering frames navigation, geometry drawing, editing mode, edit lock (two-tab), camera sessions, chat, extensions, registration, socket sync, and frame invalidation. Runs headed with 4 parallel workers against a live ZnDraw server. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
fsspec file objects lack a .name attribute, so ASE's auto-detection falls back to magic-byte sniffing which fails on text-mode streams. Pass the format explicitly via ase.io.formats.filetype(path). Also extends the register_fs E2E test to cover the full file browser flow: browse directories, open LoadFileDialog, submit load task, and verify frames appear in the room. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace the separate Python Playwright system (misc/test_screenshots.py) with a Playwright E2E spec that uses localStorage theme injection via addInitScript, eliminating fragile double-click theme toggling. Each test captures one screenshot; a for-loop creates two parallel describe blocks (light/dark) with unique room names per theme. - Extract spawnPY/waitForBgReady from registration.spec.ts to helpers.ts - Add docs-screenshots.spec.ts with 27 tests x 2 themes = 54 tests - Delete misc/test_screenshots.py, misc/conftest.py, misc/lightmode/, misc/darkmode/ Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Important Review skippedToo many files! This PR contains 232 files, which is 82 over the limit of 150. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (68)
📒 Files selected for processing (232)
You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #869 +/- ##
===========================================
+ Coverage 79.82% 92.07% +12.24%
===========================================
Files 166 147 -19
Lines 20447 14783 -5664
===========================================
- Hits 16322 13611 -2711
+ Misses 4125 1172 -2953 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
The CI workflow runs `pytest --cov` but pytest-cov was not listed in the dev dependency group, causing test failures. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The gitignored src/zndraw/static/ directory was excluded from wheel builds. Adding it as a hatch artifact ensures the Vite build output is packaged. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add room-wide default camera so new browser sessions inherit a specific
view instead of hardcoded Camera() defaults.
Backend:
- default_camera column on Room model
- GET/PUT /v1/rooms/{room_id}/default-camera endpoints
- Server-side camera clone in room_join()
- Auto-clear on geometry delete
- DefaultCameraInvalidate socket event for real-time sync
Frontend:
- useDefaultCamera React Query hook
- Star icon toggle in GeometryGrid for Camera-type rows
- Socket listener for cache invalidation
Python client:
- vis.default_camera property with client-side validation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
401e08e to
1226761
Compare
for more information, see https://pre-commit.ci
Avoids slow first-request latency by pre-populating sys.modules via asyncio.to_thread during lifespan, after all services are ready. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Reintroduce constraints-fixed-atoms default geometry and enhance TransformEditor with a constraint selector for path autocomplete. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use SkipJsonSchema to exclude fields that cause broken anyOf tabs or "No applicable renderer" errors in the JSONForms-based editor: - selection (list[int] | None) on all geometries - variant (Literal const) on Curve - bond_order_radius_scale (dict[float, float]) on Bond Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
New rooms now include a constraint visualization geometry using InArrayTransform to overlay red wireframe spheres on constrained atoms. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Verify that new rooms include the constraints-fixed-atoms geometry with correct InArrayTransform config for position and radius, and that constraint data survives the client append/retrieve cycle. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When source is "constraints", the path field is replaced with a MUI
Select dropdown that fetches actual constraint entries from the current
frame and lets the user pick one (e.g., "#0: FixAtoms — indices: [0, 2]").
Selection sets path to "{index}.kwargs.indices" automatically. Shows a
loading spinner while fetching and "No constraints in current frame"
when empty.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds end-to-end tests that verify constraint geometries (FixAtoms, FixedLine) appear correctly in the geometry panel and render in the 3D scene. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds a new subsection under Geometries documenting automatic constraint visualization with an acetic acid example showing FixAtoms usage. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use butyric acid (CCCC(=O)O) with constrained carbon chain for a realistic molecular example in the Playwright test. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…mera bug - Add constraint_visualization screenshot test to docs-screenshots.spec.ts with zoomed-in default camera for better visibility - Update python-api.rst to use molify.smiles2conformers and add light/dark mode screenshot directives - Fix frozen Camera setattr bug in socketio.py room_join — use model_copy instead of mutating the frozen Pydantic model - Add FixAtoms modifier extension Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add simgen_enabled field to Settings (ZNDRAW_SIMGEN_ENABLED env var), read it in get_global_settings() instead of hardcoding False. Also clean up utility.py to use SettingsDep instead of raw Depends(). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
858c17a to
09f90a4
Compare
for more information, see https://pre-commit.ci
No description provided.