Skip to content

generic embedding feedback #470

@dae

Description

@dae

Carrying on from #467 (comment)

Let me firstly briefly elaborate on my use case/desired outcome:

  • I have a medium-sized Python app which uses non-stdlib extension modules, and bundles various data files. I'd like to store the Python bytecode and most of the data files inside the binary, and spill the extension modules and certain data files to external files.
  • I'd like to be able to customize the Rust code, so I can set an icon on Windows, print a startup message, and possibly do other things in the future.
  • I currently need to specify a non-default Python distribution on Linux to work around PyQt segfaults on modern Linux distros when run with standalone python astral-sh/python-build-standalone#95

If I have correctly understood how generate-python-embedding-artifacts works (please correct me if I'm wrong), I'm not sure it will work for the above use case:

  • Because it uses a stock pyoxidizer config, all the non-stdlib files/bytecode that could be stored in the binary would presumably need to be manually copied next to the binary instead. PyOxidizerFinder is one of PyOxidizer's really appealing points, and it would be a shame for that to only work with the stdlib.
  • The extension modules and external data files could be copied in from a separate pyoxidizer invocation, though it's a bit wasteful to build another binary just so the artifacts can be extracted.
  • It looks like a custom Python distribution can not be provided.
  • Presumably it's not possible to customize things like bytecode optimization level?

For now, either #466 or #468 handle my use case pretty well. I like the simplicity of #468, but like the flexibility of #466, and it builds slightly quicker/shows the cargo output in color :-) Not suggesting either of these be included as is, but hopefully they give you an idea of what I'm trying to achieve.

If there were a command like 'generate-all-embedding-artifacts' that used the user-provided pyoxidizer.bzl config and wrote extra_files to disk, I think that would solve all my problems.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions