SG-Lib

SG-Lib 2027 — moving to Python

This page describes the direction for 2027, not a download. The current release is SG-Lib 5.6 (2026), a MATLAB toolbox — see Latest Release.

Three statements about the next generation:

  • SG-Lib 2027 will be based on Python.
  • It will remain usable from MATLAB.
  • MATLAB code written in Python will look like the MATLAB code of today’s SG-Lib.

Why Python from 2027 on

Developing and using the SG-Lib in Python rather than in MATLAB makes it possible to:

  • choose the package release freely and independently of the MATLAB release, and adopt the newest and least buggy version immediately;
  • know the package developers and contact them directly when serious bugs have to be fixed, and be informed about ongoing changes;
  • integrate further packages quickly and directly, from many different developers — preferably AI networks;
  • better understand, and prepare for, the coming changes brought by the agentic AI developer scene;
  • choose the IDE freely (Spyder, very similar to MATLAB R2024b, or Visual Studio, or any other Python IDE);
  • stay independent of an “AI agent” product that is statically integrated into an IDE and may not keep up with the speed of AI development;
  • use agentic AI (Claude, ChatGPT) much better through transparent interfaces such as curl, which allow the most recent AI API versions to be used directly;
  • develop processes with drastically reduced memory demand for mechanism design and everyday automation, and keep many parallel tasks alive on one machine;
  • use the installed Python environment (venv) independently of the MATLAB version (3.12 for R2024b, for example);
  • let AI agents such as Claude or ChatGPT use the code far more directly in everyday work;
  • let AI agents such as Claude or ChatGPT implement, verify and validate new code far more directly.

The same part in both worlds

JACO finger rendered in MATLAB
MATLAB R2024b — SGreadSTL + SGplotalpha, today's SG-Lib 5.6.
JACO finger rendered in the ClevePython window
ClevePython — the same STL in the Python window sgpyfigure, driven from the same MATLAB-style code.

The part is a 3D-printed finger of a JACO robot hand (64 199 facets). Same geometry, same point of view — one rendered by MATLAB, one by the Python window that will carry SG-Lib 2027.

What this means for memory

The real difference is architectural. MATLAB is one process: JVM, toolboxes, graphics and workspace all together — about 1.5 GB before the first computation. The Python world is two processes: a small compute process plus a separate window. The window can be closed and restarted without losing the workspace; in MATLAB both hang on the same process.

ProcessResident memory
Python, bare interpreter9 MB
Python with the MATLAB core and the SG-Lib functions70 MB
… with the test geometry loaded201 MB
Python graphics window with that geometry518 MB
Python total: computing + window719 MB
MATLAB, freshly started, headless1 473 MB
MATLAB desktop with graphics4 490 MB

In practice: five parallel MATLAB pool workers cost about 8.7 GB today. Five Python compute processes cost about 350 MB — and they share one window.

Measured on 2026-10-27 with MATLAB R2024b on a Mac Studio (M4 Max, 128 GB, macOS 15.8.1); test geometry a 3D-printed JACO finger, 64 199 facets. Resident set size as reported by the operating system.