Skip to content
Closed
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
38 changes: 9 additions & 29 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ on:
branches: ['*']
permissions:
contents: read
env:
POETRY_VERSION: '2.2.1'

jobs:
environment:
Expand Down Expand Up @@ -49,26 +47,17 @@ jobs:
- name: Checkout github repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1

- name: Install Poetry
uses: snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a # v1.4.1
with:
version: ${{ env.POETRY_VERSION }}
virtualenvs-create: true
virtualenvs-in-project: true
- name: Setup Python
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
cache: 'poetry'
cache-dependency-path: 'backend/poetry.lock'
python-version-file: 'backend/.python-version'
- name: Install uv
uses: astral-sh/setup-uv@v7

- name: Install dependencies
working-directory: ./backend
run: poetry install --no-interaction --with test
run: uv sync

- name: Run the automated tests
working-directory: ./backend
id: run-test
run: poetry run pytest -v --cov=app --cov-report=term --cov-report=xml tests/
run: uv run pytest -v --cov=app --cov-report=term --cov-report=xml tests/
- name: Ensure 100% coverage for router files
working-directory: ./scripts
run: ./check_coverage.sh
Expand Down Expand Up @@ -102,21 +91,12 @@ jobs:
- name: Git checkout
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1

- name: Install Poetry
uses: snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a # v1.4.1
with:
version: ${{ env.POETRY_VERSION }}
virtualenvs-create: true
virtualenvs-in-project: true
- name: Setup Python
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
cache: 'poetry'
cache-dependency-path: 'backend/poetry.lock'
python-version-file: 'backend/.python-version'
- name: Install uv
uses: astral-sh/setup-uv@v7

- name: Install Python dependencies
working-directory: backend
run: poetry install --no-interaction
run: uv sync

- name: Setup Node.js
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
Expand Down
29 changes: 9 additions & 20 deletions backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

- Install [Python 3.13](https://www.python.org/downloads) on your machine.

### Poetry
### UV

- Install [Poetry](https://python-poetry.org/docs/#installation) on your machine.
- Install [uv](https://docs.astral.sh/uv/getting-started/installation/) on your machine.
- Make sure it is available on your PATH.

### Configuration (.env file)
Expand All @@ -40,11 +40,11 @@ HOST=http://localhost:3000/

### Installation

In order to install all project dependencies using poetry,
In order to install all project dependencies using uv,
open the 'backend' directory as a workspace in your favorite IDE and execute the command below.

```sh
poetry install
uv sync
```

### Starting required services
Expand All @@ -60,7 +60,7 @@ docker compose up -d postgresql mailhog
In order to initialize your database with the correct structure, execute the command below from the backend folder.

```sh
poetry run python -m app.db_tool init "sample_data.sql"
uv run python -m app.db_tool init "sample_data.sql"
```

This populates the database with sample data from [sample_data.sql](sample_data.sql) .
Expand All @@ -72,7 +72,7 @@ the [sample_data.sql](sample_data.sql) file and reference that one in the comman
In order to run the project in development mode, after initializing the database, execute the command below.

```sh
poetry run python -m app.local_startup
uv run python -m app.local_startup
```

:tada:
Expand All @@ -85,16 +85,6 @@ Install Claude Desktop and run `poetry run fastmcp install claude-desktop app/re

## Development utilities

### Including the virtual environment in your IDE

- Execute the command below to display the location of your virtual environment.

```sh
poetry env info --path
```

- You can use this location to pass in your IDE to be able to run the source code from your IDE and to resolve all imports.

### Data

A small CLI tool is delivered to enable database setup / migrations.
Expand All @@ -108,7 +98,7 @@ If you want to completely destroy and recreate the database when performing the
you should specify the '--force' option.

```sh
python -m app.db_tool init --force "sample_data.sql"
uv run python -m app.db_tool init --force "sample_data.sql"
```

### Database migrations
Expand All @@ -120,7 +110,7 @@ This comes down to running `alembic revision -m "{your message}"` in the `/backe
In order to apply this migration using the database CLI tool you need to execute the command below.

```sh
python -m app.db_tool migrate
uv run python -m app.db_tool migrate
```

## Testing
Expand All @@ -130,9 +120,8 @@ python -m app.db_tool migrate
To run the integration tests, execute the following commands:

```sh
poetry install --with test
docker compose --file test-compose.yaml up
poetry run pytest -v
uv run pytest -v
```

It will install test dependencies, boot up the test database and run the tests.
Expand Down
Loading