File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : CI
2+
3+ on :
4+ workflow_dispatch : {}
5+ push :
6+ branches :
7+ - main
8+ paths-ignore :
9+ - " .git**"
10+ pull_request :
11+
12+ jobs :
13+ build :
14+ runs-on : ubuntu-latest
15+
16+ steps :
17+ - uses : actions/checkout@v4
18+ - name : Set up Python
19+ uses : actions/setup-python@v3
20+ with :
21+ python-version : " 3.13"
22+ - name : Install dependencies
23+ run : |
24+ python -m pip install --upgrade pip
25+ pip install uv
26+ - name : Test with pytest
27+ run : |
28+ uv run pytest
Original file line number Diff line number Diff line change 88
99# Virtual environments
1010.venv
11+ .idea
1112.env
1213graph.json
13- outputs /
14+ outputs /
Original file line number Diff line number Diff line change 1- 3.12
1+ 3.13
Original file line number Diff line number Diff line change @@ -17,7 +17,6 @@ RUN uv sync --no-dev --no-install-project
1717
1818COPY src/ ./src/
1919COPY app.py ./app.py
20- COPY graph.json ./graph.json
2120
2221
2322
Original file line number Diff line number Diff line change 1+ # GOV.UK AI Graph Tools
2+
3+ TODO: Fill in project description
4+
5+ ## Local Setup
6+
7+ ---
8+
9+ ### Prerequisites
10+
11+ - ** Python 3.13** - managed via ` uv `
12+ - ** uv** — Python package manager
13+
14+ Install ` uv ` if not already installed:
15+
16+ ``` bash
17+ brew install uv
18+ # or
19+ pip install uv
20+ ```
21+
22+ ---
23+
24+ ### 1. Install dependencies
25+
26+ ``` bash
27+ uv init --python 3.13
28+ uv python pin 3.13
29+ uv add -r requirements.txt
30+ ```
31+
32+ ### 2. Run the app
33+
34+ ** Debug mode (Flask dev server):**
35+
36+ ``` bash
37+ uv run app.py
38+ ```
39+
40+ ** Production mode (Waitress WSGI server):**
41+
42+ ``` bash
43+ uv run waitress-serve --port 3000 --call ' app:create_app'
44+ ```
45+
46+ The app runs on ** http://localhost:3000 ** .
47+
48+ ---
49+
50+
51+ ### 3. Docker run
52+
53+ Build and run using Docker:
54+
55+ ``` bash
56+ docker build -t govuk-ai-graph-tools-app .
57+
58+ docker run -p 3000:3000 -t govuk-ai-graph-tools-app
59+ ```
60+
61+ ---
62+
63+
64+ ## Tests
65+
66+ ``` bash
67+ uv run pytest
68+ ```
69+
70+ ---
71+
72+ ## Licence
73+
74+ [ MIT LICENCE] ( LICENCE )
75+
76+
77+
78+
79+
Original file line number Diff line number Diff line change 1919def create_app ():
2020 app = Flask (__name__ )
2121
22- @app .route ('/health ' , methods = ['GET' ])
22+ @app .route ('/healthcheck/ready ' , methods = ['GET' ])
2323 def health_check ():
2424 """Simple health check endpoint."""
25- return jsonify ({ "status" : "healthy" }) , 200
25+ return "Application OK" , 200
2626
2727 @app .route ('/extract' , methods = ['GET' ])
2828 async def extract_quotes ():
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ dependencies = [
1313 " s3fs>=0.4.2" ,
1414 " opensearch-py>=2.8.0" ,
1515 " requests-aws4auth>=1.3.1" ,
16- " flask[async]>=3.0.0 " ,
16+ " flask[async]==3.1.2 " ,
1717 " waitress>=3.0.0" ,
1818]
1919
Original file line number Diff line number Diff line change 1+ import pytest
2+ import importlib
3+ import sys
4+ from werkzeug .test import Client
5+ from werkzeug .wrappers import Response
6+
7+ def _app_module ():
8+ return importlib .import_module ("app" )
9+
10+
11+ def _client ():
12+ return Client (_app_module ().create_app (), Response )
13+
14+ def test_healthcheck_ready_route ():
15+ response = _client ().get ("/healthcheck/ready" )
16+
17+ assert response .status_code == 200
18+ body = response .get_data (as_text = True )
19+ assert 'Application OK' in body
You can’t perform that action at this time.
0 commit comments