-
Install uv (a Python package and project manager), following the instructions outlined on their website.
-
Ensure you have Python 3.14 installed. If you don't already have a means of managing Python versions, this can be accomplished directly with
uv:uv python install 3.14
-
Install all project dependencies, as outlined in
pyproject.toml:uv sync --frozen
-
(Optional) Create a
.envfile from thesample.env, if you'd like to configure the application's port or host during local development (particularly helpful if you're running outside of Docker). NOTE: You'll need to manually load the env (export $(xargs <.env)), add--env-file .envtouvcommands, or install and configure direnv (or an equivalent shell extension) in order to make these environment variables available to the application.cp sample.env .env
-
Have the NBS MSSQL database running and make sure the env vars in this workspace are correct for that DB (
sample.envvalues should match). Using thecdc-sandboxdocker compose is a good/opinionated way to do this# from a dedicated terminal at the repo root cd cdc-sandbox # create .env if it doesn't exist ./check_env.sh # run the database docker compose up nbs-mssql
-
Start the FastAPI development server with Uvicorn (the default ASGI server program shipped with FastAPI):
uv run uvicorn src.main:app
The application will be available at:
- API: http://localhost:8001
- Interactive API docs (Swagger UI): http://localhost:8001/docs
- Alternative API docs (ReDoc): http://localhost:8001/redoc
Sample curl:
curl -X POST 'http://localhost:8001/report/execute' -H "accept: application/json" -H "Content-Type: application/json" -d '{
"version": 1,
"is_export": true,
"is_builtin": true,
"report_title": "Test Report",
"library_name": "nbs_custom",
"data_source_name": "random_db_table_0",
"subset_query": "SELECT * FROM test"
}'Unit testing for this project is currently handled with pytest. To invoke the unit test suite, simply run the following:
uv run pytest -m "not integration"Or something similar to the following, if you're looking to run a specific test suite:
uv run pytest src/main_test.pyTo run integration tests, ensure the .env is loaded or passed to uv and run
uv run pytest # all tests
uv run pytest -m integration # just integration tests
uv run --env-file .env pytest # pass env file to uvAdditionally, this project uses Ruff (also created by Astral, the makers of uv) for linting and formatting and Pyrefly for type checking.
In order to check for existing linter issues, run:
uv run ruff checkTo automatically address any auto-fixable linter issues, run:
uv run ruff check --fixRun the formatter with the following:
uv run ruff formatRun the type checker with the following:
uv run pyrefly check