Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: CI

on:
workflow_dispatch: {}
push:
branches:
- main
paths-ignore:
- ".git**"
pull_request:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.13"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install uv
- name: Test with pytest
run: |
uv run pytest
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ wheels/

# Virtual environments
.venv
.idea
.env
graph.json
outputs/
outputs/
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.12
3.13
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ RUN uv sync --no-dev --no-install-project

COPY src/ ./src/
COPY app.py ./app.py
COPY graph.json ./graph.json



Expand Down
79 changes: 79 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# GOV.UK AI Graph Tools

TODO: Fill in project description

## Local Setup

---

### Prerequisites

- **Python 3.13** - managed via `uv`
- **uv** — Python package manager

Install `uv` if not already installed:

```bash
brew install uv
# or
pip install uv
```

---

### 1. Install dependencies

```bash
uv init --python 3.13
uv python pin 3.13
uv add -r requirements.txt
```

### 2. Run the app

**Debug mode (Flask dev server):**

```bash
uv run app.py
```

**Production mode (Waitress WSGI server):**

```bash
uv run waitress-serve --port 3000 --call 'app:create_app'
```

The app runs on **http://localhost:3000**.

---


### 3. Docker run

Build and run using Docker:

```bash
docker build -t govuk-ai-graph-tools-app .

docker run -p 3000:3000 -t govuk-ai-graph-tools-app
```

---


## Tests

```bash
uv run pytest
```

---

## Licence

[MIT LICENCE](LICENCE)





4 changes: 2 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
def create_app():
app = Flask(__name__)

@app.route('/health', methods=['GET'])
@app.route('/healthcheck/ready', methods=['GET'])
def health_check():
"""Simple health check endpoint."""
return jsonify({"status": "healthy"}), 200
return "Application OK", 200

@app.route('/extract', methods=['GET'])
async def extract_quotes():
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dependencies = [
"s3fs>=0.4.2",
"opensearch-py>=2.8.0",
"requests-aws4auth>=1.3.1",
"flask[async]>=3.0.0",
"flask[async]==3.1.2",
"waitress>=3.0.0",
]

Expand Down
Empty file added tests/__init__.py
Empty file.
19 changes: 19 additions & 0 deletions tests/test_routes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import pytest
import importlib
import sys
from werkzeug.test import Client
from werkzeug.wrappers import Response

def _app_module():
return importlib.import_module("app")


def _client():
return Client(_app_module().create_app(), Response)

def test_healthcheck_ready_route():
response = _client().get("/healthcheck/ready")

assert response.status_code == 200
body = response.get_data(as_text=True)
assert 'Application OK' in body
161 changes: 161 additions & 0 deletions uv.lock

Large diffs are not rendered by default.

Loading