{"id":34788161,"url":"https://github.com/sofa-framework/sofapython3","last_synced_at":"2026-05-10T07:02:17.017Z","repository":{"id":37229022,"uuid":"260159147","full_name":"sofa-framework/SofaPython3","owner":"sofa-framework","description":"A python plugin for Sofa offering a pythonic interface and python3 support.","archived":false,"fork":false,"pushed_at":"2026-01-29T21:57:17.000Z","size":30398,"stargazers_count":60,"open_issues_count":68,"forks_count":53,"subscribers_count":3,"default_branch":"master","last_synced_at":"2026-01-29T23:48:48.620Z","etag":null,"topics":["plugin","python","python3","sofa-framework"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sofa-framework.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"License.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"Authors.txt","dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-04-30T08:46:15.000Z","updated_at":"2026-01-29T19:19:47.000Z","dependencies_parsed_at":"2025-12-29T12:06:20.681Z","dependency_job_id":null,"html_url":"https://github.com/sofa-framework/SofaPython3","commit_stats":null,"previous_names":[],"tags_count":47,"template":false,"template_full_name":null,"purl":"pkg:github/sofa-framework/SofaPython3","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sofa-framework%2FSofaPython3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sofa-framework%2FSofaPython3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sofa-framework%2FSofaPython3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sofa-framework%2FSofaPython3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sofa-framework","download_url":"https://codeload.github.com/sofa-framework/SofaPython3/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sofa-framework%2FSofaPython3/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28974246,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-01T08:16:14.655Z","status":"ssl_error","status_checked_at":"2026-02-01T08:06:51.373Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["plugin","python","python3","sofa-framework"],"created_at":"2025-12-25T09:34:33.836Z","updated_at":"2026-02-01T09:02:01.483Z","avatar_url":"https://github.com/sofa-framework.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SofaPython3 plugin\n\n[![Documentation](https://img.shields.io/badge/doc-on_website-green.svg)](https://sofapython3.readthedocs.io/en/latest/index.html)\n[![Discord](https://img.shields.io/badge/chat-on_Discord-darkred.svg)](https://discord.com/channels/1196920567614419024/1196922833968824370)\n[![Support](https://img.shields.io/badge/support-on_GitHub_Discussions-blue.svg)](https://github.com/sofa-framework/sofa/discussions/categories/sofapython3)\n\nThis project is composed of a Sofa plugin to embed a python interpreter into a Sofa based simulation as well as several python modules that exposes the different c++ components used in Sofa. The binding is designed to be idiomatic python3 API with tight integration for numpy. This project is in a WIP state, please use it only if you are willing to help in the developement. \n\n## Installation \n\n### Requirement Install\n- pybind11 (minimal 2.3)\n- cmake (minimal 3.22)\n- developement package for python3 (python3-dev)\n\n### In-tree build\nAdd this directory path in `CMAKE_EXTERNAL_DIRECTORIES`.\n\nNB: This plugin cannot be build through in-build process when the old SofaPython plugin is activated. To have both SofaPython3 and SofaPython you need to use out-of-tree build. \n\n### Out-of-tree build\nThis plugin should compile with out-of-tree builds.\nYou might need to add the Sofa's installation path to the CMake prefix path. If you compiled Sofa in directory _$SOFA_ROOT/build_, consider doing an install step (make install, ninja install, etc.) and adding this installation path (example `cmake -DCMAKE_PREFIX_PATH=$SOFA_ROOT/build/install/lib/cmake ..`).\n\n### Changing the python path\nThe compilation of SofaPython3 plugin and bindings are tied to the python core library found during the CMake stage.\nTo change the python version used for the compilation, you can either:\n1. Provide the python executable path with `Python_EXECUTABLE`\n ```cmake -DPython_EXECUTABLE=/usr/local/bin/python3 ..```\n2. Provide the python root path with `Python_ROOT_DIR`\n ```cmake -DPython_ROOT_DIR=/usr/local ..```\n\nTo see all the hints that can be provided to CMake, see the official CMake documentation on Python :\nhttps://cmake.org/cmake/help/latest/module/FindPython.html\n\n### Installing the python 3 bindings\nIn order to use SofaPython3 bindings directly into a python3 interpreter, Python needs to find the bindings libraries. \nThis can be done automatically by going into the build directory of SofaPython3, and starting the cmake installation \ncommand:\n\n```\nplugin.SofaPython3/build $ cmake --install . \n```\n\nThis will first install the SofaPython3 plugin and bindings into the `install` directory, and then create symbolic links\nto the installed bindings into the python's user site-package directory (the directory returned by \n```python3 -m site --user-site```). After that, you should be able to import the SofaPython3 bindings directly into\npython:\n\n```python\n$ python3\n\u003e\u003e\u003e import SofaRuntime\n\u003e\u003e\u003e import Sofa\n\u003e\u003e\u003e root = Sofa.Core.Node(\"root\")\n```\n\nYou can change the directory where the links are created by setting the cmake variable \n```SP3_PYTHON_PACKAGES_LINK_DIRECTORY```. For example, the following will create symbolic links into the \n```/usr/lib/python3.8/dist-packages```, hence making the SofaPython3 bindings available to python3 for all the system\nusers.\n\n```\nplugin.SofaPython3/build $ cmake -DSP3_PYTHON_PACKAGES_LINK_DIRECTORY=/usr/lib/python3.8/dist-packages .\nplugin.SofaPython3/build $ cmake --install . \n```\n\nFinally, you can disable the automatic link creation with the cmake option ```SP3_LINK_TO_USER_SITE```:\n```\nplugin.SofaPython3/build $ cmake -DSP3_LINK_TO_USER_SITE=OFF .\n```\n\n## Features\n\n### The Sofa python module:\nExpose the base Sofa object to make a scene. \n- binding of BaseObject, BaseNode, Base, BaseData [DONE] \n- copy-less API to access the sofa Data containers [WIP] \n- implement custom sofa object (ForceField,  Controller) in python [POC]\n- docstring with sphinx content [WIP]\n\nTry it: ```python import Sofa```\n\n### The SofaRuntime python module:\n\n- access the runtime specific stuff (GUI, GLViewers, runSofa internal status) [POC]\n- docstring with sphinx content [TBD]\n\nTry it: ```python import SofaRuntime```\n\n### Developer's environment\n\n- autogenerated documentation using sphinx [DONE]\n- automated update the docs from the c++'s docstring: https://sofapython3.readthedocs.io/en/latest/ [WIP]\n- code completion with common editor [WIP, some editor are not working with c++ modules]\n\n\n### Execution environment: \n\n- SofaPython3 is a plugin to include a python3 environment in a Sofa scene [DONE],\n\nTry it: ```xml \u003cRequiredPlugin='SofaPython3'/\u003e```\n\n\n- Sofa and SofaRuntime are the python module that can be imported in any python interpreter (python3, ipython, jupyter)[DONE], \n\nTry it: ```python python3 minimalscene.py```\n\n- Access to Sofa simulation within the MathLab python interpreter [WIP-POC].  \n- Make a full python GUI application (with UI framework like PySide2, pygame) and render an integrated sofa scene in an opengl context [POC]\n \n\n## Development history:\n### June 19, 2019\n- documentation extraction from .cpp (Thierry)\n- refactoring the modules \u0026 SofaRuntime (Jean Nicolas)\n- Data access \u0026 code cleaning (Bruno)\n```python3\nc1 = root.addChild(\"child1\")\nc2 = root.addChild(\"child2\")\no1 = root.addObject(\"MechanicalObject\", dofs)\np = root.child1.child2.dofs.position         ## Slow acces to data \np = root[\"child1.child2.dofs.position\"]      ## Ffast access\n```\n- improve onEvent() method in Controller (Bruno)\n- autodoc \u0026 docstring generation on https://sofapython3.readthedocs.io/en/latest/ (Damien)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsofa-framework%2Fsofapython3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsofa-framework%2Fsofapython3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsofa-framework%2Fsofapython3/lists"}