khbalhandawi / pysgtelib

A python wrapper for SGTELIB

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pySGTELIB a python wrapper for SGTELIB

This project provides a python programming interface for SGTELIB using pybind11, so that the C++ methods and classes defined in SGTELIB are usable in python.

Quickstart: Building with CMake

The project uses a CMakeLists.txt file to define the build project and compile the SGTELIB library. You need to compile it successfully so that the python wrapper works

Prerequisites

To complete this tutorial, you'll need:

  • A compatible operating system (e.g. Linux, macOS, Windows).
  • A compatible C++ compiler that supports at least C++14.
  • CMake and a compatible build tool for building the project.
  • A Python distribution to run the scripts and compile the pybind11 library .so file which will be imported. Recommended distributions:
  • A PDM installation for python environment management

If you don't already have CMake installed, see the CMake installation guide.

Note: The terminal commands in this tutorial show a Unix shell prompt and this has not been tested on Windows.

Building the project

First clone the repository:

git clone --recurse-submodules https://github.com/khbalhandawi/pysgtelib.git
cd pysgtelib

Now, in root create a virtual environment

pdm install

Next, build the module using

mkdir build
cd build
cmake -S .. -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release
cmake --install . --config Release

This should create a pysgtelib.cpython-39-x86_64-linux-gnu.so file in your build directory. The file name will vary based on your python version and linux distribution.

Optional: Generate stub file .pyi to help you with intellisense and be able to understand how to use pysgtelib

stubgen -m pysgtelib -o .

You may run your python scripts now. For example test.py

About

A python wrapper for SGTELIB

License:GNU Lesser General Public License v2.1


Languages

Language:Python 51.4%Language:C++ 38.3%Language:CMake 10.2%