Skip to content

Export system #146

Open
Open

Description

@touilleMan

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 :/

Activity

  1. bestdani commented on May 22, 2020

    @bestdani

    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.

  2. greysondn commented on Sep 16, 2020

    @greysondn

    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?"

  3. touilleMan commented on Sep 18, 2020

    @touilleMan
    OwnerAuthor

    is it possible to load the game/application on another machine after performing this export?

    yes ;-)

    Another way of asking is "is python embedded into godot's engine after this is done?"

    Godot-Python ships it own Python interpreter totally isolated from the system.

  4. gustavi commented on Oct 10, 2020

    @gustavi

    This issue is really interesting for me. If you have some idea for a real export I could help.

  5. touilleMan commented on Oct 10, 2020

    @touilleMan
    OwnerAuthor

    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:

    1. create an export plugin (using the PluginEditor.add_export_plugin)
    2. during export, the plugin should copy the entire addons/pythonscript/<platform> directory to the target
    3. 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)
    4. 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
  6. greysondn commented on Oct 10, 2020

    @greysondn

    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.

  7. Harshharsh2275 commented on Oct 11, 2020

    @Harshharsh2275

    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:

    1. create an export plugin (using the PluginEditor.add_export_plugin)
    2. during export, the plugin should copy the entire addons/pythonscript/<platform> directory to the target
    3. 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)
    4. 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

    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.

  8. Harshharsh2275 commented on Oct 12, 2020

    @Harshharsh2275

    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:

    1. create an export plugin (using the PluginEditor.add_export_plugin)
    2. during export, the plugin should copy the entire addons/pythonscript/<platform> directory to the target
    3. 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)
    4. 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

    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.

    Helpful if you can guide
    Thanks

  9. touilleMan commented on Oct 13, 2020

    @touilleMan
    OwnerAuthor

    @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 ;-)

  10. gustavi commented on Nov 22, 2020

    @gustavi

    I'm currently working on this issue. I'll post update in following hours/days when it starts working.

  11. omardelarosa commented on Jan 2, 2021

    @omardelarosa

    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 :

    1. create an export plugin (using the PluginEditor.add_export_plugin)
    2. during export, the plugin should copy the entire addons/pythonscript/<platform> directory to the target
    3. 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)
    4. 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:

    gui_build_path

  12. gustavi commented on Jan 13, 2021

    @gustavi

    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.

  13. vmjcv commented on Feb 23, 2021

    @vmjcv

    @gustavi Can you share any help on windows? Thanks

  14. Andrea-Miele commented on May 20, 2021

    @Andrea-Miele

    Any updates about this ?
    @touilleMan @gustavi

  15. gustavi commented on May 21, 2021

    @gustavi

    Not at all, onyl dirty hacks for my own computer. I'm not working on this issue anymore sorry.

  16. Andrea-Miele commented on May 29, 2021

    @Andrea-Miele

    Anyone has a solution for Windows using the pck?@touilleMan

  17. 529124368 commented on Sep 26, 2022

    @529124368

    May I ask how to encrypt the material resources of the game?

  18. gustavi commented on Sep 26, 2022

    @gustavi

    May I ask how to encrypt the material resources of the game?

    Yes, but you're not at the good place: https://github.com/touilleMan/godot-python/discussions

  19. Lance-Starkie commented on Oct 16, 2023

    @Lance-Starkie

    Any ground made here? It just absolutely refuses to acknowledge the DLL even exists

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions