[project] name = "simplecadapi" version = "2.3.0" description = "A simplified OpenCASCADE-native CAD modeling Python API" readme = "README.md" license = { file = "LICENSE" } authors = [{ name = "倪旌哲", email = "nijingzhe@zju.edu.cn" }] maintainers = [{ name = "倪旌哲", email = "nijingzhe@zju.edu.cn" }] requires-python = ">=3.10,<3.14" keywords = ["cad", "modeling", "3d", "design", "ocp", "opencascade"] classifiers = [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "Intended Audience :: Manufacturing", "Topic :: Scientific/Engineering", "Topic :: Scientific/Engineering :: Visualization", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Operating System :: OS Independent", ] dependencies = [ "numpy>=1.21.0", "pillow>=10.0", # the software renderer encodes PNG and draws the screenshot text "rich>=14.0.0", "jsonschema>=4.25.1,<5.0.0", "rfc8785>=0.1.4,<0.2.0", "typing-extensions>=4.12,<5", "tomli>=2.0,<3; python_version < '3.11'", "ezdxf>=1.4.4", "marimo>=0.25.0", "plotly>=7.1.0", "cryptography>=42.0.0", "matplotlib>=3.7.0", ] [project.optional-dependencies] dev = [ "pytest>=7.0", "pytest-cov>=4.0", "mypy>=1.0", "black>=23.0", "isort>=5.0", "pymupdf>=1.28.2", ] drawing = [ "pymupdf>=1.28.2", ] editor = [ "starlette>=1.7.0", "uvicorn>=0.54.0", "websockets>=16.1.1", ] # 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 = [] # Verifier scripts measure models with OCP; the SDK itself never imports it (simplecadapi.verify bridges the two). # The build without VTK (same `OCP` import, no 100 MB VTK) and the OCCT generation the SDK ships (7.9): OCP 8 renames # the casts and changes signatures. verify = [ "cadquery-ocp-novtk>=7.9.3.1,<8", ] whucad = [ "h5py>=3.8", ] gmsh = [ "gmsh>=4.15,<5", ] [project.urls] Homepage = "https://github.com/PhySpace/SimpleCADAPI" Repository = "https://github.com/PhySpace/SimpleCADAPI" Documentation = "https://github.com/PhySpace/SimpleCADAPI#readme" Issues = "https://github.com/PhySpace/SimpleCADAPI/issues" [build-system] # One distribution: the Python package and the compiled C++ module (``simplecadapi._cpp``, src/cpp/) it runs on. requires = ["scikit-build-core>=0.10", "pybind11>=2.13", "ninja>=1.11; platform_system == 'Windows'"] # scad_build (tools/build_backend) is scikit-build-core plus toolchain/OpenCASCADE detection on Windows, so that a plain # `uv sync` builds without hand-set CMAKE_GENERATOR / CC / CXX / CMAKE_ARGS. build-backend = "scad_build" backend-path = ["tools/build_backend"] [tool.scikit-build] minimum-version = "build-system.requires" cmake.source-dir = "src/cpp" cmake.version = ">=3.20" cmake.build-type = "Release" build-dir = "src/cpp/build/wheel/{wheel_tag}" # The Python package is copied as it is (the built web UI included, it is git-ignored); the CMake install() rules add the # compiled module ``simplecadapi/_cpp/`` and the resource files (skill, example notebooks) listed in src/cpp/CMakeLists.txt. wheel.packages = ["src/simplecadapi"] wheel.exclude = ["**/__pycache__/**", "**/*.pyc"] sdist.include = [ "/tools/build_backend", "/src/simplecadapi/editor/webui", "/skillproj.toml", "/docs/skill", "/examples/u_link_motor_mount/u_link.py", "/examples/u_link_motor_mount/shell.py", "/examples/u_link_motor_mount/u_link_motor_mount.py", "/examples/u_link_motor_mount/dimensions.py", "/examples/u_link_motor_mount/common.py", ] sdist.exclude = [ "/.python-version", "/uv.lock", "/test", "/tests", "/skills", "/examples/[!u]*", "/src/cpp/build", ] [tool.scikit-build.cmake.define] SCAD_BUILD_TESTS = "OFF" SCAD_BUILD_PYTHON = "ON" [tool.cibuildwheel] # Four targets: Linux x86_64, Linux aarch64, macOS arm64, Windows x86_64 (see .github/workflows/release.yml), each for # Python 3.10-3.13. Every wheel links the same static OCCT built by src/cpp/tools/build_occt.py, so the kernel (and its # behaviour) is identical everywhere and the wheel needs no OCCT on the user's machine. build = "cp310-* cp311-* cp312-* cp313-*" skip = "*-musllinux_* *-win32 *_i686 pp*" build-verbosity = 1 # Runs in a clean environment with only the wheel installed (no checkout on the path). test-command = "python {project}/src/cpp/tests/wheel_smoke.py" [tool.cibuildwheel.linux] manylinux-x86_64-image = "manylinux_2_28" manylinux-aarch64-image = "manylinux_2_28" before-all = "python3 -m pip install cmake ninja && python3 src/cpp/tools/build_occt.py --prefix /opt/occt" environment = { SCAD_OCCT_PREFIX = "/opt/occt", CMAKE_ARGS = "-DSCAD_OCCT_PREFIX=/opt/occt" } [tool.cibuildwheel.macos] archs = ["arm64"] # 14.0: the C++ module formats numbers with std::to_chars (floating point), which libc++ provides from macOS 13.3, and the # wheel tag only knows whole versions (macosx_14_0), so the binary must require what its tag promises. environment = { MACOSX_DEPLOYMENT_TARGET = "14.0", SCAD_OCCT_PREFIX = "/tmp/occt", CMAKE_ARGS = "-DSCAD_OCCT_PREFIX=/tmp/occt" } # before-all runs on the host without the `environment` above, so OCCT gets the same deployment target explicitly. before-all = "MACOSX_DEPLOYMENT_TARGET=14.0 python3 src/cpp/tools/build_occt.py --prefix /tmp/occt" [tool.cibuildwheel.windows] archs = ["AMD64"] before-all = "python -m pip install cmake ninja && python src/cpp/tools/build_occt.py --prefix C:/occt" environment = { SCAD_OCCT_PREFIX = "C:/occt", CMAKE_ARGS = "-DSCAD_OCCT_PREFIX=C:/occt" } [dependency-groups] dev = [ "twine>=6.1.0", "pytest", "pymupdf>=1.28.2", # the editor tests (test/test_editor.py) need the editor extra's packages "starlette>=1.7.0", "uvicorn>=0.54.0", "websockets>=16.1.1", "jupyterlab>=4.5.5", "ipykernel>=6.29.5", "matplotlib>=3.10.8", "numpy-stl>=3.2.0", "trimesh>=4.11.3", "datamodel-code-generator==0.32.0", "ty>=0.0.18", ] [tool.uv] # `uv run` / `uv sync` rebuild the editable install (the C++ module, minutes of compiling, and a C++ toolchain + OCCT on the # machine) whenever a cache key changed. uv's default key is pyproject.toml, so a version bump or a dependency edit forced # a rebuild nobody needed. Rebuild only when the C++ module's inputs change. cache-keys = [ { file = "src/cpp/CMakeLists.txt" }, { file = "src/cpp/cmake/**" }, { file = "src/cpp/include/**" }, { file = "src/cpp/src/**" }, { file = "src/cpp/bindings/**" }, ] [tool.ty.environment] python-version = "3.10" # FreeCAD runtime payloads are exec'd inside FreeCAD's embedded interpreter; # GRAPH_NODES / App / Part etc. are runtime-injected globals by design. [[tool.ty.overrides]] include = ["src/simplecadapi/translator/freecad_translator/runtime/**/*.py"] [tool.ty.overrides.rules] unresolved-import = "ignore" unresolved-reference = "ignore" [tool.ty.rules] # VTK is a compiled C-extension binding that ships no .pyi stubs, and # example scripts import sibling modules — import resolution is # environmental noise in this repo, not signal. Real import typos surface # at runtime and in the test suite. unresolved-import = "ignore" [tool.ty.src] include = ["src", "test", "tests", "examples", "tools"] exclude = [ "**/__pycache__/**", ".venv/**", "build/**", "dist/**", "output/**", ] [tool.pytest.ini_options] testpaths = ["test", "tests"] [project.scripts] sca = "simplecadapi.cli:main" # The marimo editor runs SimpleCAD notebooks' cells with this executor. [project.entry-points."marimo.cell.executor"] simplecadapi = "simplecadapi.runtime.executor:executor_factory"