-
Notifications
You must be signed in to change notification settings - Fork 2k
Single pass pyc creation #8015
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
Single pass pyc creation #8015
Conversation
add compile_multiple_pyc function to the gateways/disk/create module Function compiles multiple pyc file in a single call to python.
Add MultiPathAction, PrefixMultiPathAction, CreateInPrefixMultiPathAction and CompileMultiPycAction classes
|
@kalefranz We discussed this yesterday, would appreciate your feedback on these changes. |
|
Seems reasonable to me. Are the existing tests sufficient? Is it worthwhile to put a time limit test in that conservatively passes with the new code, but which would fail with the old code? |
I'd also need to test the |
|
stdin is a pipe on Windows so works much the same, no limit. |
Make sure py_full_paths and pyc_full_paths can be interated over multiple times by casting them to tuples. Add an early end to the function if no py file needs to be compiled.
Special case the compilation of pyc on windows to account for the size limitation of stdin and the maximum length of the command line arguments. pyc compilation routine on windows borrowed from conda-build's post.py module.
This reverts commit 51a3aec.
|
The integration tests for pyc compiling on Windows are failing because the The order of the actions may need to be specified so that the pyc compilation always occurs after the linking. |
|
Ordering actions seems wise. Please go ahead with that idea. |
|
I think the unicode characters in the prefix name and path were causing issues on Windows. Hopefully escaping them and using the proper linesep fixes the issue. |
|
You can call compile with an argument for each filename too AFAIK. |
|
The filesystem encoding may be different than the encoding used for stdin. The documentation for sys.stdin, which is what |
You need to limit the length of the arguments in this case. e96463c implemented this by calling |
|
failing on spaces. Trying to figure out proper quoting. |
|
The scheme used in b3cb857 will fail to compile |
|
Using |
|
You can call compile with a list of files as arguments, just remove the |
|
Yeah, that's why I put in that search for extra pyc files. I have no idea what the performance implication is without some sort of benchmark. It's pointed solely at site-packages, which I think dramatically limits potential problems. Ray, I know that you can compile with a list of arguments. The trouble is that that list of arguments is subject to this hell of encoding nonsense. I'm trying to find ways to skirt that hell. |
|
How about emit to a file as utf-8 a line per file, then write a simple script that reads that back in? |
|
|
doesn't matter - some tempdir? |
|
I've heard of pair programming but this is even better! Even if I'm just in the backseat. |
conda/gateways/disk/create.py
Outdated
| # -j 0 will do the compilation in parallel, with os.cpu_count() cores | ||
| if int(py_ver[0]) >= 3 and int(py_ver.split('.')[1]) > 5: | ||
| command.extend(["-j", "0"]) | ||
| command = ["-Wi", "-m", "compileall", "-q", "-i", tf.name] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-l might be prudent
|
Sorry @jjhelmus I'm done for the day on this. I think we're back where we started, but hopefully we know a bit more now. |
|
Hi there, thank you for your contribution to Conda! This pull request has been automatically locked since it has not had recent activity after it was closed. Please open a new issue or pull request if needed. |
Create pyc files in a single pass rather than using multiple calls to py_compile.
closes #7621