This project makes use of several excellent tools from Astral, including uv, ruff, and ty.
- Once you have installed
uv, install dependencies with
uv sync- Install the pre-commit hooks using
uv run pre-commit autoupdate
uv run pre-commit install --install-hooks- VS Code will prompt you to install the recommended extensions, which you should accept. If you mistakenly closed it, you can find them in
.vscode/extensions.json.
- Format:
uv run ruff format - Typecheck:
uv run ty check - Lint:
uv run ruff check
To run the FastAPI app locally with uv (the project uses uv for task execution), run:
uv run python src/main.pyYou can set the PORT environment variable to change the listening port (defaults to 5000):
PORT=8080 uv run python src/main.pyYou should not globally disable rules enforced by ruff or ty. If absolutely necessary, you can ignore them on a line-by-line basis:
For ty, use ignore directives in the following order of precedence, based on what is strictly necessary.
# ty: ignore[<rule>]for ignoring single rules# ty: ignore[rule1, rule2, ...]for ignoring multiple rules# type: ignoreor# type: ignore[<rule>]for ignoring all violations on that line (even if a rule is specified!)- The decorator
@typing.no_type_checkto suppress all violations inside a function
For ruff, follow the same pattern.
# noqa: <rule>for ignoring single rules# noqa: rule1, rule2, ...for ignoring multiple rules# noqafor ignoring all violations on that line# ruff: noqa: <rule>for ignoring a specific rule across an entire file# ruff: noqafor ignoring all violations across an entire file