Spaces:
Runtime error
Runtime error
Commit ·
3bc8f5a
0
Parent(s):
chore: configuración inicial del proyecto y tooling
Browse filesInicializa el manifiesto del MVP (pyproject con uv, ruff y pytest), el lockfile reproducible, la plantilla .env.example, los hooks de pre-commit y el .gitignore que excluye docs internos, secretos y pesos de modelo. El entorno se crea fuera de OneDrive con link-mode=copy.
- .env.example +22 -0
- .gitignore +117 -0
- .pre-commit-config.yaml +9 -0
- pyproject.toml +47 -0
- uv.lock +0 -0
.env.example
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ===== AgroVisión MVP — variables de entorno (plantilla) =====
|
| 2 |
+
# Copia este archivo a .env para desarrollo local. NO pongas secretos reales aquí.
|
| 3 |
+
|
| 4 |
+
APP_ENV=development
|
| 5 |
+
LOG_LEVEL=info
|
| 6 |
+
|
| 7 |
+
# --- UI (Shiny) ---
|
| 8 |
+
SHINY_PORT=8001
|
| 9 |
+
API_BASE_URL=http://localhost:8000 # En prod: URL pública del backend en Render
|
| 10 |
+
|
| 11 |
+
# --- Backend (FastAPI) ---
|
| 12 |
+
API_PORT=8000
|
| 13 |
+
ALLOWED_ORIGINS=http://localhost:8001,https://<tu-app>.shinyapps.io
|
| 14 |
+
CONFIDENCE_THRESHOLD=0.25
|
| 15 |
+
MAX_UPLOAD_MB=50
|
| 16 |
+
|
| 17 |
+
# --- Modelo de conteo (agnóstico; en STANDBY hasta publicar el artefacto) ---
|
| 18 |
+
COUNTING_ENABLED=false # true cuando el modelo esté publicado en HF Hub
|
| 19 |
+
MODEL_PATH=/app/models/agrovision-plantcount-v2.0.0.onnx
|
| 20 |
+
MODEL_VERSION=2.0.0
|
| 21 |
+
MODEL_ARCHITECTURE=yolo26n # yolo26n | rfdetr_nano (define el adaptador de decode)
|
| 22 |
+
HF_MODEL_REPO=<org>/agrovision-plantcount # repo de modelos en Hugging Face Hub
|
.gitignore
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ===== AgroVision =====
|
| 2 |
+
|
| 3 |
+
# --- Environment & Secrets ---
|
| 4 |
+
.env
|
| 5 |
+
.env.local
|
| 6 |
+
.env.*.local
|
| 7 |
+
*.secret
|
| 8 |
+
.pnpm-debug.log*
|
| 9 |
+
|
| 10 |
+
# --- Python & Backend ---
|
| 11 |
+
__pycache__/
|
| 12 |
+
.mypy_cache/
|
| 13 |
+
.pytest_cache/
|
| 14 |
+
.ruff_cache/
|
| 15 |
+
.ipynb_checkpoints/
|
| 16 |
+
.cache/
|
| 17 |
+
*.py[cod]
|
| 18 |
+
*$py.class
|
| 19 |
+
.venv/
|
| 20 |
+
env/
|
| 21 |
+
venv/
|
| 22 |
+
ENV/
|
| 23 |
+
build/
|
| 24 |
+
dist/
|
| 25 |
+
*.egg-info/
|
| 26 |
+
|
| 27 |
+
# --- Astro & Node.js (Frontend) ---
|
| 28 |
+
frontend/node_modules/
|
| 29 |
+
frontend/dist/
|
| 30 |
+
frontend/.astro/
|
| 31 |
+
frontend/.vercel/
|
| 32 |
+
frontend/.netlify/
|
| 33 |
+
frontend/npm-debug.log*
|
| 34 |
+
frontend/yarn-debug.log*
|
| 35 |
+
frontend/yarn-error.log*
|
| 36 |
+
frontend/pnpm-debug.log*
|
| 37 |
+
|
| 38 |
+
# --- Build Artifacts ---
|
| 39 |
+
backend/static/
|
| 40 |
+
backend/static/*
|
| 41 |
+
!backend/static/.gitkeep
|
| 42 |
+
|
| 43 |
+
# --- Data & SQLite ---
|
| 44 |
+
data/*
|
| 45 |
+
!data/README.md
|
| 46 |
+
var/*.db
|
| 47 |
+
var/*.sqlite
|
| 48 |
+
*.db
|
| 49 |
+
*.sqlite
|
| 50 |
+
*.csv
|
| 51 |
+
*.xlsx
|
| 52 |
+
*.parquet
|
| 53 |
+
*.json
|
| 54 |
+
!package.json
|
| 55 |
+
!tsconfig.json
|
| 56 |
+
!docs/**/*.csv
|
| 57 |
+
!docs/**/*.json
|
| 58 |
+
|
| 59 |
+
# --- Model artifacts (descargados de Hugging Face Hub; NO versionar) ---
|
| 60 |
+
models/*.onnx
|
| 61 |
+
models/*.pt
|
| 62 |
+
!models/.gitkeep
|
| 63 |
+
|
| 64 |
+
# --- OS & IDE ---
|
| 65 |
+
.vscode/*
|
| 66 |
+
!.vscode/extensions.json
|
| 67 |
+
!.vscode/settings.json
|
| 68 |
+
!.vscode/launch.json
|
| 69 |
+
.idea/
|
| 70 |
+
*.swp
|
| 71 |
+
*.swo
|
| 72 |
+
Thumbs.db
|
| 73 |
+
Desktop.ini
|
| 74 |
+
.DS_Store
|
| 75 |
+
|
| 76 |
+
# --- AI Agents & Tools ---
|
| 77 |
+
.claude/
|
| 78 |
+
.agents/
|
| 79 |
+
.opencode/
|
| 80 |
+
graphify-out/
|
| 81 |
+
CLAUDE.md
|
| 82 |
+
AGENTS.md
|
| 83 |
+
.antigravityignore
|
| 84 |
+
.claudeignore
|
| 85 |
+
.graphifyignore
|
| 86 |
+
opencode.json
|
| 87 |
+
|
| 88 |
+
# --- Multimedia & Docs Exceptions ---
|
| 89 |
+
*.jpg
|
| 90 |
+
*.png
|
| 91 |
+
*.jpeg
|
| 92 |
+
*.mp4
|
| 93 |
+
*.webp
|
| 94 |
+
*.gif
|
| 95 |
+
!/docs/image/
|
| 96 |
+
!/docs/image/*.png
|
| 97 |
+
!/docs/image/*.jpg
|
| 98 |
+
!/docs/image/*.jpeg
|
| 99 |
+
!/docs/image/*.csv
|
| 100 |
+
|
| 101 |
+
# --- Temporary & Scratch ---
|
| 102 |
+
scratch/
|
| 103 |
+
.hypothesis/
|
| 104 |
+
|
| 105 |
+
# --- Docs internos: NO versionar en git, pero SÍ legibles localmente / por Claude ---
|
| 106 |
+
# (El .gitignore solo afecta a git; la lectura de archivos por herramientas/Claude es independiente.)
|
| 107 |
+
docs/doc_guia/
|
| 108 |
+
docs/investigation/
|
| 109 |
+
docs/plan/
|
| 110 |
+
docs/task/
|
| 111 |
+
|
| 112 |
+
# Playwright MCP artifacts
|
| 113 |
+
.playwright-mcp/
|
| 114 |
+
localhost-*.png
|
| 115 |
+
section5*.png
|
| 116 |
+
desactivar-*.png
|
| 117 |
+
download-*.png
|
.pre-commit-config.yaml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Hooks de calidad: ejecutan Ruff (lint + formato) antes de cada commit.
|
| 2 |
+
# Instalar una vez: uv run pre-commit install
|
| 3 |
+
repos:
|
| 4 |
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
| 5 |
+
rev: v0.6.9
|
| 6 |
+
hooks:
|
| 7 |
+
- id: ruff # linter (con autocorrección)
|
| 8 |
+
args: [--fix]
|
| 9 |
+
- id: ruff-format # formateador
|
pyproject.toml
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[project]
|
| 2 |
+
name = "agrovision-mvp"
|
| 3 |
+
version = "0.1.0"
|
| 4 |
+
description = "MVP de AgroVisión: UI Shiny + backend FastAPI para conteo de plantas (modelo agnóstico, en standby)."
|
| 5 |
+
requires-python = ">=3.11"
|
| 6 |
+
dependencies = [
|
| 7 |
+
"fastapi>=0.115",
|
| 8 |
+
"uvicorn[standard]>=0.34",
|
| 9 |
+
"python-multipart>=0.0.9", # requerido por FastAPI para multipart/form-data
|
| 10 |
+
"pydantic>=2.7",
|
| 11 |
+
"shiny>=1.2",
|
| 12 |
+
"httpx>=0.27",
|
| 13 |
+
"python-dotenv>=1.0", # carga .env en desarrollo local
|
| 14 |
+
"onnxruntime>=1.18", # inferencia ONNX genérica (agnóstica al modelo)
|
| 15 |
+
"opencv-python-headless>=4.9",
|
| 16 |
+
"pillow>=10.0",
|
| 17 |
+
"numpy>=2.1", # >=2.1 trae wheels para Python 3.13
|
| 18 |
+
"supervision>=0.20", # tiling/anotación de cajas (uso futuro al activar el conteo)
|
| 19 |
+
"huggingface_hub>=0.24", # descarga del modelo desde HF Hub en el build
|
| 20 |
+
]
|
| 21 |
+
|
| 22 |
+
[dependency-groups]
|
| 23 |
+
dev = [
|
| 24 |
+
"pytest>=8",
|
| 25 |
+
"ruff>=0.6",
|
| 26 |
+
"playwright>=1.45",
|
| 27 |
+
]
|
| 28 |
+
|
| 29 |
+
[tool.uv]
|
| 30 |
+
# La carpeta del repo está sincronizada por OneDrive: usar copia evita errores de hardlink.
|
| 31 |
+
link-mode = "copy"
|
| 32 |
+
|
| 33 |
+
[tool.ruff]
|
| 34 |
+
line-length = 100
|
| 35 |
+
target-version = "py311"
|
| 36 |
+
|
| 37 |
+
[tool.ruff.lint]
|
| 38 |
+
select = ["E", "F", "I", "UP", "B"]
|
| 39 |
+
|
| 40 |
+
[tool.ruff.lint.flake8-bugbear]
|
| 41 |
+
# FastAPI usa estas llamadas en valores por defecto de argumentos (patrón idiomático).
|
| 42 |
+
extend-immutable-calls = ["fastapi.File", "fastapi.Form", "fastapi.Depends", "fastapi.Query"]
|
| 43 |
+
|
| 44 |
+
[tool.pytest.ini_options]
|
| 45 |
+
pythonpath = ["."]
|
| 46 |
+
testpaths = ["tests"]
|
| 47 |
+
addopts = "-q"
|
uv.lock
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|