Skip to content

Prepare the Python examples

Documented releasev0.2.0/Stable main branch

Python modules use the same services and Shell commands as C++ modules. First build the native Python SDK; after that, write your module logic in .py files.

This guide uses Windows, PowerShell, and 64-bit CPython 3.13 with the GIL enabled. You still need the C++ tools from the build guide. Use the MSVC x64 developer environment, with cl, nmake, cmake and ninja available.

Run these commands where you want to keep the project. If you already have open-vinc-examples, enter that directory and skip cloning it.

Terminal window
git clone --branch main https://github.com/JayTDawgzone1994/open-vinc-examples.git
cd open-vinc-examples
git submodule update --init framework/open-vinc
git -C framework/open-vinc submodule update --init --recursive
npm ci --prefix framework/open-vinc/src/vinc/ui/web

Run all remaining commands from this repository root. Avoid spaces in the Windows project path for this version’s Tcl build.

With 64-bit CPython 3.13 installed:

Terminal window
py -3.13 -m venv .venv

This creates a project environment in .venv/. You can use its Python executable directly without activating it. Use a CPython installation compatible with MSVC; a MinGW Python installation cannot build this extension.

Terminal window
cmake -S python -B build/python -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build build/python

The first build compiles the framework and its Python extension. There is no separate pip install vinc step.

The example selects the project’s .venv through python/vinc.conf.in and copies these ten modules beside the executable:

build/python/
├── Vinc.exe
├── python/vinc/ # Generated SDK
└── data/module/
├── helloModule/helloModule.py
├── counterPublisher/counterPublisher.py
├── counterSubscriber/counterSubscriber.py
├── parameterPublisher/parameterPublisher.py
├── rpcPublisher/rpcPublisher.py
├── rpcSubscriber/rpcSubscriber.py
├── logPublisher/logPublisher.py
├── logSubscriber/logSubscriber.py
├── sensorPublisher/sensorPublisher.py
└── sensorSubscriber/sensorSubscriber.py
Terminal window
.\build\python\Vinc.exe --python .\.venv\Scripts\python.exe

--python selects the same environment used for the build. Keep this option in the Python examples so Vinc does not accidentally select another Python from PATH.

Once you see VINC ready, enter exit to close it. Starting a module is the next lesson.

Use another Python environment

The example defaults to the project’s .venv. To use another environment, configure with -DTUTORIAL_PYTHON_EXECUTABLE=absolute/path/to/python and point the runtime --python option to that same compatible environment.

The Python minor version, 64-bit platform and GIL configuration must match the binding. See the Python SDK for its requirements.

Open Your first running module and select the Python tab. The language selection carries over to the next lessons.

After editing a module under python/modules/, run cmake --build build/python to copy the changes, then restart Vinc. Changing only Python code does not require recompiling the SDK. Changing a .msg definition does.