chore: switch to ruff + pydoclint, deprecate .gitingest, and perform a repo-wide quality sweep (#329)
Some checks failed
CI / test (macos-latest, 3.10) (push) Has been cancelled
CI / test (macos-latest, 3.11) (push) Has been cancelled
CI / test (macos-latest, 3.12) (push) Has been cancelled
CI / test (macos-latest, 3.13) (push) Has been cancelled
CI / test (macos-latest, 3.8) (push) Has been cancelled
CI / test (macos-latest, 3.9) (push) Has been cancelled
CI / test (ubuntu-latest, 3.10) (push) Has been cancelled
CI / test (ubuntu-latest, 3.11) (push) Has been cancelled
CI / test (ubuntu-latest, 3.12) (push) Has been cancelled
CI / test (ubuntu-latest, 3.13) (push) Has been cancelled
CI / test (ubuntu-latest, 3.8) (push) Has been cancelled
CI / test (ubuntu-latest, 3.9) (push) Has been cancelled
CI / test (windows-latest, 3.10) (push) Has been cancelled
CI / test (windows-latest, 3.11) (push) Has been cancelled
CI / test (windows-latest, 3.12) (push) Has been cancelled
CI / test (windows-latest, 3.13) (push) Has been cancelled
CI / test (windows-latest, 3.8) (push) Has been cancelled
CI / test (windows-latest, 3.9) (push) Has been cancelled
OSSF Scorecard / Scorecard analysis (push) Has been cancelled

* **Pre-commit**: replace `black` & `darglint` with `ruff-check` / `ruff-format`;
  add `pydoclint` for docstring quality
* **Deps**: drop `tomli`; tighten `typing_extensions`; add `eval-type-backport`;
  remove `black`, `djlint`, `pylint` from `requirements-dev`
* **Ignore files**: deprecate TOML-based `.gitingest`; introduce
  `.gitingestignore` (git-wildmatch, parsed via `_parse_ignore_file`)
* **Config**: new unified `[tool.ruff]` (lint + format + isort); delete
  `[tool.black]`, keep minimal `[tool.isort]` for now
* **Refactor/style**: adopt `from __future__ import annotations`, kw-only args,
  richer types; reorder params & `__all__`; move type-only imports under
  `if TYPE_CHECKING`; extract `_CLIArgs` `TypedDict`, migrate form data to
  `pydantic.QueryForm`; deduplicate `cli.main` / `_async_main`; use `pathlib`,
  avoid file-IO in async; replace magic numbers with constants; delete
  `is_text_file` (logic now lives in `FileSystemNode.content`)
* **Bug fix**: remove silent error in `notebook_utils._process_cell`
* **Docs**: refresh README badges
* **Tests**: update fixtures & assertions

**BREAKING**: new `.gitingestignore` file replaces (now-deprecated) `.gitingest`.

No functional API or CLI changes.
This commit is contained in:
Filip Christiansen 2025-06-28 18:49:37 +02:00 committed by GitHub
parent b39ef5416c
commit 2f447ae632
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
54 changed files with 1767 additions and 1518 deletions

View file

@ -1,8 +1,9 @@
"""Main module for the FastAPI application."""
from __future__ import annotations
import os
from pathlib import Path
from typing import Dict
from dotenv import load_dotenv
from fastapi import FastAPI, Request
@ -45,22 +46,21 @@ app.add_middleware(TrustedHostMiddleware, allowed_hosts=allowed_hosts)
@app.get("/health")
async def health_check() -> Dict[str, str]:
"""
Health check endpoint to verify that the server is running.
async def health_check() -> dict[str, str]:
"""Health check endpoint to verify that the server is running.
Returns
-------
Dict[str, str]
dict[str, str]
A JSON object with a "status" key indicating the server's health status.
"""
return {"status": "healthy"}
@app.head("/")
async def head_root() -> HTMLResponse:
"""
Respond to HTTP HEAD requests for the root URL.
"""Respond to HTTP HEAD requests for the root URL.
Mirrors the headers and status code of the index page.
@ -68,6 +68,7 @@ async def head_root() -> HTMLResponse:
-------
HTMLResponse
An empty HTML response with appropriate headers.
"""
return HTMLResponse(content=None, headers={"content-type": "text/html; charset=utf-8"})
@ -75,8 +76,7 @@ async def head_root() -> HTMLResponse:
@app.get("/api/", response_class=HTMLResponse)
@app.get("/api", response_class=HTMLResponse)
async def api_docs(request: Request) -> HTMLResponse:
"""
Render the API documentation page.
"""Render the API documentation page.
Parameters
----------
@ -87,32 +87,33 @@ async def api_docs(request: Request) -> HTMLResponse:
-------
HTMLResponse
A rendered HTML page displaying API documentation.
"""
return templates.TemplateResponse("api.jinja", {"request": request})
@app.get("/robots.txt")
async def robots() -> FileResponse:
"""
Serve the `robots.txt` file to guide search engine crawlers.
"""Serve the ``robots.txt`` file to guide search engine crawlers.
Returns
-------
FileResponse
The `robots.txt` file located in the static directory.
The ``robots.txt`` file located in the static directory.
"""
return FileResponse("static/robots.txt")
@app.get("/llm.txt")
async def llm_txt() -> FileResponse:
"""
Serve the `llm.txt` file to provide information about the site to LLMs.
"""Serve the ``llm.txt`` file to provide information about the site to LLMs.
Returns
-------
FileResponse
The `llm.txt` file located in the static directory.
The ``llm.txt`` file located in the static directory.
"""
return FileResponse("static/llm.txt")