The HTTP API used by http://playground.allenai.org
To start a local server, run:
```sh
sh ./bin/bootstrap
```
then run:
```sh
docker compose up --build --watch
```
This project uses uv. To run it locally, follow their installation guide.
After uv is installed, run just install at the root of this project.
We use uv's workspaces to split code into larger chunks.
To add a new package, cd to packages and run uv init --lib --package package-name. Make sure you run uv add package-name --package <DEPENDENT_PACKAGE> for any packages that depend on it.
To add a new app, cd to apps and run uv init app-name.
FastAPI app uses pydandantic settings to load settings, it has default values set in ./apps/api/src/api/config.py and loads
environment variables from .env, .env.local, .env.${ENV} and .env.${ENV}.local, with .local files being ignored
Public configuration variables should be stored in non-gitignored configs, with env agnostic configs in .env.
Secrets should be stored in .env.local (or .env.${ENV}.local) file.
The API uses a local database for persistence. If you'd like to delete all data or reapply the schema, run:
docker compose down --volumes && docker compose up --build
To run the unit tests, run:
just testTo check types:
just type-checkTo run the formatter / linter:
just formatTo just check without making changes to the files:
uv run ruff format --checkTo check for linting issues in fastapi:
just lintstart the postgres container with docker compose up db
Make sure you've installed packages and activated the environment with just install
Start the server by running just dev
Ensure you have the Python Extension installed.
Instead of starting the server with the python command above, launch the Python Debugger: FastAPI debug task in VSCode's debug menu.
run openapi-python-client generate --url https://infinigram-api.allen.ai/openapi.json --overwrite
copy the infini_gram_api_client folder from the generated code into src/attribution/infini_gram_api_client