Module finder for hidden imports et al

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Module finder for hidden imports et al

Parkway
What is the best practice for finding modules to satisfy hidden imports?

Spent time understanding mf.py only to find out it is no longer available in pyinstaller.

The ideal solution is to pass all the source files to the module finder which then outputs the necessary hidden imports.  Thx.

--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/pyinstaller?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Module finder for hidden imports et al

Martin Zibricky
dbv píše v St 20. 03. 2013 v 16:23 -0700:
> What is the best practice for finding modules to satisfy hidden
> imports?

Could you please specify what you mean by 'hidden imports'?
- imports that pyinstaller is not able find by default or
- all imports that pyinstaller is able to find?

> Spent time understanding mf.py only to find out it is no longer
> available in pyinstaller.

There is no longer available file mf.py. However, its code is still
present there. The code and file structure was just refactored.

The mf.py code is mostly in ./PyInstaller/depend/imptracker.py.

> The ideal solution is to pass all the source files to the module
> finder which then outputs the necessary hidden imports.

The ideal solution would be to use python library 'modulegraph' for
module dependency analysis. Modulegraph works the way you described: You
pass all source modules to modulegraph which then outputs the necessary
imports.

- For python3 support I would like to use modulegraph for import
analysis.
- I started some work on it in ./PyInstaller/depend/build.py. Look for
function 'assemble_modulegraph' in that file.

There will be always some cases where pyinstaller will not be able to
find proper import dependencies and for these cases
- there are import hooks
- some other heuristic would be necessary

One example, where it is hard to detect dependencies are Python C/C++
extensions.
- one heuristic in that case could be to import C extension in a python
subprocess and get the difference of 'sys.modules.keys()' before and
after import.

--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/pyinstaller?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply | Threaded
Open this post in threaded view
|

Re: Module finder for hidden imports et al

Parkway
Referring to imports that pyinstaller is not able to find by default.

Traced problem to werkzeug which has been documented at http://www.pyinstaller.org/ticket/602 and using the published workaround in the interim.  Seems to be a wekzeug problem - (https://github.com/mitsuhiko/flask/issues/589#issuecomment-9208197 and https://github.com/mitsuhiko/werkzeug/issues/221)

Will definitely look at the Python modulegraph.  Thx.

--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/pyinstaller?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Module finder for hidden imports et al

Martin Zibricky
dbv píše v Čt 21. 03. 2013 v 08:56 -0700:
> Will definitely look at the Python modulegraph.  Thx.

My brief experiments showed that for example modulegraph is able to find
zope.interface properly where pyinstaller is lacking. 'zope' is a
namespace package - the 'zope' directory does not contain __init__.py
file.

--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/pyinstaller?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.