indygreg / indygreg/PyOxidizer

generic embedding feedback

Open
#470 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
6.2k
Forks
256
PR merge metrics
No merged PRs in 30d

Description

Carrying on from https://github.com/indygreg/PyOxidizer/pull/467#issuecomment-950205096

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 https://github.com/indygreg/python-build-standalone/issues/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.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with generate-python-embedding-artifacts and the user-provided pyoxidizer.bzl configuration, then compare the approaches in #466 and #468. Determine how a proposed generate-all-embedding-artifacts command could preserve embedded files, write extra_files externally, accept a custom Python distribution, and retain user control over Rust customization and bytecode optimization.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, rust
Domain
build-system, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.