Přeskočit obsah

Backend balíčky — license review

Detailní přehled Python závislostí s licenčním review pro produkční nasazení (komerční prodej OK?).

Metodika

Reviewovány jsou direct dependencies z pyproject.toml + jejich licence. Transitive dependencies jsou generally trusted — pokud direct dep je OK-licensed, jeho transitive závislosti jsou tlačené přes maintainerovy compatibility checks.

Souhrn licencí

Licence Komerční použití OK? Naše balíčky
MIT ✅ Plně, žádné restrikce FastAPI, Pydantic AI, taskiq, slowapi, pytest, ruff, ...
BSD-3-Clause ✅ Plně, attribution required trafilatura, beautifulsoup4, cryptography, ...
Apache 2.0 ✅ Plně, attribution + NOTICE preserve uvicorn, redis, pyjwt, supabase, cohere, requests, ...
ISC ✅ Plně (BSD-equivalent) python-magic
PSF / Python-2.0 ✅ Plně typing-extensions a další stdlib backports
MPL 2.0 ✅ s caveat (file-level copyleft) (žádné v naší závislosti)
LGPL ⚠️ OK jako lib, ne static embed (žádné v naší závislosti)
GPL / AGPL ❌ Copyleft, blokovací (žádné v naší závislosti)

Závěr: Všechny direct backend dependencies jsou MIT / BSD / Apache 2.0 — plně OK pro komerční SaaS prodej. Žádné GPL/AGPL ani problematic licence.

Direct dependencies (pyproject.toml)

Core framework

fastapi>=0.135.0

uvicorn[standard]>=0.32.0

  • License: BSD-3-Clause
  • Účel: ASGI server
  • Repo: https://github.com/encode/uvicorn
  • Production-safe: ✅
  • [standard] extras: httptools, uvloop, python-dotenv, watchfiles — all MIT/BSD.

python-multipart>=0.0.12

  • License: Apache 2.0
  • Účel: multipart/form-data parsing pro FastAPI uploads
  • Production-safe: ✅

httpx>=0.27.0

Auth + crypto

pyjwt[crypto]>=2.10.0

  • License: MIT
  • Účel: JWT verify/sign
  • Repo: https://github.com/jpadilla/pyjwt
  • [crypto] pulls: cryptography (Apache 2.0) — RS256/ES256 support
  • Production-safe: ✅
  • Volba: PyJWT vs python-jose. Doporučované Supabase, menší attack surface.

cachetools>=5.5.0

  • License: MIT
  • Účel: JWKS cache (1h TTL)
  • Production-safe: ✅

Pydantic + AI

pydantic-ai[google]>=0.0.14

  • License: MIT
  • Účel: Type-safe LLM Agent abstrakce
  • Repo: https://github.com/pydantic/pydantic-ai
  • Production-safe: ✅
  • Pozn.: Pydantic Inc. (od těchhle lidí Pydantic). Production-ready, používá ho hodně teamů.
  • [google] extras: pulls google-genai SDK
  • Aktuální verze: 1.81 (newer than min)

pydantic-settings>=2.6.0

  • License: MIT
  • Účel: Pydantic-based config s ENV var parsing
  • Production-safe: ✅

Database + Storage

supabase>=2.9.0

Background tasks

taskiq>=0.11.0

taskiq-redis>=1.0.0

  • License: MIT
  • Účel: Redis broker pro taskiq (Streams)
  • Production-safe: ✅

taskiq-fastapi>=0.3.5

  • License: MIT
  • Účel: Integrace taskiq s FastAPI lifecycle
  • Production-safe: ✅

redis>=5.0.0

  • License: MIT
  • Účel: Redis Python client (sync + async)
  • Production-safe: ✅

Rate limiting

slowapi>=0.1.9

limits[redis]>=3.9.0

  • License: MIT
  • Účel: slowapi backend
  • Production-safe: ✅

Phase B — ingestion

mistralai>=1.5.0

python-magic>=0.4.27

  • License: MIT
  • Účel: libmagic Python wrapper (MIME detection)
  • Repo: https://github.com/ahupp/python-magic
  • Production-safe: ✅
  • Pozn.: NE fork cdd/libmagic (mrtvý od 2017). Wrapuje upstream libmagic.so.1 (file/file project, BSD-2-Clause).
  • System lib: libmagic1 (BSD) — instalovaný přes apt-get v Dockerfile.

python-docx>=1.1.0

beautifulsoup4>=4.12.0

  • License: MIT
  • Účel: HTML/MHTML parsing (port z v1)
  • Production-safe: ✅

trafilatura>=2.0.0

Phase C — retrieval

cohere>=5.13.0

Misc

pyyaml>=6.0.2

  • License: MIT
  • Účel: YAML parsing (config, prompts)
  • Production-safe: ✅

Klíčové transitive dependencies (přes direct deps)

