my prefect server setup prefect-metrics.waow.tech
python orchestration
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: use UV_PROJECT_ENVIRONMENT=/usr/local instead of sys.path injection

uv sync with UV_PROJECT_ENVIRONMENT=/usr/local installs packages into
the system Python's site-packages directly, so deps are available to
the prefect engine without any path manipulation hacks.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

zzstoatzz 8d41d5d6 bd729e5d

+3 -16
-8
flows/enrich.py
··· 1 - # k8s: prefect uses system python, but uv sync in the pull step creates .venv/ 2 - # with extra deps (duckdb, prefect-dbt, etc). inject it into sys.path before any imports. 3 - import sys as _sys 4 - from pathlib import Path as _Path 5 - _site = _Path(__file__).parent.parent / ".venv" / "lib" / f"python{_sys.version_info.major}.{_sys.version_info.minor}" / "site-packages" 6 - if _site.exists() and str(_site) not in _sys.path: 7 - _sys.path.insert(0, str(_site)) 8 - 9 1 import subprocess 10 2 from datetime import timedelta 11 3 from pathlib import Path
-8
flows/gh_notifications.py
··· 11 11 (set in the work pool base job template or via deploy/results-pvc.yaml) 12 12 """ 13 13 14 - # k8s: prefect uses system python, but uv sync in the pull step creates .venv/ 15 - # with extra deps (duckdb, etc). inject it into sys.path before any imports. 16 - import sys as _sys 17 - from pathlib import Path as _Path 18 - _site = _Path(__file__).parent.parent / ".venv" / "lib" / f"python{_sys.version_info.major}.{_sys.version_info.minor}" / "site-packages" 19 - if _site.exists() and str(_site) not in _sys.path: 20 - _sys.path.insert(0, str(_site)) 21 - 22 14 import datetime 23 15 import os 24 16 from dataclasses import dataclass
+3
scripts/patch_work_pool.py
··· 45 45 envs = props.setdefault("env", {}).setdefault("default", {}) 46 46 envs["PREFECT_LOCAL_STORAGE_PATH"] = "/prefect-results" 47 47 envs["ANALYTICS_DB_PATH"] = "/prefect-analytics/analytics.duckdb" 48 + # tell uv sync to install into system Python instead of creating a .venv — 49 + # this makes deps available to the prefect engine without any sys.path hacks 50 + envs["UV_PROJECT_ENVIRONMENT"] = "/usr/local" 48 51 49 52 await c.update_work_pool( 50 53 "kubernetes-pool",