<# HMPPS Person Match API
An API wrapper around a model developed by the MoJ Analytical Platform for scoring the confidence of people matches across MoJ systems.
- Python 3.14
- uv
curl -LsSf https://astral.sh/uv/0.9.7/install.sh | shKeep uv up to date by running uv self update to make sure it matches the version specified in the Dockerfile
If you need to update a transitive dependency (for example to fix a security vulnerability), do this:
- make sure you are on the latest version of uv
uv lock --upgrade-package <package-name>==<package-version>
This should result in a small change to the lockfile updating the transitive dependency to the desired version.
To install the dependencies and setup the virtual environment, run the following command:
make installTo start the development server locally, run the following command:
make run-localUtilises hot reloading so you can make changes to the application without having to restart the server.
Which means you can now call the locally running application.
Calling the health endpoint:
curl -i \-H "Content-Type: application/json" http://127.0.0.1:5000/healthTo run the test suite run the following command:
make testTo run the integration tests run the following command:
make test-integrationWe have enabled debugpy when running the containers locally to enable debug support. To attach the applications
debugger create the following .vscode task within the .vscode/launch.json, create the file if you don't already have it:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Remote Attach",
"type": "debugpy",
"request": "attach",
"connect": {
"host": "localhost",
"port": 5678
},
"justMyCode": true,
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "/app"
}
]
}
]
}When the containers are running using the command make start-containers you can run the following task and set breakpoints with the code to begin debugging.
To test this is working as expected:
- Setting a breakpoint on the health endpoint in health_view.py
- Running the command:
curl http://0.0.0.0:5000/health
It should stop execution at the set breakpoint to allow you to start stepping through the code.
To run the linter, run the following command:
make lintIf any errors are auto fixable run the following command:
make lint-fixTo run the automatic python file formatter, run the following command:
make formatTo build the application as a Docker image, run the following command:
make buildApplication Insights monitoring is available for the service using the cloud_RoleName specified below:
requests
| where cloud_RoleName == 'hmpps-person-match'