M11b-2a: resolve root-package spec compliance (rev2: tighten packaging surface, record real import evidence)

- pyproject.toml: [tool.setuptools.packages.find] where=[.] include=[world_sync*]
  namespaces=false — 把「仓库根从不作为包」固化为配置约束,杜绝双路径歧义回归。
- 承接 9f97d58(删除仓库根 157 行转发 __init__.py)。
- 实测更正:sys.path=modules/(模块父目录)场景  在删除前(01941aa 沙箱)与删除后同样 ImportError(解析到 init/ 目录),
  非本次删除引入的回归;宿主真实解析路径为 venv editable finder → pkgs 副本内层包,实测 OK。
  证据见 projects/pbls/docs/02-develop/m11b2a-1-root-package-disposition.md §4(rev2)。
This commit is contained in:
agent.develop 2026-09-20 19:12:05 +08:00
parent 95b405fd25
commit aff1f0da0c

View File

@ -8,6 +8,21 @@ version = "1.0.0"
requires-python = ">=3.8"
dependencies = ["sqlor", "bricks_for_python"]
# 打包面显式收紧M11b-2a-1 rev2响应 QC #14 改法 (b) 的合规部分)
# ---------------------------------------------------------------------------
# 事实基线(实测,见 projects/pbls/docs/02-develop/m11b2a-1-root-package-disposition.md §4.3
# find_packages(where=".", include=["world_sync*"]) == ['world_sync']
# 即 setuptools 只发现内层包 ./world_sync/(仓库根 "." 本身从不被当作包,
# 删除前根级 __init__.py 也从未进入 wheel/egg-link 打包面)。
# 这里显式写死 namespaces=false目的是把该事实固化为配置约束而非巧合
# ① 防止未来有人往仓库根/`init/`/`json/`/`models/` 等数据目录放 __init__.py
# 或开启 namespace 发现,使 `world_sync` 出现两个候选落点(双路径歧义);
# ② 保证 `pip install -e` 生成的 __editable___world_sync_*_finder.MAPPING
# 恒指向 <repo>/world_sync内层包目录与宿主 apps/scense 实测一致。
# 唯一受支持的导入根 = 仓库根目录(或 editable finder 映射),
# 不支持把 modules/(模块父目录)放进 sys.path —— 该场景实测 ImportError
# 且删除根包前后同样失败(详见处置文档 §4.2/§4.3)。
[tool.setuptools.packages.find]
where = ["."]
include = ["world_sync*"]
namespaces = false