Skip to content

ministryofjustice/laa-civil-case-api

Folders and files

NameName
Last commit message
Last commit date
Nov 14, 2024
Dec 24, 2024
Dec 2, 2024
Dec 24, 2024
Dec 23, 2024
Dec 24, 2024
Dec 24, 2024
Aug 23, 2024
Aug 23, 2024
Nov 4, 2024
Nov 14, 2024
Dec 17, 2024
Jul 29, 2024
Oct 23, 2024
Aug 2, 2024
Oct 17, 2024
Nov 22, 2024
Dec 18, 2024
Jul 18, 2024
Aug 27, 2024
Aug 23, 2024

Repository files navigation

LAA Civil Case API

Standards Icon

Running the API

It is recommended to use Docker to run the app and database.

./run_local.sh

This command:

  • Builds the containers for the app and database
  • Migrates the database to the latest version
  • Reloads the app whenever changes are made within the /app directory

The API docs can then be found at: localhost:8027

If you run into any isues please see TROUBLESHOOT.md.


Adding an authorised user

An authorised user is created as part of the run_local script. The created user will have the username cla_admin and password of cla_admin.

Running in a virtual environment

If you wish to run the app in a virtual environment you can do so with:

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements/generated/requirements-development.txt

Running the API

To migrate the database to the latest revision run:

alembic upgrade head

To run the web server run:

uvicorn app:case_api --reload

Tests

To install testing dependencies run:

pip install -r requirements/generated/requirements-testing.txt

Tests are managed using Pytest and can be run by using:

pytest

All tests use a mocked user that circumvents the authorisation.

For information on writing tests please see here.

Code formatting and linting

The following will:

  • Generate requirement.txt files from files inside requirements/source/.in and put them into requirements/generated/.txt
  • Run linting checks with ruff
  • Run secret detection via trufflehog3
pre-commit install

Manually running linting

The Ruff linter looks for code quality issues. Ensure there are no ruff issues before committing.

To lint all files in the directory, run:

ruff check

To format all files in the directory, run:

ruff format

Manually running secret detection

The trufflehog3 package looks for any exposed secrets in your project.

To use trufflehog on your current project, run:

trufflehog3 filesystem .

Development

For information on how to contribute please see the following: