Skip to content

Commit 0a22a37

Browse files
authored
dev: add pytest in CI (#36)
1 parent 234c0b3 commit 0a22a37

File tree

4 files changed

+16
-11
lines changed

4 files changed

+16
-11
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,10 @@ jobs:
5757

5858
- name: Test
5959
run: turbo test
60+
61+
- name: Install uv
62+
uses: astral-sh/setup-uv@v6
63+
64+
- name: Run python tests
65+
run: uv run pytest
66+
working-directory: python

.github/workflows/trunk-check.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,3 @@ jobs:
2929

3030
- name: Trunk Code Quality
3131
uses: trunk-io/trunk-action@v1
32-
33-
- name: Ty Check
34-
run: uv run ty check

python/src/cairo_coder/server/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
the Cairo Coder RAG pipeline via HTTP and WebSocket endpoints.
66
"""
77

8-
from .app import CairoCoderServer, app, create_app
8+
from .app import CairoCoderServer, create_app
99

10-
__all__ = ["CairoCoderServer", "create_app", "app"]
10+
__all__ = ["CairoCoderServer", "create_app"]

python/src/cairo_coder/server/app.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -630,10 +630,10 @@ async def lifespan(app: FastAPI):
630630

631631
_vector_db = None
632632

633-
634-
# Create FastAPI app instance
635-
app = create_app(get_vector_store_config())
636-
633+
def create_app_factory():
634+
"""Factory function for creating the app, used by uvicorn in reload mode."""
635+
ConfigManager.load_config()
636+
return create_app(get_vector_store_config())
637637

638638
def main():
639639
import argparse
@@ -650,14 +650,15 @@ def main():
650650
# TODO: Find a proper pattern for it?
651651
# TODO: multi-model management?
652652
uvicorn.run(
653-
"cairo_coder.server.app:app",
653+
"cairo_coder.server.app:create_app_factory",
654654
host="0.0.0.0",
655655
port=3001,
656656
reload=args.dev,
657657
log_level="info",
658658
workers=args.workers,
659+
factory=True,
659660
)
660661

661-
662662
if __name__ == "__main__":
663+
# Create FastAPI app instance
663664
main()

0 commit comments

Comments
 (0)