From 3788f03de19acfa6d39b8d556020b46e8f2e6ca9 Mon Sep 17 00:00:00 2001 From: NiJingzhe <1448976235@qq.com> Date: Sun, 25 Oct 2026 16:28:55 +0800 Subject: [PATCH] feat(inspect): inspect.brep is part of the default install matplotlib moves to the core dependencies; the inspect extra stays as an empty alias so older install commands work. The wheel smoke test renders a STEP through inspect.brep. Co-Authored-By: Claude Sonnet 5.5 --- CHANGELOG.md | 2 ++ README.md | 10 ++++------ README.zh-CN.md | 7 ++----- docs/skill/references/workflows/step-reconstruction.md | 5 +++-- docs/updates/2.2.7b1.md | 6 ++++-- docs/updates/2.2.7b1.zh-CN.md | 2 +- pyproject.toml | 7 ++++--- src/cpp/tests/wheel_smoke.py | 7 +++++++ uv.lock | 6 ++---- 9 files changed, 29 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce891621..d746aab5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ user-facing notes live in [`docs/updates/`](docs/updates/) (English and built by the release workflow against one static OpenCASCADE 7.9.3. ### Changed +- `simplecadapi.inspect.brep` is part of the default install and renders with the built-in software renderer: VTK is no + longer needed, `matplotlib` is a core dependency, and the `inspect` extra is an empty alias. - The geometry engine is C++ on OpenCASCADE, shipped in the wheel as `simplecadapi._cpp`; one distribution, one import package. The public API is unchanged, and the previous test suite passes (three tests that relied on a dropped sliver of a tangent cut now use a tool clear of the wall). diff --git a/README.md b/README.md index 9f613ea6..82c5639b 100644 --- a/README.md +++ b/README.md @@ -560,12 +560,10 @@ A durable CAD/viewer deliverable is a notebook product captured to ## STEP/BREP Inspection -Install the optional rendering dependency when synchronized STEP views, -highlighted regions, or slice overlays are needed: - -```bash -pip install "simplecadapi[inspect]" -``` +Synchronized STEP views, highlighted regions and slice overlays need nothing +beyond `pip install simplecadapi`: they are drawn by the built-in software +renderer (no GPU, no display server, no VTK). Only the engineering-drawing +family (`simplecadapi.inspect.drawing`) needs the `drawing` extra. Inspection lives under `simplecadapi.inspect.brep`. These APIs are diagnostic tools, not modeling operations: they do not enter the graph and are rejected diff --git a/README.zh-CN.md b/README.zh-CN.md index c9e36e90..811631a9 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -508,11 +508,8 @@ cell 已经记录进各自的 session,不要在 cell 里再开一个。它在 ## STEP/BREP 检查 -需要同步 STEP 视图、区域高亮或截面叠加时,安装可选渲染依赖: - -```bash -pip install "simplecadapi[inspect]" -``` +同步 STEP 视图、区域高亮和截面叠加不需要额外安装:`pip install simplecadapi` 即可,由内置软渲染绘制 +(不依赖 GPU、显示服务和 VTK)。只有工程图系列(`simplecadapi.inspect.drawing`)需要 `drawing` 额外依赖。 检查 API 位于 `simplecadapi.inspect.brep`。它们是诊断工具,不是建模操作:不进入 操作图,在 `GraphSession` 内调用会被拒绝。先导出或拿到几何,再在建模脚本之外 diff --git a/docs/skill/references/workflows/step-reconstruction.md b/docs/skill/references/workflows/step-reconstruction.md index 202a6004..475af5d1 100644 --- a/docs/skill/references/workflows/step-reconstruction.md +++ b/docs/skill/references/workflows/step-reconstruction.md @@ -104,8 +104,9 @@ repair_routes: geometry and call it recovered. - Candidate structurally different → re-open the feature-tree hypothesis before accepting a visual-close stop. -- Reconstruction tooling absent (`inspect` extra not installed) → report the - missing capability rather than degrading silently. +- Reconstruction tooling absent (for example the `drawing` extra, which + `simplecadapi.inspect.drawing` needs, is not installed) → report the missing + capability rather than degrading silently. ## Deliverables diff --git a/docs/updates/2.2.7b1.md b/docs/updates/2.2.7b1.md index 7fdf10a0..299de79f 100644 --- a/docs/updates/2.2.7b1.md +++ b/docs/updates/2.2.7b1.md @@ -42,8 +42,10 @@ The models computed are the same (volumes agree to 1e-12 relative). * Removed dependencies: `cadquery-ocp`, `ocp-gordon`, `py-slvs`. The OpenCASCADE view of a shape (`shape.wrapped`) is now the module's own binding, `simplecadapi._cpp.occt`, laid out like OCP. * `SCA_BACKEND` is gone: there is one backend. -* `simplecadapi.inspect.brep` renders with the same software renderer as `render_screenshot_rpath`: no VTK, no GPU, - no display server (no `xvfb`). The `inspect` extra is just `matplotlib`. +* `simplecadapi.inspect.brep` is part of the default install and renders with the same software renderer as + `render_screenshot_rpath`: no VTK, no GPU, no display server (no `xvfb`). `matplotlib` is now a core dependency; the + `inspect` extra stays as an empty alias so older install commands keep working. Only `simplecadapi.inspect.drawing` + still needs an extra (`drawing`). ## Booleans that split a body diff --git a/docs/updates/2.2.7b1.zh-CN.md b/docs/updates/2.2.7b1.zh-CN.md index 5bef6ee0..fff1afbb 100644 --- a/docs/updates/2.2.7b1.zh-CN.md +++ b/docs/updates/2.2.7b1.zh-CN.md @@ -38,7 +38,7 @@ macOS Intel、musl Linux、Windows ARM 没有预编译包;这些平台由源 * 移除的依赖:`cadquery-ocp`、`ocp-gordon`、`py-slvs`。形状的 OpenCASCADE 视图(`shape.wrapped`)现在是模块自带的绑定 `simplecadapi._cpp.occt`,布局与 OCP 相同。 * `SCA_BACKEND` 已删除:只有一个后端。 -* `simplecadapi.inspect.brep` 使用与 `render_screenshot_rpath` 相同的软渲染:不依赖 VTK、GPU 和显示服务(无需 `xvfb`)。`inspect` 额外依赖只剩 `matplotlib`。 +* `simplecadapi.inspect.brep` 成为默认安装的一部分,使用与 `render_screenshot_rpath` 相同的软渲染:不依赖 VTK、GPU 和显示服务(无需 `xvfb`)。`matplotlib` 变为核心依赖;`inspect` 额外依赖保留为空别名,旧的安装命令仍然可用。只有 `simplecadapi.inspect.drawing` 仍需要额外依赖(`drawing`)。 ## 会把实体切成多段的布尔运算 diff --git a/pyproject.toml b/pyproject.toml index 30b0f11a..b3242e45 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,6 +34,7 @@ dependencies = [ "marimo>=0.25.0", "plotly>=7.1.0", "cryptography>=42.0.0", + "matplotlib>=3.7.0", ] [project.optional-dependencies] @@ -53,9 +54,9 @@ editor = [ "uvicorn>=0.54.0", "websockets>=16.1.1", ] -inspect = [ - "matplotlib>=3.7.0", -] +# simplecadapi.inspect.brep is part of the default install; this extra is kept empty so that +# `pip install "simplecadapi[inspect]"` from older instructions still works. +inspect = [] whucad = [ "h5py>=3.8", ] diff --git a/src/cpp/tests/wheel_smoke.py b/src/cpp/tests/wheel_smoke.py index ee700e59..c81cf5da 100644 --- a/src/cpp/tests/wheel_smoke.py +++ b/src/cpp/tests/wheel_smoke.py @@ -66,6 +66,13 @@ def main() -> None: scad.render_screenshot_rpath(shapes=[body], output_path=str(png)) assert png.read_bytes()[:8] == b"\x89PNG\r\n\x1a\n" + # BREP inspection ships in the default install and draws with the same renderer (no VTK). + from simplecadapi.inspect import brep + + views = folder / "views.png" + brep.render_step_views_rpath(str(step), str(views), image_size=(6.0, 4.0), dpi=60) + assert views.read_bytes()[:8] == b"\x89PNG\r\n\x1a\n" + # Sketch solver and the product layer. part = scad.make_part_rpart("plate", body) assembly = scad.make_assembly_rassembly("a") diff --git a/uv.lock b/uv.lock index be5a2a3e..ab78e6a7 100644 --- a/uv.lock +++ b/uv.lock @@ -2983,6 +2983,7 @@ dependencies = [ { name = "ezdxf" }, { name = "jsonschema" }, { name = "marimo" }, + { name = "matplotlib" }, { name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, { name = "numpy", version = "2.3.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, { name = "pillow" }, @@ -3018,9 +3019,6 @@ fem = [ gmsh = [ { name = "gmsh" }, ] -inspect = [ - { name = "matplotlib" }, -] whucad = [ { name = "h5py" }, ] @@ -3055,7 +3053,7 @@ requires-dist = [ { name = "isort", marker = "extra == 'dev'", specifier = ">=5.0" }, { name = "jsonschema", specifier = ">=4.25.1,<5.0.0" }, { name = "marimo", specifier = ">=0.25.0" }, - { name = "matplotlib", marker = "extra == 'inspect'", specifier = ">=3.7.0" }, + { name = "matplotlib", specifier = ">=3.7.0" }, { name = "mypy", marker = "extra == 'dev'", specifier = ">=1.0" }, { name = "numpy", specifier = ">=1.21.0" }, { name = "pillow", specifier = ">=10.0" },