Speed up building multiple executable with onedir
#8137
Replies: 1 comment 3 replies
-
There is no officially supported, out-of-the box way for that. If all those entry-points really have identical import dependencies, I suppose you could try running Analyis only once, on one of them, and then re-use the results, while manually creating the But if I were in your place, I would reconsider having multiple executables in the first place, as each of them will contain its copy of PYZ, with all collected modules. For programs with complex dependencies, that alone might unnecessarily baloon the distribution size. I would instead opt for having a single executable whose first argument is |
Beta Was this translation helpful? Give feedback.
-
Hi all,
first of all thank you so much for building and maintaining this open source library.
I have an application which is composed of several tool (entrypoints). All tools share the same dependencies.
I already have a spec file for building a
onedir
bundle that includes all tools but I'd like to speed up the build, since what I'm doing is running the Analysis for each single tool which I believe is what causes the slowdown. In the spec the very first thing done is collecting the dependencies for all apps by parsing thepoetry.lock
file, including each package usingcollect_submodules
and later on passing the resulting list to thehidden_imports
arg.So the result is that for each tool I'm actually importing the same packages but the operation is repeated for each tool in either
Analysis
,PYZ
orEXE
.I really like that the binaries' size is just a few KB for each tool while having a single large directory that includes the dependencies.
So is there a way to create the directory of the bundle only once? Should I run the the
Analysis
only once and then reuse the output in thePYZ
andEXE
for each entrypoint/tool?I've found the discussions #6634 and #7140 but they all seem to suffer from the same slow down of running the analysis for all entrypoints.
This is how my spec file looks like:
Beta Was this translation helpful? Give feedback.
All reactions