Skip to content

#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere

3.6 KB
Raw Blame
[project]
name = "engine"
version = "0.1.0"
description = "Stirling PDF Python projects"
requires-python = ">=3.13,<3.14"
dependencies = []

[dependency-groups]
# Runtime dependencies for the AI document engine service.
engine = [
    "cryptography>=50.0.2",
    "fastapi>=0.162.2",
    "opentelemetry-sdk>=1.45.2",
    "pgvector>=0.5.0",
    "posthog>=7.53.0",
    "psycopg[binary,pool]>=3.3.6",
    "pydantic>=2.13.5",
    # Keep the supported 1.x API while including its security backports.
    # Explicit extras: the `pydantic-ai` meta-package pulls all 20 providers (~230MB).
    # No `voyageai` extra either; stirling.documents.voyage speaks its API directly.
    "pydantic-ai-slim[anthropic,openai]>=1.107.9,<2.0.0",
    "pydantic-settings>=2.16.2",
    "python-dotenv>=1.2.3",
    # Lets the image's init script read aiEngine.enabled from settings.yml before starting us.
    "pyyaml>=6.0.3",
    "sqlite-vec>=0.1.9",
    "uvicorn>=0.52.4",
]
# Type checking, testing, model generation, and formatting tools for the engine.
engine-dev = [
    "anyio>=4.14.2",
    "datamodel-code-generator[ruff]==0.64.0",
    "pyrefly==1.4.1",
    "pytest>=9.1.1",
    "referencing>=0.37.0",
    "ruff==0.15.5",
]
# Dependencies for the Cucumber/Python integration test suite.
cucumber = [
    "behave>=1.3.3",
    "behave-html-formatter>=0.9.10",
    "opencv-python-headless>=5.0.0.93",
    "pdf2image>=1.17.0",
    "pillow>=13.0.0",
    "pypdf[crypto]>=6.19.0",
    "qrcode[pil]>=8.2",
    "reportlab>=5.1.0",
    "requests>=2.34.2",
]
# Shared Python utilities used by repository scripts and CI workflows.
tools = [
    "brotli>=1.2.1",
    "deep-translator>=1.11.4",
    "defusedxml>=0.7.1",
    "fpdf2>=2.9.0",
    "openai>=3.19.2",
    "requests>=2.34.2",
    "tomli-w>=1.2.0",
    "tomlkit>=0.15.2",
    "urllib3>=2.8.0",
    "unoserver>=3.7",
    "weasyprint>=70.0",
]
# Release-signature verification dependencies.
updater-signatures = [
    "cryptography>=50.0.2",
]
# Pinned repository-wide pre-commit tooling.
pre-commit = [
    "codespell==2.4.3",
    "ruff==0.15.5",
    "tomli-w==1.2.0",
]

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.build.targets.wheel]
packages = ["src"]
exclude = ["tests"]

[tool.uv]
default-groups = []

[tool.ruff]
line-length = 120
target-version = "py313"

[tool.ruff.lint]
select = [
    "E",
    "F",
    "I",
    "N",
    "W",
    "RUF100",
    "UP",
    "PYI", # flake8-pyi: flags deprecated typing constructs
    "FA",  # flake8-future-annotations: flags missing future annotations imports
    "BLE", # flake8-blind-except: flags bare `except Exception`
]

[tool.ruff.lint.isort]
known-first-party = ["stirling", "tests"]

[tool.pytest.ini_options]
testpaths = ["tests"]
# ``tests`` is on the path so test modules can import shared helpers (e.g.
# ``from conftest import build_app_settings``) without packaging the tests dir.
pythonpath = ["src", "tests"]
# Use importlib import mode so test directories don't need __init__.py files
# and duplicate basenames (e.g. multiple test_routes.py) collect cleanly.
addopts = "--import-mode=importlib"

[tool.pyrefly]
python-version = "3.13.0"
search-path = [
    "src",
    "tests",
]
# Disallow `type: ignore` comments to encourage accurate error codes to be used in ignore comments
# Pyrefly won't flag `type: ignore [wrong-code]`, but it will flag `pyrefly: ignore [wrong-code]`
enabled-ignores = ["pyrefly"]
min-severity = "warn"

[tool.pyrefly.errors]
deprecated = "warn"
implicit-any = "warn"
redundant-cast = "warn"
unused-ignore = "warn"
# TODO: Add equivalents to:
#  - reportImportCycles
#  - reportUnusedImport