google-genai==1.73.0

  • License: Apache 2.0
  • Pulled by: pydantic-ai[google]
  • Účel: Gemini 3 Flash + Embedding 2 SDK
  • Production-safe: ✅
  • Pozn.: Google maintained.

cryptography==46.x

  • License: Apache 2.0 + BSD-3-Clause (dual)
  • Pulled by: pyjwt[crypto]
  • Účel: RSA/ECDSA signature verification (JWT JWKS)
  • Production-safe: ✅
  • Pozn.: Maintained by PyCA (Python Cryptography Authority).

httptools==0.7.x

  • License: MIT
  • Pulled by: uvicorn[standard]
  • Účel: Fast HTTP/1.1 parser (Node.js fork)
  • Production-safe: ✅

uvloop==0.22.x

  • License: MIT or Apache 2.0 (dual)
  • Pulled by: uvicorn[standard]
  • Účel: libuv-based event loop (rychlejší než asyncio default)
  • Production-safe: ✅

pgvector (Postgres extension)

pgtap (test only, Postgres extension)

  • License: MIT-like
  • Použití: Unit testing Postgres
  • Production-safe: ✅ (test only, no runtime impact)

cohere SDK transitive: tokenizers

  • License: Apache 2.0 (Hugging Face)
  • Production-safe: ✅

cohere SDK transitive: tiktoken

  • License: MIT (OpenAI)
  • Production-safe: ✅

pydantic-ai transitive: openai, anthropic, groq, mistralai, xai-sdk

  • Licenses: All MIT or Apache 2.0
  • Pozn.: pydantic-ai pulls multi-provider SDKs jako optional extras. My používáme jen Google provider, ale SDKs jsou nainstalované.
  • Production-safe: ✅
  • Optimization: pokud chcete šetřit image size (~50 MB), pydantic-ai supports surgical extras pydantic-ai-slim[google]. Aktuálně používáme full pydantic-ai[google].

Dev dependencies (pyproject.toml [dependency-groups] dev)

ruff>=0.8.0

  • License: MIT
  • Účel: Linter + formatter (Rust-based)
  • Production-safe: ✅ (dev only)

pytest>=8.3.0

  • License: MIT
  • Účel: Test framework
  • Production-safe: ✅ (dev only)

pytest-asyncio>=0.24.0

  • License: Apache 2.0
  • Účel: pytest plugin pro async test functions
  • Production-safe: ✅ (dev only)

System packages (Dockerfile)

libmagic1 (Debian package)

  • License: BSD-2-Clause (file/file project)
  • Účel: MIME detection (used by python-magic)
  • Production-safe: ✅
  • Pozn.: Fedora ekvivalent: file-libs. Aktivně udržováno (~150 commitů/rok).

License compliance checklist

Pro production deployment / komerční prodej:

  • Žádné GPL / AGPL dependencies
  • Všechny direct deps jsou MIT / BSD / Apache 2.0 (permissive)
  • Apache 2.0 dependencies — NOTICE preserve není potřeba (žádné NOTICE files v jejich repos)
  • BSD attribution OK (3-clause attribution clause splníme přes about page / docs)
  • Žádné CC-NC (non-commercial) licence
  • Žádné SSPL nebo Commons Clause (problematic pro SaaS)

Doporučená attribution stránka v produkčním frontu:

Tato aplikace používá následující open-source software:
- FastAPI, Pydantic AI, Supabase Python SDK (MIT)
- uvicorn, httpx, beautifulsoup4 (BSD-3-Clause)
- mistralai, trafilatura, google-genai, cryptography (Apache 2.0)
- ... (full list dostupný na requestu)

Plus copyright headers v Source v repu (LICENSE file copy z direct deps recommended pro Apache 2.0 specifikalně).

Auditní nástroje

Pro pravidelný license audit:

# Generate license report
uv pip install pip-licenses
uv run pip-licenses --format=markdown --output-file=LICENSES.md

# Check license compatibility
uv run pip-licenses --fail-on="GPL;AGPL;SSPL"

# Detailní per-pkg
uv run pip-licenses --with-urls --with-license-file

Doporučeno spustit při každém major dependency update.

Update strategy

  • Patch versions (X.Y.Z) — auto via Dependabot/Renovate
  • Minor versions (X.Y.0) — manuální review, especially pro AI SDKs (API changes)
  • Major versions (X.0.0) — pre-deploy testing + changelog review

uv.lock (commit do repa) zajistí reproducible builds — všichni dev mají stejné verze.

Bezpečnostní upozornění

  • Cryptography — kritická lib, monitorovat CVE
  • Mistral / Cohere / Gemini SDKs — vendor-controlled, žádné self-host alternativy. Vendor lock-in trade-off s rychlostí vývoje.
  • Supabase SDK — vendor SDK, ale Postgres pod ním je open-source standard

Doporučeno: dependabot s security alerts enabled na obou GitHub repos (nemoreport-ai-{backend,frontend}-v2).