|
| 1 | +# Migrating to 2.1: `src.*` → `agentflow_runtime.*` |
| 2 | + |
| 3 | +Since **agentflow-runtime 2.1.0** the runtime package installs and imports |
| 4 | +as **`agentflow_runtime`**. The generic `src` top-level that earlier wheels |
| 5 | +shipped is now a one-file deprecated shim, kept for exactly one deprecation |
| 6 | +window and **removed in the next major release**. |
| 7 | + |
| 8 | +## What you need to change |
| 9 | + |
| 10 | +| Before (deprecated) | After | |
| 11 | +|---|---| |
| 12 | +| `from src.serving.api.main import app` | `from agentflow_runtime.serving.api.main import app` | |
| 13 | +| `import src.processing.local_pipeline` | `import agentflow_runtime.processing.local_pipeline` | |
| 14 | +| `python -m src.serving.provision --schema` | `python -m agentflow_runtime.serving.provision --schema` | |
| 15 | +| `uvicorn src.serving.api.main:app` | `uvicorn agentflow_runtime.serving.api.main:app` | |
| 16 | +| `python -m src.processing.bridge_consumer` | `python -m agentflow_runtime.processing.bridge_consumer` | |
| 17 | + |
| 18 | +A mechanical rewrite is safe: every dotted `src.<module>` reference becomes |
| 19 | +`agentflow_runtime.<module>` for the runtime's top-level modules |
| 20 | +(`constants`, `db_concurrency`, `ingestion`, `logger`, `orchestration`, |
| 21 | +`processing`, `quality`, `serving`, `tenancy`, `version`). |
| 22 | + |
| 23 | +## Shim semantics during the deprecation window |
| 24 | + |
| 25 | +- `import src.X` keeps working and yields the **same module object** as |
| 26 | + `agentflow_runtime.X` — no double import, `isinstance` checks and module |
| 27 | + singletons are unaffected. |
| 28 | +- The first `import src` emits a `DeprecationWarning`. Set |
| 29 | + `AGENTFLOW_SRC_SHIM_SILENT=1` to silence it while you migrate. |
| 30 | +- The wheel's `src/` contains only `__init__.py`; the removal lands in the |
| 31 | + next major release, after which `import src` fails. |
| 32 | + |
| 33 | +## Repository layout (for contributors) |
| 34 | + |
| 35 | +- The tree moved to the src-layout `src/agentflow_runtime/…`; `src/` itself |
| 36 | + is a plain container directory (no `__init__.py`). |
| 37 | +- The shim source lives in `packaging/src_shim/src/__init__.py` and reaches |
| 38 | + wheels through the hatch `only-include` + `sources` maps in |
| 39 | + `pyproject.toml`. |
| 40 | +- Guards: `tests/unit/test_namespace_policy.py` (layout + no first-party |
| 41 | + `src.*` imports) and `scripts/wheel_smoke.py` (wheel top-level policy + |
| 42 | + install smoke outside the checkout, wired into the python-compat CI job). |
0 commit comments