maiself / godot-python-extension

Python language bindings for the Godot game engine
https://godot-python-extension.readthedocs.io
MIT License
24 stars 4 forks source link
gdextension godot language-bindings python

godot-python-extension

[!WARNING]

This repository is a work in progress and should be considered experimental. It is not production ready.

Please use version control with any project.

This repository provides Python language bindings for the Godot game engine.

The bindings are implemented as a GDExtension that exposes Godot's APIs and enables extension classes and scripts to be written in Python.

Structure

This project can be thought as having three layers:

Building

[!NOTE]

Godot version 4.2 or later is required to build and load this extension.

To clone and initialize the repository:

git clone https://github.com/maiself/godot-python-extension.git
cd godot-python-extension
git submodule update --init

To build run from the project root:

scons godot=<PATH_TO_GODOT_BINARY>

The path to the godot binary is needed to extract the gdextension_interface.h and extension_api.json files from the engine. The built extension shared object will be placed in bin/.

[!NOTE]

Currently this project has only been tested on Linux with Python versions 3.11 and 3.12. Modifications to the SConstruct file may be needed for other platform configurations. Please submit issues and pull requests for any problems you run into.

Development

The main parts are functional, but much is still in progress.

The godot module has the same API layout and stability for everything provided by Godot itself, but Python specific interfaces may still need adjusting.

Currently the system installed Python is used, but embedded and isolated build should be easy to add.

Many XXX: comments are present, most of which currently lack a description. These are marking potential defects in the code: bugs, hacks, partial implementations, or things to check for correctness; and should be documented, fixed and removed when possible.

Documentation on development and use needs to be expanded on.

Contributions of any kind are highly welcomed!