* feat(cadastre): bulk_harvest_quarter Celery task + grid-walker + saga state (#168 PR3/5) Add bulk cadastre harvest pipeline: - services/cadastre/bulk_harvest.py: async harvest_quarter() orchestrator (4 phases) + 7 upsert helpers (parcels/buildings/constructions/oncs/enks/zouit/quarter_stats) using CAST(:x AS jsonb) pattern, begin_nested() SAVEPOINT per grid-walk upsert - services/cadastre/grid_geometry.py: quarter_bbox_3857 (PostGIS ST_Extent) + generate_grid_click_points (15x15 = 225 sub-bbox grid) - workers/tasks/scrape_cadastre.py: bulk_harvest_quarter_task (acks_late=True, dont_autoretry_for NspdBulkWafError), enqueue_cadastre_harvest, cleanup_zombies - api/v1/admin_cadastre.py: 5 endpoints behind AdminTokenAuth — create/list/get/cancel/resume - Tests: 13 service unit + 8 API tests * fixup(cadastre): drop importorskip (PR2 merged) — imports now top-level (#168 PR3) * fixup(cadastre): tile_size unified param + register slow marker (#168 PR3) Blocker #1: rename tile_width/tile_height → tile_size in generate_grid_click_points. Callers in bulk_harvest.py and test_cadastre_bulk.py used tile_size; def had tile_width+tile_height → TypeError at runtime. Blocker #2 (10 failures in test_admin_cadastre.py) was side-effect of #1: TypeError at import chain (app.main → admin_cadastre → bulk_harvest) broke FastAPI app load → dependency_overrides AttributeError. Now resolved. Also register `slow` pytest marker in pyproject.toml to suppress PytestUnknownMarkWarning. * fixup(cadastre): use importlib.util.find_spec instead of import (#168 PR3) Root cause Blocker #2: `import app.workers.tasks.scrape_cadastre` at module top-level REBOUND `app` from FastAPI instance (line 14) to the Python package. All subsequent `app.dependency_overrides[get_db] = ...` failed with AttributeError because `app` was now the namespace module. Fix: probe module availability with importlib.util.find_spec — does not import or rebind names. FastAPI `app` instance stays intact. All 28 cadastre tests pass locally. --------- Co-authored-by: lekss361 <claudestars@proton.me>
84 lines
2.2 KiB
TOML
84 lines
2.2 KiB
TOML
[project]
|
|
name = "gendesign-backend"
|
|
version = "0.1.0"
|
|
description = "Generative Design + Site Finder backend (FastAPI)"
|
|
requires-python = ">=3.12"
|
|
dependencies = [
|
|
"fastapi>=0.115.0",
|
|
"uvicorn[standard]>=0.30.0",
|
|
"sqlalchemy>=2.0.30",
|
|
"geoalchemy2>=0.15.0",
|
|
"alembic>=1.13.0",
|
|
"pydantic>=2.7.0",
|
|
"pydantic-settings>=2.3.0",
|
|
"psycopg[binary]>=3.2.0",
|
|
"shapely>=2.0.0",
|
|
"geopandas>=1.0.0",
|
|
"pyproj>=3.6.0",
|
|
"httpx>=0.27.0",
|
|
"redis>=5.0.0",
|
|
"celery>=5.4.0",
|
|
"playwright>=1.45.0",
|
|
"tenacity>=9.0.0",
|
|
"pillow>=10.4.0",
|
|
"weasyprint>=62.0",
|
|
"ezdxf>=1.3.0",
|
|
"openpyxl>=3.1.0",
|
|
"pandas>=2.2.0",
|
|
"numpy>=2.0.0",
|
|
"scikit-learn>=1.5.0",
|
|
"sentry-sdk[fastapi]>=2.10.0",
|
|
"rosreestr2coord>=5.0.0",
|
|
]
|
|
|
|
[dependency-groups]
|
|
dev = [
|
|
"pytest>=8.0.0",
|
|
"pytest-asyncio>=0.23.0",
|
|
"ruff>=0.5.0",
|
|
"mypy>=1.10.0",
|
|
"types-redis>=4.6.0",
|
|
"pre-commit>=3.7.0",
|
|
]
|
|
|
|
[tool.uv]
|
|
package = true
|
|
|
|
# Tell setuptools which directory IS the Python package.
|
|
# Without this, having both `app/`, `alembic/`, `db/` at top level confuses
|
|
# auto-discovery: "Multiple top-level packages discovered in a flat-layout".
|
|
# We only want to package `app/`. `alembic/` and `db/` are operational, not Python packages.
|
|
[tool.setuptools.packages.find]
|
|
include = ["app*"]
|
|
|
|
[tool.ruff]
|
|
target-version = "py312"
|
|
line-length = 100
|
|
|
|
[tool.ruff.lint]
|
|
select = ["E", "F", "I", "B", "UP", "N", "RUF", "ASYNC"]
|
|
# RUF001/002/003 — ambiguous Unicode (Cyrillic vs Latin lookalikes).
|
|
# Off because the project is Russian-language; comments/docstrings legitimately use Cyrillic.
|
|
ignore = ["RUF001", "RUF002", "RUF003"]
|
|
|
|
[tool.mypy]
|
|
python_version = "3.12"
|
|
strict_optional = true
|
|
warn_unused_ignores = true
|
|
|
|
# strict только для core-модулей (правило из памяти Validation_Findings_Apr25)
|
|
[[tool.mypy.overrides]]
|
|
module = [
|
|
"app.services.generative.geometry",
|
|
"app.services.generative.teap",
|
|
"app.services.generative.financial",
|
|
"app.services.site_finder.scorer",
|
|
]
|
|
strict = true
|
|
|
|
[tool.pytest.ini_options]
|
|
testpaths = ["tests"]
|
|
asyncio_mode = "auto"
|
|
markers = [
|
|
"slow: marks tests as slow (need real network, deselect with -m 'not slow')",
|
|
]
|