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
Briefcase currently purges all __pycache__ folders as part of the build process and enables the PYTHONDONTWRITEBYTECODE setting on stub binaries. The latter is needed to protect the integrity of code signed bundles; but the process of in-memory PYC compilation can be a non-trivial component of process startup time.
Describe the solution you'd like
It should be possible to configure Briefcase to:
Not strip __pycache__ folders as part of a build
Guarantee the compilation of PYC files as part of a build
Only ship PYC files as part of a packaged app.
Describe alternatives you've considered
Do nothing - the current "source only" approach works.
Remove __pycache__ stripping entirely.
Additional context
Shipping only PYC files could be considered a light form of obfuscation (see #1865).
Ideally, the current hard-coded "PYC cleanup" strategy should be a pluggable API providing three options out of the box:
Full PY and PYC distribution
PY only distribution
PYC only distribution
with an API that would allow third parties to define their own approach that performs other obfuscation methods. (2) is the current default; moving to (1) as a new default would be worth considering.
We should also ensure that PYC files are fully compiled as part of options (2) and (3). compileall may be useful here. The support packages may also need to be modified to ensure that they provide pre-compiled PYC content (or the build process modified to include PYC compilation of the standard library)
PEP 3147 requires that when in ".pyc only" mode, __pycache__ folders aren't used. This will require some post-processing after compilation to move .pyc files into their parent directory.
The text was updated successfully, but these errors were encountered:
What is the problem or limitation you are having?
Briefcase currently purges all
__pycache__
folders as part of the build process and enables thePYTHONDONTWRITEBYTECODE
setting on stub binaries. The latter is needed to protect the integrity of code signed bundles; but the process of in-memory PYC compilation can be a non-trivial component of process startup time.Describe the solution you'd like
It should be possible to configure Briefcase to:
__pycache__
folders as part of a buildDescribe alternatives you've considered
__pycache__
stripping entirely.Additional context
Shipping only PYC files could be considered a light form of obfuscation (see #1865).
Ideally, the current hard-coded "PYC cleanup" strategy should be a pluggable API providing three options out of the box:
with an API that would allow third parties to define their own approach that performs other obfuscation methods. (2) is the current default; moving to (1) as a new default would be worth considering.
We should also ensure that PYC files are fully compiled as part of options (2) and (3).
compileall
may be useful here. The support packages may also need to be modified to ensure that they provide pre-compiled PYC content (or the build process modified to include PYC compilation of the standard library)PEP 3147 requires that when in "
.pyc
only" mode,__pycache__
folders aren't used. This will require some post-processing after compilation to move.pyc
files into their parent directory.The text was updated successfully, but these errors were encountered: