Easy-Graph icon indicating copy to clipboard operation
Easy-Graph copied to clipboard

Refactor: migrate C++ bindings to pybind11; modernize build, packaging & tests

Open Acture opened this issue 3 months ago • 0 comments

Summary

Depends on #153. Closes #154.

This PR is a comprehensive build system and packaging refactor following the pybind11 migration. It consolidates all build logic under a modern, reproducible structure and aligns EasyGraph’s native extension, Python packaging, and test workflow.

While the diff is large (+3,176 −2,979, 142 files changed), most edits are:

  • structural (directory moves, renames, CMake rewrites),
  • dependency normalization (pybind11, scikit-build-core, uv),
  • or automated formatting (Ruff and pytest modernization).

No algorithmic logic is altered.

Key Changes

  1. Build System
    • 将所有 py::object/py::dict/py::list 的 Boost 习语改为 pybind11 API 与异常:
    • throw py::key_error/py::value_error/py::type_error 等替代手写 PyErr_*。
    • 使用 py::arg("...") = py::none()/py::str("...") 提供默认参数。
    • def() 绑定处修复“默认参数重复定义”与签名不匹配问题。
    • 统一 C++17(-std=gnu++17),移除结构化绑定告警;修正 py::dict 只读访问(用 get_item() 或 obj = dict[key] 的 pybind11 方式)。
    • 模块入口:PYBIND11_MODULE(_core, m);导出类型挂载到 easygraph.cpp_easygraph。
  2. Packaging / Build
    • 仅保留 一个顶层包 easygraph。
    • pyproject.toml 使用 scikit-build-core 控制打包:
  3. Tests & CI Modernization
    • 移除 nose:from unittest import SkipTest 或 pytest.importorskip 取代 from nose import SkipTest。
    • Pandas 2.x:将所有 DataFrame.append(...) 改为 pd.concat([df, row_or_df], ignore_index=True)。
    • pytest -ra -W always 可显示全部 warnings;默认配置不再全局禁用 warnings。
  4. Tooling: Ruff / pytest / tox / uv
    • Ruff 取代 Flake8:
    • [tool.ruff] 与 [tool.ruff.lint]、[tool.ruff.format];
    • 选择性启用规则族(E/F/W, B, Q, SIM, TID, TCH, ERA, UP),而非大批量 ignore;
    • 纠正不被 Ruff 支持的小节。
    • 在 pyproject.toml 汇总:
    • pytest:-ra;移除 --disable-warnings。
    • tox:迁移到 [tool.tox],使用 tox-uv 加速环境创建。

Acture avatar Oct 21 '25 09:10 Acture