A proof of concept API layer to manage content negotiation across IDPD resources and provide an abstraction to 3rd party data services.
This application uses pipenv to manage dependencies.
Install dependencies via pipenv sync --dev
Run the server via make start
If you want to browse the api content in your web browser (while developing only) then
export LOCAL_BROWSE_API=true
This will allow browser traffic despite mimetypes and will replace all staging.idpd.uk values with localhost:8000 to allow click through navigation.
To turn this off unset LOCAL_BROWSE_API.
There is a Makefile with some useful development helpers:
make testto run the unit tests.make fmtto format and lint your code.make datato create./out/seed.ttlwith data for the graph.make populateto populate a local oxigraph where one is running.make configure_devto enable client side git hooks for code quality (see following section).make startto start the api.
You can also just use a naked make to see your options.
Note: - with make test you'll need to first shut down any local oxigraph container you have running first as the tests currently spin one up using that same port.
This respisitory comes with two client side git hooks for code quality:
- pre-commit - runs black, isort and the ruff linter on your code
- pre-push - runs unit tests before pushing code to a remote branch
You can enable these via make configure_dev, you need to do this once (per fresh clone of this repo).
PR's to this codebase are required to have correct formatting and have passing unit tests, so if you don't use git hooks be sure to run these processes manually.
- run oxigraph locally via
docker-compose up -d(from the root of this directory) which runs oxigraph as a detached (in the background) container on http://localhost:7878. - use
docker-compose downto turn it off. - data will be persisted in the
./datadirectory. To start over delete this directory after youdocker-compose downand start again.
- Make sure you've installed dev dependencies via
pipenv sync --dev - Set an env var to sepcify the graph you're using
export GRAPH_DB_URL=http://localhost:7878 - run
make populate
This will populate ./out with ttl files created from the jsonld samples
used to power the stubbed metadata store.