Skip to content

Commit

Permalink
Merge pull request #68 from uktrade/feature/add-model-api-2
Browse files Browse the repository at this point in the history
Add API endpoints for models and results
  • Loading branch information
wpfl-dbt authored Feb 14, 2025
2 parents 8ccf377 + 7b1f91f commit d20e24c
Show file tree
Hide file tree
Showing 30 changed files with 2,078 additions and 671 deletions.
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.2.0",
"version": "0.2.1",
"configurations": [
{
"name": "Matchbox: Debug",
Expand Down
4 changes: 2 additions & 2 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ docker compose up -d --wait

We have a VSCode default debugging profile called "API debug", which allows to e.g. set breakpoints on the API when running tests. After running this profile, change your `.env` file as follows:

- change the `MB__CLIENT__API_ROOT` variable to redirect tests to use the debug port (8080)
- disable time-outs by commenting out the `MB__CLIENT__TIMEOUT` variable
- Change the `MB__CLIENT__API_ROOT` variable to redirect tests to use the debug port (8080)
- Disable time-outs by commenting out the `MB__CLIENT__TIMEOUT` variable

## Standards

Expand Down
3 changes: 2 additions & 1 deletion environments/dev_docker.env
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ MB__POSTGRES__DATABASE=matchbox
MB__POSTGRES__DB_SCHEMA=mb

MB__CLIENT__API_ROOT=http://localhost:8000
MB__CLIENT__TIMEOUT=10
MB__CLIENT__TIMEOUT=10
MB__CLIENT__RETRY_DELAY=2
3 changes: 2 additions & 1 deletion environments/dev_local.env
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ MB__POSTGRES__DATABASE=matchbox
MB__POSTGRES__DB_SCHEMA=mb

MB__CLIENT__API_ROOT=http://localhost:8000
MB__CLIENT__TIMEOUT=10
MB__CLIENT__TIMEOUT=10
MB__CLIENT__RETRY_DELAY=2
3 changes: 2 additions & 1 deletion environments/sample.env
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ MB__POSTGRES__DATABASE=
MB__POSTGRES__DB_SCHEMA=

MB__CLIENT__API_ROOT=
MB__CLIENT__TIMEOUT=
MB__CLIENT__TIMEOUT=
MB__CLIENT__RETRY_DELAY=
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,9 @@ log_cli = false
log_cli_level = "INFO"
log_cli_format = "%(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s)"
log_cli_date_format = "%Y-%m-%d %H:%M:%S"
asyncio_mode = "strict"
asyncio_default_fixture_loop_scope = "function"
filterwarnings = [
'ignore:.*__fields.*:pydantic.PydanticDeprecatedSince20:unittest.mock',
'ignore:.*__fields_set__.*:pydantic.PydanticDeprecatedSince20:unittest.mock'
]
16 changes: 9 additions & 7 deletions src/matchbox/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
from dotenv import find_dotenv, load_dotenv

from matchbox.client.helpers.cleaner import process
from matchbox.client.helpers.index import index
from matchbox.client.helpers.selector import match, query
from matchbox.client.models.models import make_model

__all__ = ("make_model", "process", "query", "match", "index")

dotenv_path = find_dotenv(usecwd=True)
load_dotenv(dotenv_path)

# Environment variables must be loaded first for other imports to work

from matchbox.client.helpers.cleaner import process # NoQA: E402
from matchbox.client.helpers.index import index # NoQA: E402
from matchbox.client.helpers.selector import match, query # NoQA: E402
from matchbox.client.models.models import make_model # NoQA: E402

__all__ = ("make_model", "process", "query", "match", "index")
Loading

0 comments on commit d20e24c

Please sign in to comment.