diff --git a/.github/actions/setup-python/action.yml b/.github/actions/setup-python/action.yml index a6d0565..057b05e 100644 --- a/.github/actions/setup-python/action.yml +++ b/.github/actions/setup-python/action.yml @@ -9,10 +9,10 @@ runs: with: python-version: '3.11' cache: 'pip' - cache-dependency-path: 'requirements-dev.txt' + cache-dependency-path: 'pyproject.toml' - name: Instalar dependencias shell: bash run: | python -m pip install --upgrade pip - pip install -r requirements-dev.txt + pip install -e '.[dev]' diff --git a/Dockerfile b/Dockerfile index 7ccdfda..dc7c091 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,10 +15,10 @@ RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-reco gcc \ && rm -rf /var/lib/apt/lists/* -# Copiar requirements e instalar dependencias -COPY requirements.txt . +# Copiar pyproject y usarlo para instalar dependencias +COPY pyproject.toml . RUN pip install --upgrade pip setuptools wheel && \ - pip install --no-cache-dir -r requirements.txt + pip install --no-cache-dir . # Stage 2: Runtime FROM python:3.11-slim-bookworm diff --git a/docs/development.md b/docs/development.md index d21e0ab..d1fafe6 100644 --- a/docs/development.md +++ b/docs/development.md @@ -17,10 +17,8 @@ python -m venv .venv # Unix source .venv/bin/activate # Instalar dependencias - -pip install -r requirements.txt -# o -pip install -r requirements-dev.txt +python -m pip install --upgrade pip +pip install -e '.[dev]' # Levantar Redis para desarrollo docker run -d -p 6379:6379 redis:7-alpine diff --git a/pyproject.toml b/pyproject.toml index 84de913..bef891c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,46 @@ +[build-system] +requires = ["setuptools>=61.0", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "modelrouter" +version = "0.1.0" +description = "API asíncrona para orquestación multi-proveedor de LLM con streaming y fallback automático." +readme = "README.md" +license = { text = "Apache-2.0" } +authors = [ + { name = "HC-ONLINE" } +] +requires-python = ">=3.11" +dependencies = [ + "fastapi==0.115.6", + "uvicorn[standard]==0.34.0", + "pydantic==2.10.6", + "pydantic-settings==2.7.1", + "httpx==0.26.0", + "redis==5.0.1", + "hiredis==2.3.2", + "prometheus-client==0.19.0", + "python-json-logger==2.0.7", + "python-dotenv==1.0.0", + "python-multipart==0.0.22", +] + +[project.optional-dependencies] +dev = [ + "black==24.10.0", + "flake8==7.1.1", + "pre-commit==4.0.1", + "mypy==1.13.0", + "types-redis==4.6.0.20240425", + "types-requests==2.31.0.20240125", + "typing-extensions==4.12.2", + "pytest==8.3.4", + "pytest-asyncio==0.24.0", + "pytest-cov==6.0.0", + "pytest-mock==3.14.0", +] + [tool.black] line-length = 88 target-version = ['py311'] diff --git a/requirements-dev.txt b/requirements-dev.txt deleted file mode 100644 index 2d44ca3..0000000 --- a/requirements-dev.txt +++ /dev/null @@ -1,25 +0,0 @@ -# Dependencias de desarrollo y CI --r requirements.txt - -# Linting y formato -black==24.10.0 -flake8==7.1.1 -pre-commit==4.0.1 -setuptools>=75.5.0 -wheel>=0.46.2 - -# Type checking -mypy==1.13.0 -types-redis==4.6.0.20240425 -types-requests==2.31.0.20240125 -typing-extensions==4.12.2 - -# Instalar stubs inline para las bibliotecas que no los tienen -fastapi # Tiene stubs propios -pydantic # Tiene stubs propios - -# Testing -pytest==8.3.4 -pytest-asyncio==0.24.0 -pytest-cov==6.0.0 -pytest-mock==3.14.0 diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 46817ab..0000000 --- a/requirements.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Core -fastapi==0.115.6 -uvicorn[standard]==0.34.0 -pydantic==2.10.6 -pydantic-settings==2.7.1 - -# HTTP Client -httpx==0.26.0 - -# Redis -redis==5.0.1 -hiredis==2.3.2 - -# Observabilidad -prometheus-client==0.19.0 -python-json-logger==2.0.7 - -# Utilidades -python-dotenv==1.0.0 -python-multipart==0.0.22