You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently there is no automating support for the build system.
What this means is exporting a project using godot-python result in a .pck/zip file which lacks the pythonscript directory (well from my tests, the pythonscript directory is present, but only contain some image that should have been found by Godot's generic export system...)
So right now exporting a project means you have to:
export in .zip format
extract the .zip in a directory
add the godot release (preferably the one from the Godot export templates) binary to this directory
And then you have a directory that can run the project fine.
Least we can say is...this is far from ideal :/
Reacted by Zireael07, Alex Thiele, Leonardo Antunes, chrisgraf, swedneck, Augustin LAVILLE, Darkinggq, Zishan Rahman, Sean LaPlante, Martin Ruefenacht and 2 more
What I do for now on a project I want to use Pythonscript support for, is following the described method here, but just for some package loader project which then loads the actual game package and switches to that scene.
With this method the actual game files are still in a single package and only the loader files are exposed in the directory structure.
Let me ask you - is it possible to load the game/application on another machine after performing this export? Eg; one that does not have python installed into the host system.
Another way of asking is "is python embedded into godot's engine after this is done?"
I've started working on this issue a couple of weeks ago, but I have put it on hold to focus on a better plugin install&update experience (the assetlib is not well suited for big platform-dependent project such as this one), this should allow me to do much more frequent release so I consider it should come first ;-)
during export, the plugin should copy the entire addons/pythonscript/<platform> directory to the target
the plugin should also copy the python files and keep their paths intact. This is needed given we use the regular python import system to load python scripts (currently the the .py file end up in the .pck export file just like the .gd, but python doesn't know about .pck file so the import fails)
in theory we should also prevent the .py files to end up in the .pck file. I guess it's not technically very important given as I said Python doesn't know about .pck files, but it maybe important for Godot not to have a given .py file in two different places (on the disk and inside the .pck)
Notes:
we could hook into the python loading mechanism to make it understand .pck files (hence 3 would no longer be needed), but it is probably more complicated to do and it wouldn't work for binary modules (typically when using cython in the project).
we could also turn the .py into .pyc during the build phase, but I think it's better to ignore this for the moment in order to keep things simple
an additional good feature we be to allow user to plug a hook function into the export/build system so that he could automate some tasks such has cython compilation
Reacted by Augustin LAVILLE, Leroy Hopson, Danilaboni and Anderson Araujo
Compiling to .pyc is as easy as python -m compileall . - assuming that python is part of the system $PATH and you want to compile the present folder. Please, please, please - Defer to the above, just be aware it's removed to aim at a lower reasonable branch for compilation here.
Putting this here because I looked into it wondering.
I've started working on this issue a couple of weeks ago, but I have put it on hold to focus on a better plugin install&update experience (the assetlib is not well suited for big platform-dependent project such as this one), this should allow me to do much more frequent release so I consider it should come first ;-)
during export, the plugin should copy the entire addons/pythonscript/<platform> directory to the target
the plugin should also copy the python files and keep their paths intact. This is needed given we use the regular python import system to load python scripts (currently the the .py file end up in the .pck export file just like the .gd, but python doesn't know about .pck file so the import fails)
in theory we should also prevent the .py files to end up in the .pck file. I guess it's not technically very important given as I said Python doesn't know about .pck files, but it maybe important for Godot not to have a given .py file in two different places (on the disk and inside the .pck)
Notes:
we could hook into the python loading mechanism to make it understand .pck files (hence 3 would no longer be needed), but it is probably more complicated to do and it wouldn't work for binary modules (typically when using cython in the project).
we could also turn the .py into .pyc during the build phase, but I think it's better to ignore this for the moment in order to keep things simple
an additional good feature we be to allow user to plug a hook function into the export/build system so that he could automate some tasks such has cython compilation
First of all thanks for making such a powerful thing but while developing a game in Godot with python I encountered the issue for export so I am willing to help😀😀
I am very much interested in making this and know how to make plugins for Godot and also I go through the link you shared I am willing to work explain me more and I will get going.
I've started working on this issue a couple of weeks ago, but I have put it on hold to focus on a better plugin install&update experience (the assetlib is not well suited for big platform-dependent project such as this one), this should allow me to do much more frequent release so I consider it should come first ;-)
during export, the plugin should copy the entire addons/pythonscript/<platform> directory to the target
the plugin should also copy the python files and keep their paths intact. This is needed given we use the regular python import system to load python scripts (currently the the .py file end up in the .pck export file just like the .gd, but python doesn't know about .pck file so the import fails)
in theory we should also prevent the .py files to end up in the .pck file. I guess it's not technically very important given as I said Python doesn't know about .pck files, but it maybe important for Godot not to have a given .py file in two different places (on the disk and inside the .pck)
Notes:
we could hook into the python loading mechanism to make it understand .pck files (hence 3 would no longer be needed), but it is probably more complicated to do and it wouldn't work for binary modules (typically when using cython in the project).
we could also turn the .py into .pyc during the build phase, but I think it's better to ignore this for the moment in order to keep things simple
an additional good feature we be to allow user to plug a hook function into the export/build system so that he could automate some tasks such has cython compilation
First of all thanks for making such a powerful thing but while developing a game in Godot with python I encountered the issue for export so I am willing to help😀😀
I am very much interested in making this and know how to make plugins for Godot and also I go through the link you shared I am willing to work explain me more and I will get going.
@Harshharsh2275 not sure what more I can provide on this topic. If you want to work on this topic I suggest you start by creating a simple export plugin that gets called when the export starts, from this on we can iterate over to add tings step by step ;-)
during export, the plugin should copy the entire addons/pythonscript/<platform> directory to the target
the plugin should also copy the python files and keep their paths intact. This is needed given we use the regular python import system to load python scripts (currently the the .py file end up in the .pck export file just like the .gd, but python doesn't know about .pck file so the import fails)
in theory we should also prevent the .py files to end up in the .pck file. I guess it's not technically very important given as I said Python doesn't know about .pck files, but it maybe important for Godot not to have a given .py file in two different places (on the disk and inside the .pck)
I ended up being successful by making and using a custom build template. In case anyone else out there is stuck while waiting for full support from @gustavi , I added the more detailed instructions to a Gist. If there's anything I can assist with or you have a working branch @gustavi let me know.
For now, I'm essentially copying all project files in .py into the archive after export. This has drawbacks, of course, but it's the simplest automated workflow I could come up with.
Once it's done, it's pretty simple to just add the build templates in the UI:
Reacted by Augustin LAVILLE, Leonardo Christino and Sean LaPlante
Reacted by Zireael07, Leroy Hopson and Sean LaPlante
No news for a while here, I was really busy at work + holidays.
@omardelarosa your solution is really interesting, more than mine by far. I'll try to port it on my computers (Windows 10 / ArchLinux) and keep you in touch.
Activity
bestdani commentedon May 22, 2020
What I do for now on a project I want to use Pythonscript support for, is following the described method here, but just for some package loader project which then loads the actual game package and switches to that scene.
With this method the actual game files are still in a single package and only the loader files are exposed in the directory structure.
greysondn commentedon Sep 16, 2020
This is highly relevant to my current interests.
Let me ask you - is it possible to load the game/application on another machine after performing this export? Eg; one that does not have python installed into the host system.
Another way of asking is "is python embedded into godot's engine after this is done?"
touilleMan commentedon Sep 18, 2020
yes ;-)
Godot-Python ships it own Python interpreter totally isolated from the system.
gustavi commentedon Oct 10, 2020
This issue is really interesting for me. If you have some idea for a real export I could help.
touilleMan commentedon Oct 10, 2020
Hi @gustavi !
I've started working on this issue a couple of weeks ago, but I have put it on hold to focus on a better plugin install&update experience (the assetlib is not well suited for big platform-dependent project such as this one), this should allow me to do much more frequent release so I consider it should come first ;-)
Considering what should be done for the export:
addons/pythonscript/<platform>directory to the targetNotes:
greysondn commentedon Oct 10, 2020
Compiling to
.pycis as easy aspython -m compileall .- assuming that python is part of the system$PATHand you want to compile the present folder. Please, please, please - Defer to the above, just be aware it's removed to aim at a lower reasonable branch for compilation here.Putting this here because I looked into it wondering.
Harshharsh2275 commentedon Oct 11, 2020
Hi @touilleMan
First of all thanks for making such a powerful thing but while developing a game in Godot with python I encountered the issue for export so I am willing to help😀😀
I am very much interested in making this and know how to make plugins for Godot and also I go through the link you shared I am willing to work explain me more and I will get going.
Harshharsh2275 commentedon Oct 12, 2020
Helpful if you can guide
Thanks
touilleMan commentedon Oct 13, 2020
@Harshharsh2275 not sure what more I can provide on this topic. If you want to work on this topic I suggest you start by creating a simple export plugin that gets called when the export starts, from this on we can iterate over to add tings step by step ;-)
gustavi commentedon Nov 22, 2020
I'm currently working on this issue. I'll post update in following hours/days when it starts working.
omardelarosa commentedon Jan 2, 2021
First of all, thanks so much for the incredibly amazing project that is
godot-python.Today I spent some time trying automated build system to work by starting with your suggested steps @touilleMan :
I ended up being successful by making and using a custom build template. In case anyone else out there is stuck while waiting for full support from @gustavi , I added the more detailed instructions to a Gist. If there's anything I can assist with or you have a working branch @gustavi let me know.
For now, I'm essentially copying all project files in
.pyinto the archive after export. This has drawbacks, of course, but it's the simplest automated workflow I could come up with.Once it's done, it's pretty simple to just add the build templates in the UI:
gustavi commentedon Jan 13, 2021
No news for a while here, I was really busy at work + holidays.
@omardelarosa your solution is really interesting, more than mine by far. I'll try to port it on my computers (Windows 10 / ArchLinux) and keep you in touch.
vmjcv commentedon Feb 23, 2021
@gustavi Can you share any help on windows? Thanks
Andrea-Miele commentedon May 20, 2021
Any updates about this ?
@touilleMan @gustavi
gustavi commentedon May 21, 2021
Not at all, onyl dirty hacks for my own computer. I'm not working on this issue anymore sorry.
Andrea-Miele commentedon May 29, 2021
Anyone has a solution for Windows using the pck?@touilleMan
529124368 commentedon Sep 26, 2022
May I ask how to encrypt the material resources of the game?
gustavi commentedon Sep 26, 2022
Yes, but you're not at the good place: https://github.com/touilleMan/godot-python/discussions
Lance-Starkie commentedon Oct 16, 2023
Any ground made here? It just absolutely refuses to acknowledge the DLL even exists