Standardize Python packaging and isolate bundled MLIR - #1016
Conversation
94ca0cc to
0acf08e
Compare
|
[P1] The ptoas-vmi sdist is not self-contained. pyproject.toml (line 44) references CMake and packages through ../... Building the sdist produced only pyproject.toml and PKG-INFO; rebuilding a wheel from it failed because the referenced CMake source tree was absent. Any source installation or package-index sdist fallback will fail. The VMI project must stage/include its complete sources and use paths internal to the sdist. |
|
已在
补充验证:两个 workflow YAML 均可解析;相关 Python 文件 |
eae1235 to
2b0f959
Compare
背景
PTOAS 原先通过自定义 PEP 517 backend、
setup.py、wheel bootstrap、运行时路径扫描和多套发布脚本维护 Python 包。这些代码重复承担了标准打包工具已有的 metadata、editable install、console script、wheel 组装和 native dependency repair,也使 CLI、PTODSL、CI、wheel 和 standalone archive 显式依赖源码树、LLVM build tree 或旧 install tree 的内部布局。同时,直接发布顶层
mlir包会与进程中的其他 MLIR Python distribution 冲突。PTOAS 需要拥有一套自洽的 MLIR Python runtime,并让 compiler native module 与 Python bindings 共享同一套 MLIR CAPI。本 PR 将 Python 构建与发布链路收敛到 scikit-build-core、AddMLIRPython 和标准平台 repair 工具,并把 PTOAS 自带的 MLIR runtime 隔离到
ptoas.mlir。修改内容
scikit-build-core作为标准 PEP 517/660 backend:ptoas;packaging/ptoas-vmi发布ptoas-vmi;setup.py和 wheel bootstrap。ptoas.mlir和ptoas.mlir.dialects.pto;MLIR_PYTHON_PACKAGE_PREFIX=ptoas.mlir.和独立 nanobind domain;mlir。PTOASPythonCAPI;-Werror,PTOAS 自有代码继续保持-Werror。ptoas._core:_core,不再扫描 native library 路径。ptoas._cli:main;PTOAS_BIN,否则使用标准PATH;_bootstrap.py、_runtime_entry和跨源码/build/install tree 的路径猜测。ptoas-vmi的 PEP 621 version 是 VMI distribution 的唯一版本源;SKBUILD_PROJECT_VERSION_FULL将版本传给 CMake/CLI;PTOAS_VMI_VERSION扫描、同步脚本和自动 patch bump;auditwheel repair,macOS wheel 使用delocate-wheel;.so/.dylibcommon CAPI。quick_install.sh使用标准 editable install;PTOAS_Python和PTOAS_CompilerArchive两个 CMake component 组装受控 install tree;_core和PTOASPythonCAPI;file(GET_RUNTIME_DEPENDENCIES)收集外部依赖并检查 unresolved/ABI 冲突;$ORIGINRPATH,macOS 使用delocate-path;验证
在重放到最新
main后:ptoas 0.53、ptoas-vmi 0.1.4。LD_LIBRARY_PATH/PYTHONPATH后:ptoas.mlir.ir、PTO dialect 和ptoas._core可导入;ptoas --version输出ptoas vmi 0.1.4。git diff --check通过。同一变更在重放前的 release dry-run 中完成了 Linux 全矩阵验证:
ptoas_vmi-0.1.4wheel;auditwheel repair、隔离安装测试和 artifact 上传;范围说明
ptoas与ptoas-vmi会安装相同的顶层 Python package 和 console script,因此两个 distribution 互斥,不应装入同一环境。.dylibpayload validation,并进入delocaterepair;完整 macOS matrix 由本 PR 的 workflow 继续覆盖。