Python support for Godot 🐍🐍🐍

Overview
Github action tests Code style: black

Godot Python, because you want Python on Godot !

The goal of this project is to provide Python language support as a scripting module for the Godot game engine.

Quickstart

By order of simplicity:

  • Directly download the project from within Godot with the asset library tab.
  • Download from the asset library website.
  • Finally you can also head to the project release page if you want to only download one specific platform build

https://github.com/touilleMan/godot-python/raw/master/misc/showcase.png

API

example:

) to achieve # similar goal than GDSscript's `export` keyword name = export(str) # Can export property as well @export(int) @property def age(self): return self._age @age.setter def age(self, value): self._age = value # All methods are exposed to Godot def talk(self, msg): print(f"I'm saying {msg}") def _ready(self): # Don't confuse `__init__` with Godot's `_ready`! self.weapon = WEAPON_RES.instance() self._age = 42 # Of course you can access property & methods defined in the parent name = self.get_name() print(f"{name} position x={self.position.x}, y={self.position.y}") def _process(self, delta): self.position += SPEED * delta ... class Helper: """ Other classes are considered helpers and cannot be called from outside Python. However they can be imported from another python module. """ ... ">
# Explicit is better than implicit
from godot import exposed, export, Vector2, Node2D, ResourceLoader

WEAPON_RES = ResourceLoader.load("res://weapon.tscn")
SPEED = Vector2(10, 10)

@exposed
class Player(Node2D):
        """
        This is the file's main class which will be made available to Godot. This
        class must inherit from `godot.Node` or any of its children (e.g.
        `godot.KinematicBody`).

        Because Godot scripts only accept file paths, you can't have two `exposed` classes in the same file.
        """
        # Exposed class can define some attributes as export(
   
    ) to achieve
   
        # similar goal than GDSscript's `export` keyword
        name = export(str)

        # Can export property as well
        @export(int)
        @property
        def age(self):
                return self._age

        @age.setter
        def age(self, value):
                self._age = value

        # All methods are exposed to Godot
        def talk(self, msg):
                print(f"I'm saying {msg}")

        def _ready(self):
                # Don't confuse `__init__` with Godot's `_ready`!
                self.weapon = WEAPON_RES.instance()
                self._age = 42
                # Of course you can access property & methods defined in the parent
                name = self.get_name()
                print(f"{name} position x={self.position.x}, y={self.position.y}")

        def _process(self, delta):
                self.position += SPEED * delta

        ...


class Helper:
        """
        Other classes are considered helpers and cannot be called from outside
        Python. However they can be imported from another python module.
        """
        ...

Building

To build the project from source, first checkout the repo or download the latest tarball.

Godot-Python requires Python >= 3.7 and a C compiler.

Godot GDNative header

The Godot GDNative headers are provided as git submodule:

$ git submodule init
$ git submodule update

Alternatively, you can get them from github.

Linux

On a fresh Ubuntu install, you will need to install these:

$ apt install python3 python3-pip python3-venv build-essential

On top of that build the CPython interpreter requires development headers of it extension modules (for instance if you lack sqlite dev headers, your Godot-Python build won't contain the sqlite3 python module)

The simplest way is to uncomment the main deb-src in /etc/apt/sources.list:

deb-src http://archive.ubuntu.com/ubuntu/ artful main

and instruct apt to install the needed packages:

$ apt update
$ apt build-dep python3.6

See the Python Developer's Guide for instructions on additional platforms.

MacOS

With MacOS, you will need XCode installed and install the command line tools.

$ xcode-select --install

If you are using CPython as your backend, you will need these. To install with Homebrew:

$ brew install python3 openssl zlib

You will also need virtualenv for your python.

Windows

Install VisualStudio and Python3, then submit a PR to improve this paragraph ;-)

Create the virtual env

Godot-Python build system is heavily based on Python (mainly Scons, Cython and Jinja2). Hence we have to create a Python virtual env to install all those dependencies without clashing with your global Python configuration.

$ cd <godot-python-dir>
godot-python$ python3 -m venv venv

Now you need to activate the virtual env, this is something you should do every time you want to use the virtual env.

For Linux/MacOS:

godot-python$ . ./venv/bin/activate

For Windows:

godot-python$ ./venv/bin/activate.bat

Finally we can install dependencies:

godot-python(venv)$ pip install -r requirements.txt

Running the build

For Linux:

godot-python(venv)$ scons platform=x11-64 release

For Windows:

godot-python(venv)$ scons platform=windows-64 release

For MacOS:

godot-python(venv)$ scons platform=osx-64 CC=clang release

Valid platforms are x11-64, x11-32, windows-64, windows-32 and osx-64. Check Travis or Appveyor links above to see the current status of your platform.

This command will checkout CPython repo, move to a pinned commit and build CPython from source.

It will then generate pythonscript/godot/bindings.pyx (Godot api bindings) from GDNative's api.json and compile it. This part is long and really memory demanding so be patient ;-) When hacking godot-python you can heavily speedup this step by passing sample=true to scons in order to build only a small subset of the bindings.

Eventually the rest of the source will be compiled and a zip build archive will be available in the build directory.

Testing your build

godot-python(venv)$ scons platform=<platform> test

This will run pytests defined in tests/bindings inside the Godot environment. If not present, will download a precompiled Godot binary (defined in SConstruct and platform specific SCSub files) to and set the correct library path for the GDNative wrapper.

Running the example project

godot-python(venv)$ scons platform=<platform> example

This will run the converted pong example in examples/pong inside the Godot environment. If not present, will download a precompiled Godot binary (defined in SConstruct) to and set the correct library path for the GDNative wrapper.

Using a local Godot version

If you have a pre-existing version of godot, you can instruct the build script to use that the static library and binary for building and tests.

godot-python(venv)$ scons platform=x11-64 godot_binary=../godot/bin/godot.x11.opt.64

Additional build options

You check out all the build options in this file.

FAQ

How can I export my project?

Currently, godot-python does not support automatic export, which means that the python environment is not copied to the release when using Godot's export menu. A release can be created manually:

First, export the project in .zip format.

Second, extract the .zip in a directory. For sake of example let's say the directory is called godotpythonproject.

Third, copy the correct Python environment into this folder (if it hasn't been automatically included in the export). Inside your project folder, you will need to find /addons/pythonscript/x11-64, replacing "x11-64" with the correct target system you are deploying to. Copy the entire folder for your system, placing it at the same relative position, e.g. godotpythonproject/addons/pythonscript/x11-64 if your unzipped directory was "godotpythonproject". Legally speaking you should also copy LICENSE.txt from the pythonscript folder. (The lazy option at this point is to simply copy the entire addons folder from your project to your unzipped directory.)

Fourth, place a godot release into the directory. The Godot export menu has probably downloaded an appropriate release already, or you can go to Editor -> Manage Export Templates inside Godot to download fresh ones. These are stored in a location which depends on your operating system. For example, on Windows they may be found at %APPDATA%\Godot\templates\ ; in Linux or OSX it is ~/.godot/templates/. Copy the file matching your export. (It may matter whether you selected "Export With Debug" when creating the .zip file; choose the debug or release version accordingly.)

Running the Godot release should now properly execute your release. However, if you were developing on a different Python environment (say, the one held in the osx-64 folder) than you include with the release (for example the windows-64 folder), and you make any alterations to that environment, such as installing Python packages, these will not carry over; take care to produce a suitable Python environment for the target platform.

See also this issue.

How can I use Python packages in my project?

In essence, godot-python installs a python interpreter inside your project which can then be distributed as part of the final game. Python packages you want to use need to be installed for that interpreter and of course included in the final release. This can be accomplished by using pip to install packages; however, pip is not provided, so it must be installed too.

First, locate the correct python interpreter. This will be inside your project at addons\pythonscript\windows-64\python.exe for 64-bit Windows, addons/pythonscript/ox-64/bin/python3 for OSX, etc. Then install pip by running:

addons\pythonscript\windows-64\python.exe -m ensurepip

(substituting the correct python for your system). Any other method of installing pip at this location is fine too, and this only needs to be done once. Afterward, any desired packages can be installed by running

addons\pythonscript\windows-64\python.exe -m pip install numpy

again, substituting the correct python executable, and replacing numpy with whatever packages you desire. The package can now be imported in your Python code as normal.

Note that this will only install packages onto the target platform (here, windows-64), so when exporting the project to a different platform, care must be taken to provide all the necessary libraries.

How can I debug my project with PyCharm?

This can be done using "Attach to Local Process", but first you have to change the Godot binary filename to include python, for example Godot_v3.0.2-stable_win64.exe to python_Godot_v3.0.2-stable_win64.exe. For more detailed guide and explanation see this external blog post.

How can I autoload a python script without attaching it to a Node?

In your project.godot file, add the following section:

[autoload]
autoloadpy="*res://autoload.py"

In addition to the usual:

[gdnative]
singletons=[ "res://pythonscript.gdnlib" ]

You can use any name for the python file and the class name autoloadpy.

Then autoload.py can expose a Node:

from godot import exposed, export
from godot.bindings import *

@exposed
class autoload(Node):

    def hi(self, to):
        return 'Hello %s from Python !' % to

which can then be called from your gdscript code as an attribute of the autoloadpy class (use the name defined in your project.godot):

print(autoloadpy.hi('root'))

How can I efficiently access PoolArrays?

PoolIntArray, PoolFloatArray, PoolVector3Array and the other pool arrays can't be accessed directly because they must be locked in memory first. Use the arr.raw_access() context manager to lock it:

arr = PoolIntArray() # create the array
arr.resize(10000)

with arr.raw_access() as ptr:
    for i in range(10000):
        ptr[i] = i # this is fast

# read access:
with arr.raw_access() as ptr:
    for i in range(10000):
        assert ptr[i] == i # so is this

Keep in mind great performances comes with great responsabilities: there is no boundary check so you may end up with memory corruption if you don't take care ;-)

See the godot-python issue.

Comments
  • How to use external python libraries in a godot project with virtualenv?

    How to use external python libraries in a godot project with virtualenv?

    As changing the python interpreter to that of one in a virtualenv breaks linting and library import in vscode, I don't understand how to use the python executable bundled with the library ( and its associated site packages ) with a virtual env and pip

    opened by creikey 18
  • Add support for optional arguments. TypeError messages same as python's

    Add support for optional arguments. TypeError messages same as python's

    Hi there, I looked into issue #27 wich seamed like a rather important missing feature.

    Now, despite the note in that issue about attribute 'default_args' being empty I guess some time has passed and that's not the case anymore so I used that and made it possible to leave optional arguments implicit, although I haven't looked into support for using keyword arguments yet.

    I also changed the TypeError messages to be the same as python's default TypeError messages when passing too many or too few arguments to a function.

    opened by paolobb4 18
  • Suggestion: Do a windows build available

    Suggestion: Do a windows build available

    Linux is a wonderfull system, but, by the fact, most godot users (me include) have windows in their computers. If is needed some testing in godot-python binding, maybe there will be a compilation for windows available in the main page of Godot. I know that 90% of godot devΒ΄s have linux, but 90% of godot users have windows (Percentages invented with a reliability of 90%)

    opened by Ranoller 18
  • Error on import numba: module '_godot' has no attribute 'print_override'

    Error on import numba: module '_godot' has no attribute 'print_override'

    I'm on Ubuntu 18.04, Godot 3.2.2 through standard 64-bit download.

    I seem to be able to import python libraries by adding a path to where the python libraries are on disk in the Project Settings> General> Filesystem> Python Script> Path using the Godot editor.

    I'm using conda, and I've added /home/[username]/anaconda3/lib/python3.8; /home/[username]/anaconda3/lib/python3.8/lib-dynload;/home/[username]/anaconda3/lib/python3.8/site-packages

    which seems to make packages such as math, numpy, etc importable in Godot. When I try to import a package called numba however, I get the following error:

      File "/home/[username]/pCloudDrive/03_Passive_freedom/evo_design/models/godot/python_godot_2/Spatial.py", line 4, in <module>
        import numba
      File "/home/[username]/anaconda3/lib/python3.8/site-packages/numba/__init__.py", line 34, in <module>
        from numba.core.decorators import (cfunc, generated_jit, jit, njit, stencil,
      File "/home/[username]/anaconda3/lib/python3.8/site-packages/numba/core/decorators.py", line 12, in <module>
        from numba.stencils.stencil import stencil
      File "/home/[username]/anaconda3/lib/python3.8/site-packages/numba/stencils/stencil.py", line 11, in <module>
        from numba.core import types, typing, utils, ir, config, ir_utils, registry
      File "/home/[username]/anaconda3/lib/python3.8/site-packages/numba/core/registry.py", line 4, in <module>
        from numba.core import utils, typing, dispatcher, cpu
      File "/home/[username]/anaconda3/lib/python3.8/site-packages/numba/core/dispatcher.py", line 15, in <module>
        from numba.core import utils, types, errors, typing, serialize, config, compiler, sigutils
      File "/home/[username]/anaconda3/lib/python3.8/site-packages/numba/core/compiler.py", line 6, in <module>
        from numba.core import (utils, errors, typing, interpreter, bytecode, postproc,
      File "/home/[username]/anaconda3/lib/python3.8/site-packages/numba/core/callconv.py", line 11, in <module>
        from numba.core.base import PYOBJECT, GENERIC_POINTER
      File "/home/[username]/anaconda3/lib/python3.8/site-packages/numba/core/base.py", line 23, in <module>
        from numba.cpython import builtins
      File "/home/[username]/anaconda3/lib/python3.8/site-packages/numba/cpython/builtins.py", line 490, in <module>
        from numba.core.typing.builtins import IndexValue, IndexValueType
      File "/home/[username]/anaconda3/lib/python3.8/site-packages/numba/core/typing/builtins.py", line 23, in <module>
        @infer_global(print)
      File "/home/[username]/anaconda3/lib/python3.8/site-packages/numba/core/typing/templates.py", line 1149, in register_global
        if getattr(mod, val.__name__) is not val:
    AttributeError: module '_godot' has no attribute 'print_override'
    

    That the code refers to 'print_override' suggests to my mind that there might be many errors that is attempted to be printed, but it fails to do so because of the missing attribute of 'print_override'.

    Does anyone have any ideas on what the problem could be? Since it works to import other libraries, such as numpy, there could be something specifically wrong with the numba library. Importing numba in a normal python script works however.

    opened by thetoblin 14
  • Can't return string from function

    Can't return string from function

    I'm trying to use this wonderful code, but I can't seem to do the simplest things.

    I have the following Python code:

    from godot import exposed, export
    from godot.bindings import TileMap
    from random import choice, randint
    
    @exposed
    class Thing(TileMap):
    
        names = ["Mike","Bill", "James", "Robert"]
    
        thing1 = "Hi, I'm thing1."
        thing2 = "Hi, I'm thing2."
        some_number = 0
    
        def fly(self):
            print("Go fly a kite!")
    
        def get_name(self):
            name = choice(self.names)
            return name
        
        def do_number(self):
            self.some_number = randint(1,10)
        
        def get_number(self):
            return randint(1,10)
            
        def get_that_guy(self):
            b = "It's the man! Run!"
            return b
    

    When I use the function which returns a number (in this case, an integer), it works fine. But when I try a string, it doesn't work. So I have this code:

    extends Node2D
    
    func _ready():
        var b = get_node("py_code")
        print("The random number chosen is %s." % b.get_number)
        print(b.get_that_guy())
    

    It prints out "The random number is 5.", but it doesn't print "It's the man! Run!" So I am at a loss as to why my strings are not being returned from the function. FWIW, I am using Godot 3.0 alpha (very recent version) with recent Python bindings.

    opened by Ertain 11
  • pypy version closes editor on run

    pypy version closes editor on run

    When a scene is played with pypy as GDNative Library it closes the editor although the scene runs and works correctly,

    It does not happen when CPython is used.

    Tested on Linux amd64, with both Godot master and Godot beta.

    opened by deep-gaurav 11
  • Conversion of Python (NumPy) array to Godot PoolByteArray is slow

    Conversion of Python (NumPy) array to Godot PoolByteArray is slow

    We'd like to convert Matplotlib renderings into Godot textures. We got this working (see https://github.com/boku-ilen/landscapelab/blob/master/Python/PythonTest.py), but the performance is pretty bad. Specifically, this line:

    pool_array = PoolByteArray(array.flatten())
    

    which turns a NumPy array of size 3686400 into a Godot PoolByteArray, takes 500ms on average. I realize that it's a large array, but it seems like too big of a bottleneck - it's the most time-consuming operation of the entire script by far.

    I initially suspected that the problem lies somewhere around here: https://github.com/touilleMan/godot-python/blob/master/generation/builtins_templates/array.tmpl.pxi#L44 My first idea was to modify it to self.resize() once and then set the elements by index, rather than appending, but this caused no difference in performance (which I found surprising). I tried the same in https://github.com/touilleMan/godot-python/blob/master/generation/pool_arrays_templates/pool_x_array.tmpl.pyx#L32 with a similarly non-significant effect.

    However, I later realized that the problem seems to be inherent in setting data in any Godot Array one by one: when I iterate over 3686400 elements and put them into a PoolByteArray in GDScript, I get the same timings of around 500ms. If I instead construct a PoolByteArray out of a Godot Array (again in GDScript) directly, it takes <100ms on average.

    Thus, it seems like the only way to drastically improve performance here would be to do a more direct memory-copy of a NumPy Array into a Godot Array or PoolByteArray. I don't know much about under-the-hood memory management in Python and NumPy; does anyone here have an idea of if and how this could be accomplished? Alternatively, maybe there's some indirection here that could be improved by adding more specialized code into the Cython codebase of the addon?

    TL;DR: Manually constructing a PoolByteArray by setting each element is slow, both in GDScript and in PythonScript. Is there a way to do a more direct memory-copy of a NumPy Array into a Godot Array or PoolByteArray?

    Thank you for the great plugin by the way! Even if the performance issues persist, being able to use Python libraries like Matplotlib in Godot is really powerful.

    opened by kb173 10
  • Attempts to download wrong cpython version on Python 3.8.3

    Attempts to download wrong cpython version on Python 3.8.3

    So I've been trying to use godot-python for the past couple weeks to put some of my AI work into a game I'm working on. I've tried nearly everything to get it to work on my project from re-installing python and everything else, using different versions, Mac and Windows. Nothing has worked.

    Attempted to do this, but it doesn't work: https://www.reddit.com/r/godot/comments/e56oae/pythongodot_setup_tutorial/ now I most recently tried to clone the repository and build it on my mac. I have python 3.8.3 and was following directions on the readme. I get this Capture d'Γ©cran 2020-06-28 12 19 05

    If anyone could please offer some assistance, I'd greatly appreciate it as well. I've tried to research and attempt every guide I could find over the past 2 weeks. I can't get this to work. But that is unrelated to the issue above

    opened by MaxBleggi 10
  • Trying to get the example working, but errors just pop up

    Trying to get the example working, but errors just pop up

    Hi,

    I am trying to have an example working with python, but cant get it to work I'm using Godot 3.2 in Ubuntu 18. When I open the pong example hay get the broken dependencies issue. And when opening anyway the project, then when installing the python asset, it give another error:

    ** the following files failed extraction from package:

    res://pythonscript/osx-64-python/.gdignores:://pythonscript/osx-64..... And 9984 more files.

    Any idea?

    I would like to make a working example for Godot 3.2 for everyone to be able to use this great asset. I want to use loads of python modules in Godot, so for sure I would love to mak esome tutorials on the matter.

    But this issue is just to strange to make head or tails of it.

    Any suggestion? Any procedure to have a working plug and play example?

    Thanks in advance

    opened by RDaneelOlivav 10
  • Can't build against latest gdnative headers in godot repo

    Can't build against latest gdnative headers in godot repo

    I don't know if this is supposed to work, but I tried building godot-python using the latest 3ad9e4740 godot, using its gdnative headers and wrapper lib directly, and it doesn't build on Windows. Here's the scons command I used: scons -j16 platform=windows-64 backend=cpython godot_binary=../godot/bin/godot.windows.opt.tools.64.exe MSVC_USE_SCRIPT=True gdnative_include_dir=../godot/modules/gdnative/include gdnative_wrapper_lib=../godot/bin/gdnative_wrapper_code.windows.opt.tools.lib The errors are these:

    link /nologo /dll /out:pythonscript\pythonscript.dll /implib:pythonscript\pythonscript.lib /LIBPATH:platforms\windows-64\cpython\PCBuild\amd64 python36.lib ../godot/bin/gdnative_wrapper_code.windows.opt.64.lib pythonscript\pythonscript.obj pythonscript\cffi_bindings.gen.obj
    cffi_bindings.gen.obj : error LNK2019: unresolved external symbol godot_nativescript_set_method_argument_information referenced in function _cffi_start_python
    cffi_bindings.gen.obj : error LNK2019: unresolved external symbol godot_nativescript_set_class_documentation referenced in function _cffi_start_python
    cffi_bindings.gen.obj : error LNK2019: unresolved external symbol godot_nativescript_set_method_documentation referenced in function _cffi_start_python
    cffi_bindings.gen.obj : error LNK2019: unresolved external symbol godot_nativescript_set_property_documentation referenced in function _cffi_start_python
    cffi_bindings.gen.obj : error LNK2019: unresolved external symbol godot_nativescript_set_signal_documentation referenced in function _cffi_start_python
    cffi_bindings.gen.obj : error LNK2019: unresolved external symbol godot_nativescript_set_global_type_tag referenced in function _cffi_start_python
    cffi_bindings.gen.obj : error LNK2019: unresolved external symbol godot_nativescript_get_global_type_tag referenced in function _cffi_start_python
    cffi_bindings.gen.obj : error LNK2019: unresolved external symbol godot_nativescript_set_type_tag referenced in function _cffi_start_python
    cffi_bindings.gen.obj : error LNK2019: unresolved external symbol godot_nativescript_get_type_tag referenced in function _cffi_start_python
    cffi_bindings.gen.obj : error LNK2019: unresolved external symbol godot_nativescript_register_instance_binding_data_functions referenced in function _cffi_start_python
    cffi_bindings.gen.obj : error LNK2019: unresolved external symbol godot_nativescript_unregister_instance_binding_data_functions referenced in function _cffi_start_python
    cffi_bindings.gen.obj : error LNK2019: unresolved external symbol godot_nativescript_get_instance_binding_data referenced in function _cffi_start_python
    pythonscript\pythonscript.dll : fatal error LNK1120: 12 unresolved externals```
    
    It builds fine without using the `gdnative_include_dir=...` arg, so feel free to close this issue if this isn't expected to work.
    wontfix 
    opened by garyo 9
  • Fix link target of libpython on OSX

    Fix link target of libpython on OSX

    Fix for #76. Use "install_name_tool" to change link target of libpython from "/Users/travis/build/touilleMan/godot-python/platforms/osx-64/cpython_build/lib/libpython3.6m.dylib" to "@loader_path/lib/libpython3.6m.dylib".

    opened by ColinKinloch 9
  • get_children() not working when Label3D is a child.

    get_children() not working when Label3D is a child.

    Godot v3.5.stable.official [991bb6ac7] Maybe this is because Label3D is a new type of object and it is not in object types list somewhere?

    Pythonscript 0.50.0 (CPython 3.8.5.final.0)
    Traceback (most recent call last):
      File "build/x11-64/pythonscript/_godot_instance.pxi", line 98, in _godot.pythonscript_instance_call_method
      File "/home/mariomey/md-godot/test_godot_3.5/cubo_armature.py", line 24, in _ready
        print(self.get_children())
      File "build/x11-64/pythonscript/godot/builtins.pyx", line 3018, in godot.builtins.Array.__repr__
      File "build/x11-64/pythonscript/godot/builtins.pyx", line 3080, in __iter__
      File "build/x11-64/pythonscript/godot/builtins.pyx", line 3185, in godot.builtins.Array.get
      File "build/x11-64/pythonscript/godot/_hazmat/conversion.pyx", line 168, in godot._hazmat.conversion.godot_variant_to_pyobj
      File "build/x11-64/pythonscript/godot/_hazmat/conversion.pyx", line 284, in godot._hazmat.conversion._godot_variant_to_pyobj_object
      File "build/x11-64/pythonscript/godot/bindings.pyx", line 198, in godot.bindings.Object.cast_from_variant
    KeyError: 'Label3D'
    

    Can this be fixed... in this version 3.5? Pleeeaaseee...? 😁

    opened by MarioMey 0
  • Cant set shader parameter on custom visual shader

    Cant set shader parameter on custom visual shader

    After some tweaking ive stumbled into a problem : ive made simple visual shader and gave it a TextureUniform called "Emission" In godot python ive referenced the material with the shader and called

      self.material.set_shader_param( "Emission", self.texture )
    

    but im getting an error :

    obraz

    also when i do

      print(self.material.get_shader())
    

    it returns None, so im guessing either im making some cryptic mistake or there is a bug that does not allow the shader to be used.

    opened by TheBricktop 0
  • Build failure

    Build failure

    scons 4.4.0, cython 0.29.32, Python 3.10 building for https://github.com/7BIndustries/Semblage/blob/master/.github/workflows/export.yml :

    scons: Reading SConscript files ...
    scons: done reading SConscript files.
    scons: Building targets ...
    python generation/generate_gdnative_api_struct.py --input godot_headers --output build/x11-64/pythonscript/godot/_hazmat/gdnative_api_struct.pxd
    python generation/generate_bindings.py --input godot_headers/api.json --output build/x11-64/pythonscript/godot/bindings.pyx
    ./godot-python/generation/generate_bindings.py:284: UserWarning: Ignoring `Object.call` (attribute `has_varargs=True` not supported)
      warn(f"Ignoring `{klass.name}.{meth.name}` ({unsupported_reason})")
    ./godot-python/generation/generate_bindings.py:284: UserWarning: Ignoring `Object.call_deferred` (attribute `has_varargs=True` not supported)
      warn(f"Ignoring `{klass.name}.{meth.name}` ({unsupported_reason})")
    ./godot-python/generation/generate_bindings.py:284: UserWarning: Ignoring `Object.emit_signal` (attribute `has_varargs=True` not supported)
      warn(f"Ignoring `{klass.name}.{meth.name}` ({unsupported_reason})")
    ./godot-python/generation/generate_bindings.py:284: UserWarning: Ignoring `Node.rpc` (attribute `has_varargs=True` not supported)
      warn(f"Ignoring `{klass.name}.{meth.name}` ({unsupported_reason})")
    ./godot-python/generation/generate_bindings.py:284: UserWarning: Ignoring `Node.rpc_id` (attribute `has_varargs=True` not supported)
      warn(f"Ignoring `{klass.name}.{meth.name}` ({unsupported_reason})")
    ./godot-python/generation/generate_bindings.py:284: UserWarning: Ignoring `Node.rpc_unreliable` (attribute `has_varargs=True` not supported)
      warn(f"Ignoring `{klass.name}.{meth.name}` ({unsupported_reason})")
    ./godot-python/generation/generate_bindings.py:284: UserWarning: Ignoring `Node.rpc_unreliable_id` (attribute `has_varargs=True` not supported)
      warn(f"Ignoring `{klass.name}.{meth.name}` ({unsupported_reason})")
    ./godot-python/generation/generate_bindings.py:284: UserWarning: Ignoring `TreeItem.call_recursive` (attribute `has_varargs=True` not supported)
      warn(f"Ignoring `{klass.name}.{meth.name}` ({unsupported_reason})")
    ./godot-python/generation/generate_bindings.py:284: UserWarning: Ignoring `UndoRedo.add_do_method` (attribute `has_varargs=True` not supported)
      warn(f"Ignoring `{klass.name}.{meth.name}` ({unsupported_reason})")
    ./godot-python/generation/generate_bindings.py:284: UserWarning: Ignoring `UndoRedo.add_undo_method` (attribute `has_varargs=True` not supported)
      warn(f"Ignoring `{klass.name}.{meth.name}` ({unsupported_reason})")
    ./godot-python/generation/generate_bindings.py:284: UserWarning: Ignoring `FuncRef.call_func` (attribute `has_varargs=True` not supported)
      warn(f"Ignoring `{klass.name}.{meth.name}` ({unsupported_reason})")
    ./godot-python/generation/generate_bindings.py:284: UserWarning: Ignoring `GDScriptFunctionState._signal_callback` (attribute `has_varargs=True` not supported)
      warn(f"Ignoring `{klass.name}.{meth.name}` ({unsupported_reason})")
    ./godot-python/generation/generate_bindings.py:284: UserWarning: Ignoring `VisualScriptFunctionState._signal_callback` (attribute `has_varargs=True` not supported)
      warn(f"Ignoring `{klass.name}.{meth.name}` ({unsupported_reason})")
    ./godot-python/generation/generate_bindings.py:284: UserWarning: Ignoring `GDScript.new` (attribute `has_varargs=True` not supported)
      warn(f"Ignoring `{klass.name}.{meth.name}` ({unsupported_reason})")
    ./godot-python/generation/generate_bindings.py:284: UserWarning: Ignoring `NativeScript.new` (attribute `has_varargs=True` not supported)
      warn(f"Ignoring `{klass.name}.{meth.name}` ({unsupported_reason})")
    ./godot-python/generation/generate_bindings.py:284: UserWarning: Ignoring `PluginScript.new` (attribute `has_varargs=True` not supported)
      warn(f"Ignoring `{klass.name}.{meth.name}` ({unsupported_reason})")
    ./godot-python/generation/generate_bindings.py:284: UserWarning: Ignoring `ArrayMesh.lightmap_unwrap` (attribute `is_editor=True` not supported)
      warn(f"Ignoring `{klass.name}.{meth.name}` ({unsupported_reason})")
    ./godot-python/generation/generate_bindings.py:284: UserWarning: Ignoring `ArrayMesh.regen_normalmaps` (attribute `is_editor=True` not supported)
      warn(f"Ignoring `{klass.name}.{meth.name}` ({unsupported_reason})")
    ./godot-python/generation/generate_bindings.py:284: UserWarning: Ignoring `CollisionShape.make_convex_from_brothers` (attribute `is_editor=True` not supported)
      warn(f"Ignoring `{klass.name}.{meth.name}` ({unsupported_reason})")
    ./godot-python/generation/generate_bindings.py:284: UserWarning: Ignoring `GIProbe.debug_bake` (attribute `is_editor=True` not supported)
      warn(f"Ignoring `{klass.name}.{meth.name}` ({unsupported_reason})")
    ./godot-python/generation/generate_bindings.py:284: UserWarning: Ignoring `MeshInstance.create_debug_tangents` (attribute `is_editor=True` not supported)
      warn(f"Ignoring `{klass.name}.{meth.name}` ({unsupported_reason})")
    ./godot-python/generation/generate_bindings.py:284: UserWarning: Ignoring `SceneTree.call_group` (attribute `has_varargs=True` not supported)
      warn(f"Ignoring `{klass.name}.{meth.name}` ({unsupported_reason})")
    ./godot-python/generation/generate_bindings.py:284: UserWarning: Ignoring `SceneTree.call_group_flags` (attribute `has_varargs=True` not supported)
      warn(f"Ignoring `{klass.name}.{meth.name}` ({unsupported_reason})")
    Generating build/x11-64/pythonscript/godot/bindings.pyx
    Generating build/x11-64/pythonscript/godot/bindings.pyi
    Generating build/x11-64/pythonscript/godot/bindings.pxd
    python generation/generate_pool_arrays.py --output build/x11-64/pythonscript/godot/pool_arrays.pyx
    python generation/generate_builtins.py --input godot_headers/gdnative_api.json --output build/x11-64/pythonscript/godot/builtins.pyx
    Generating build/x11-64/pythonscript/godot/builtins.pyx
    Generating build/x11-64/pythonscript/godot/builtins.pyi
    Generating build/x11-64/pythonscript/godot/builtins.pxd
    Download https://github.com/indygreg/python-build-standalone/releases/download/20200822/cpython-3.8.5-x86_64-unknown-linux-gnu-pgo-20200823T0036.tar.zst
    extract_cpython_prebuild(["build/x11-64/platforms/x11-64/cpython_prebuild"], ["build/x11-64/platforms/x11-64/cpython-3.8.5-x86_64-unknown-linux-gnu-pgo-20200823T0036.tar.zst"])
    generate_cpython_build(["build/x11-64/platforms/x11-64/cpython_build"], ["build/x11-64/platforms/x11-64/cpython_prebuild"])
    cython --fast-fail -3 build/x11-64/pythonscript/_godot.pyx -o build/x11-64/pythonscript/_godot.c
    
    Error compiling Cython file:
    ------------------------------------------------------------
    ...
        godot_object *p_owner,
        godot_array *r_options,
        godot_bool *r_force,
        godot_string *r_call_hint
    ) with gil:
        return godot_error.GODOT_OK
                         ^
    ------------------------------------------------------------
    
    build/x11-64/pythonscript/_godot_editor.pxi:114:22: Compiler crash in AnalyseExpressionsTransform
    
    ModuleNode.body = StatListNode(_godot.pyx:8:0)
    StatListNode.stats[0] = StatListNode(_godot_editor.pxi:3:0)
    StatListNode.stats[4] = CFuncDefNode(_godot_editor.pxi:105:5,
        acquire_gil = 1,
        api = 1,
        args = [...]/7,
        modifiers = [...]/0,
        visibility = 'private')
    File 'Nodes.py', line 435, in analyse_expressions: StatListNode(_godot_editor.pxi:114:4,
        is_terminator = True)
    File 'Nodes.py', line 5968, in analyse_expressions: ReturnStatNode(_godot_editor.pxi:114:4,
        is_terminator = True)
    File 'ExprNodes.py', line 6888, in analyse_types: AttributeNode(_godot_editor.pxi:114:22,
        attribute = 'GODOT_OK',
        initialized_check = True,
        is_attribute = 1,
        needs_none_check = True,
        result_is_used = True,
        use_managed_ref = True)
    File 'ExprNodes.py', line 6959, in analyse_as_type_attribute: AttributeNode(_godot_editor.pxi:114:22,
        attribute = 'GODOT_OK',
        initialized_check = True,
        is_attribute = 1,
        needs_none_check = True,
        result_is_used = True,
        use_managed_ref = True)
    
    Compiler crash traceback from this point on:
      File "/usr/lib/python3.10/site-packages/Cython/Compiler/ExprNodes.py", line 6959, in analyse_as_type_attribute
        for entry in type.entry.enum_values:
    AttributeError: 'Entry' object has no attribute 'enum_values'
    scons: *** [build/x11-64/pythonscript/_godot.c] Error 1
    
    opened by kiufta 0
  • impossible to use wandb.

    impossible to use wandb.

    Hello, I'm not good enough to understand if the bug is on godot-python or wandb, but I wanted to let a note here just in case someone encounter the same problem as me.

    When trying to call wandb.init(), an error occurs, saying something like IsADirectoryError: [Errno 21] Is a directory: <your-project-dir>

    I finally found the solution to this problem. Before calling wandb.init(), make sure to set the variable sys.executable to the python executable in your plugin. For example, for me on Ubuntu, it was : sys.executable = "addons/pythonscript/x11-64/bin/python3.8"

    It was enough to make wandb work !

    bug 
    opened by Vaillus 1
  • Weird bug when using pip lib that connects to the external camera.

    Weird bug when using pip lib that connects to the external camera.

    Hey another issue ive ran into and this one is particulary weird : im using depthai from pypi to connect to the stereocamera and get some frames. While it can use the python interpreter provided by the godot-python module and it runs ok, the moment godot editor links to it it stops recognizing the device. I know this is very soecific problem and I can't possibly expect anyone to have this particular sensor but im rather asking about what might block a working device out of godot-python when they are connected. Another weird thing was when one of my scripts in python had def main (): and then main() construction because it started automatically when editor started and was running in the background. Both problems might be connected, and i think that the reslution could be to start the "daemon" that operates the device and after that another script would read the incoming data but thats a wild guess.

    Edit:

    The possible culprit might be that godot language server runs through all of the init and main functions in provided *.py files and then it effectively blocks the device from being used again as it is already engaged.

    opened by TheBricktop 2
  • Adding Custom Icons to Classes for Nodes

    Adding Custom Icons to Classes for Nodes

    This is a really minor thing, but I couldn't seem to figure out any way to do this. I know that in GDscript you could just specify a const string after the class declaration for the icon, but I don't know what the alternative would be for PythonScript. Is this functionality added yet and is there a way to do this?

    If not, could this be added in the future?

    opened by LunaticWyrm467 2
Releases(v0.50.0)
Owner
Emmanuel Leblond
Python & Open source lover
Emmanuel Leblond
Pglive - Pglive package adds support for thread-safe live plotting to pyqtgraph

Live pyqtgraph plot Pglive package adds support for thread-safe live plotting to

Martin DomarackΓ½ 15 Dec 10, 2022
Simple plotting for Python. Python wrapper for D3xter - render charts in the browser with simple Python syntax.

PyDexter Simple plotting for Python. Python wrapper for D3xter - render charts in the browser with simple Python syntax. Setup $ pip install PyDexter

D3xter 31 Mar 6, 2021
Visual Python is a GUI-based Python code generator, developed on the Jupyter Notebook environment as an extension.

Visual Python is a GUI-based Python code generator, developed on the Jupyter Notebook environment as an extension.

Visual Python 564 Jan 3, 2023
A Python Binder that merge 2 files with any extension by creating a new python file and compiling it to exe which runs both payloads.

Update ! ANONFILE MIGHT NOT WORK ! About A Python Binder that merge 2 files with any extension by creating a new python file and compiling it to exe w

Vesper 15 Oct 12, 2022
Declarative statistical visualization library for Python

Altair http://altair-viz.github.io Altair is a declarative statistical visualization library for Python. With Altair, you can spend more time understa

Altair 8k Jan 5, 2023
Interactive Data Visualization in the browser, from Python

Bokeh is an interactive visualization library for modern web browsers. It provides elegant, concise construction of versatile graphics, and affords hi

Bokeh 17.1k Dec 31, 2022
A grammar of graphics for Python

plotnine Latest Release License DOI Build Status Coverage Documentation plotnine is an implementation of a grammar of graphics in Python, it is based

Hassan Kibirige 3.3k Jan 1, 2023
a plottling library for python, based on D3

Hello August 2013 Hello! Maybe you're looking for a nice Python interface to build interactive, javascript based plots that look as nice as all those

Mike Dewar 1.4k Dec 28, 2022
UNMAINTAINED! Renders beautiful SVG maps in Python.

Kartograph is not maintained anymore As you probably already guessed from the commit history in this repo, Kartograph.py is not maintained, which mean

null 1k Dec 9, 2022
Tools for writing, submitting, debugging, and monitoring Storm topologies in pure Python

Petrel Tools for writing, submitting, debugging, and monitoring Storm topologies in pure Python. NOTE: The base Storm package provides storm.py, which

AirSage 247 Dec 18, 2021
The Python ensemble sampling toolkit for affine-invariant MCMC

emcee The Python ensemble sampling toolkit for affine-invariant MCMC emcee is a stable, well tested Python implementation of the affine-invariant ense

Dan Foreman-Mackey 1.3k Jan 4, 2023
The windML framework provides an easy-to-use access to wind data sources within the Python world, building upon numpy, scipy, sklearn, and matplotlib. Renewable Wind Energy, Forecasting, Prediction

windml Build status : The importance of wind in smart grids with a large number of renewable energy resources is increasing. With the growing infrastr

Computational Intelligence Group 125 Dec 24, 2022
Tools for exploratory data analysis in Python

Dora Exploratory data analysis toolkit for Python. Contents Summary Setup Usage Reading Data & Configuration Cleaning Feature Selection & Extraction V

Nathan Epstein 599 Dec 25, 2022
A Python Library for Self Organizing Map (SOM)

SOMPY A Python Library for Self Organizing Map (SOM) As much as possible, the structure of SOM is similar to somtoolbox in Matlab. It has the followin

Vahid Moosavi 497 Dec 29, 2022
:bowtie: Create a dashboard with python!

Installation | Documentation | Gitter Chat | Google Group Bowtie Introduction Bowtie is a library for writing dashboards in Python. No need to know we

Jacques Kvam 753 Dec 22, 2022
Multi-class confusion matrix library in Python

Table of contents Overview Installation Usage Document Try PyCM in Your Browser Issues & Bug Reports Todo Outputs Dependencies Contribution References

Sepand Haghighi 1.3k Dec 31, 2022
Analytical Web Apps for Python, R, Julia, and Jupyter. No JavaScript Required.

Dash Dash is the most downloaded, trusted Python framework for building ML & data science web apps. Built on top of Plotly.js, React and Flask, Dash t

Plotly 17.9k Dec 31, 2022
Debugging, monitoring and visualization for Python Machine Learning and Data Science

Welcome to TensorWatch TensorWatch is a debugging and visualization tool designed for data science, deep learning and reinforcement learning from Micr

Microsoft 3.3k Dec 27, 2022
A programming language built on top of Python to easily allow Swahili speakers to get started with programming without ever knowing English

pyswahili A programming language built over Python to easily allow swahili speakers to get started with programming without ever knowing english pyswa

Jordan Kalebu 72 Dec 15, 2022