Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid unnecessary compiling disk path destinations entirely before including them from .py to .pyc into base_library.zip while using --onedir to build application. #5143

Closed
web-sys1 opened this issue Sep 4, 2020 · 16 comments

Comments

@web-sys1
Copy link

web-sys1 commented Sep 4, 2020

Is your feature request related to a problem? Please describe.
I'm always frustrated when I want to build a one directory based python app while I use --onedir or --onefile , the pyinstaller (sub)command. The base_library.zip archive contains a large number of .pyc files with encodings. However, the situation is odd, because it may include source path from computer entirely (for instance, it might settle c:\users\<username>\appdata\local\programs\python\<python-version>\lib\ in *.pyc files of that base_library archive), which becomes more confused.

Describe the solution you'd like
Maybe, you should look to review the PyInstaller/building/makespec.py and entire package. When --clean command is set, it cleans Pyinstaller cache while building an executable app. An spec file should follow conditions: analyzing source files and its library, not including c:\ entirely, but include compiled files what to be specified in base_library archive.

@web-sys1 web-sys1 added the feature Feature request label Sep 4, 2020
@web-sys1 web-sys1 changed the title Avoid unnecessary compiling destinations entirely to .pyc from disk path into base_library.zip while using --onedir to build application Avoid unnecessary compiling disk path destinations entirely to .pyc into base_library.zip while using --onedir to build application Sep 4, 2020
@bwoodsend
Copy link
Member

I'm sorry but you'll have to try to rephrase - I don't understand what you're saying.

The base_library.zip archive contains a large number of .pyc files with encodings.

This is how PyInstaller works - it includes compiled Python modules (.pycs) instead of the original source code (.pys). Remove functools.pyc and import functools will raise a ModuleNotFoundError. Similarly, if you took away some or all the encodings then your app will be break depending on target machine locale. But don't take my word for it - delete them and you'll see for yourself.

@bwoodsend bwoodsend added kind:support and removed feature Feature request labels Sep 5, 2020
@web-sys1
Copy link
Author

web-sys1 commented Sep 6, 2020

@bwoodsend I am not sure, but you can specify cause and make sure that base_library.zip will have amount of .pyc files 100% accurate. It depends on what source it is, if it is migrated to the library. Or, if not, it may be from that Python software.

@web-sys1 web-sys1 changed the title Avoid unnecessary compiling disk path destinations entirely to .pyc into base_library.zip while using --onedir to build application Avoid unnecessary compiling disk path destinations entirely before including them to .pyc into base_library.zip while using --onedir to build application. Sep 6, 2020
@web-sys1 web-sys1 changed the title Avoid unnecessary compiling disk path destinations entirely before including them to .pyc into base_library.zip while using --onedir to build application. Avoid unnecessary compiling disk path destinations entirely before including them from .py to .pyc into base_library.zip while using --onedir to build application. Sep 6, 2020
@bwoodsend
Copy link
Member

Again, I don't understand what you're saying...

@web-sys1
Copy link
Author

web-sys1 commented Sep 6, 2020

@bwoodsend Is including the copy of embedded file from source path in .pyc? Instead, I should find out if is original source or source-embedded copy.

@web-sys1
Copy link
Author

web-sys1 commented Sep 6, 2020

Otherwise, you should close this issue.

@Legorooj
Copy link
Member

Legorooj commented Sep 6, 2020

@web-sys1 can you include a screenshot of what you mean? It may clarify things.

@web-sys1
Copy link
Author

web-sys1 commented Sep 6, 2020

screenshoot2020_09_06_1306

@web-sys1
Copy link
Author

web-sys1 commented Sep 6, 2020

@Legorooj @bwoodsend This is an screenshot related to ”contents” of compiled .pyc file. For instance, it may be a embedded file name.

@web-sys1
Copy link
Author

web-sys1 commented Sep 6, 2020

@bwoodsend
Captură ecran (11)

@BoboTiG
Copy link
Contributor

BoboTiG commented Oct 22, 2020

Oh OK, I think I got it. You would like to include only revelant files in the archive, thoss actually used by your project and not the whole standard library. Right?

@web-sys1
Copy link
Author

Alright.

@Legorooj
Copy link
Member

@BoboTiG the whole std lib isn't included. Every file that's in base_library.zip is needed by the core python interpreter to run.

@BoboTiG
Copy link
Contributor

BoboTiG commented Oct 22, 2020

@Legorooj yes I know, I just wanted to make the request clearer for everyone :)

@web-sys1
Copy link
Author

web-sys1 commented Mar 19, 2021

@BoboTiG the whole std lib isn't included. Every file that's in base_library.zip is needed by the core python interpreter to run.

@Legorooj yes I know, I just wanted to make the request clearer for everyone :)

@Legorooj Have you done working on this? I've been waiting month-by-month to expect the results and I wonder that the repository is at point of new improvements. The last argument is enough to close the issue.

@rokm
Copy link
Member

rokm commented Mar 20, 2021

Hmm, if this issue was actually not about collecting modules but rather about leaking source file paths in the compiled pyc modules that are collected into base_library.zip, then it can be closed, as it was fixed in #5564.

@bwoodsend
Copy link
Member

I'm not sure we ever did work out what the issue was but all the possible meanings I could see either already happen or shouldn't happen.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants