Files
make-cad/test/test_library_is_english.py
NiJingzhe 8971279494 feat: the geometry engine is C++ on OpenCASCADE, one package, prebuilt wheels
The modeling API (shapes, operators, sketches, products, queries, the reactive graph) is implemented in
C++20 on OpenCASCADE (src/cpp) and ships inside the wheel as simplecadapi._cpp.  The Python layers that stay
Python (runtime, build, artifacts, editor, inspect, exporter, translators, scene) run on it unchanged; the
previous Python test suite passes on the new engine.

Layout: src/cpp and src/simplecadapi side by side, one distribution built by scikit-build-core.
simplecadapi.core, .operators.*, .ql, .std.* and the other legacy modules are real forwarding modules; the
Python adapter layer is simplecadapi/_glue.  OCP is no longer a dependency and nothing imports it.

Release: .github/workflows/release.yml builds wheels for Linux x86_64 and aarch64, macOS arm64 and Windows
x86_64 (Python 3.10-3.13) against one static OCCT, runs the test suite on the Linux wheels and publishes to
GitHub and PyPI; ci.yml caches the static OCCT for the test jobs.

Errors: every message the library writes is English; the tag-validation and semantic-query errors render in
full with possible causes and fixes.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-24 02:55:35 +08:00

31 lines
1.3 KiB
Python

"""The library carries no Chinese: every message, label, docstring and comment under ``src/`` is English.
(Examples, documentation and the research tools are outside the library; the third-party OCCT checkout that the C++
build may leave in ``src/cpp/.setup`` and the built web UI are not ours.)
"""
import re
from pathlib import Path
CJK = re.compile("[㐀-鿿豈-﫿 -〿＀-￯]")
SRC = Path(__file__).resolve().parents[1] / "src"
SKIP_DIRS = {"build", "__pycache__", "webui", "node_modules", ".setup"}
SUFFIXES = {".py", ".cpp", ".hpp", ".h", ".txt", ".toml", ".json", ".md", ".cmake", ".yml", ".yaml", ".sh"}
def test_no_chinese_text_in_the_library():
found = []
for path in SRC.rglob("*"):
if not path.is_file() or path.suffix not in SUFFIXES and path.name != "CMakeLists.txt":
continue
if SKIP_DIRS & set(path.relative_to(SRC).parts):
continue
try:
text = path.read_text(encoding="utf-8")
except UnicodeDecodeError:
continue
for number, line in enumerate(text.splitlines(), 1):
if CJK.search(line):
found.append(f"{path.relative_to(SRC)}:{number}: {line.strip()[:80]}")
assert not found, "Chinese text in the library:\n" + "\n".join(found[:40])