-
Notifications
You must be signed in to change notification settings - Fork 68
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
WIP PyInstaller progress #1628
base: master
Are you sure you want to change the base?
WIP PyInstaller progress #1628
Conversation
Current status: libertem-server starts up, but doesn't find the static files where they are expected
The opentelemetry hook won't be required in the future and should be deleted, probably: fixed properly in pyinstaller/pyinstaller-hooks-contrib#725 Thx @rokm for the help and the quick fix! |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1628 +/- ##
==========================================
- Coverage 69.85% 65.76% -4.09%
==========================================
Files 325 325
Lines 27251 27251
Branches 3136 3136
==========================================
- Hits 19036 17922 -1114
- Misses 7646 8823 +1177
+ Partials 569 506 -63 ☔ View full report in Codecov by Sentry. |
dask_datas = [] | ||
|
||
dask_files = [ | ||
('Lib/site-packages/dask/dask.yaml', 'dask'), |
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.
This should be unnecessary, as existing hook for dask should collect that file.
|
||
dask_files = [ | ||
('Lib/site-packages/dask/dask.yaml', 'dask'), | ||
('Lib/site-packages/distributed/distributed.yaml', 'distributed') |
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.
This could be handled in more portable way by creating a hook for distributed
that calls collect_data_files('distributed')
.
And to avoid a future issue report - if your code uses a package that in turn uses |
if os.path.exists(path): | ||
dask_datas.append((path, target)) | ||
|
||
libertem_datas = [('../../client', 'libertem')] |
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.
Current status: libertem-server starts up, but doesn't find the static files where they are expected
Do they end up in the site-packages
in the installation? Is the relative path correct (whats the working directory when this code runs?), or does it maybe need a os.path.join(os.path.dirname(__file__), '..', '..', 'client')
or similar?
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.
If relative paths are given like that, PyInstaller assumes they are relative to the spec file (in order to factor out current working directory during the build).
I think part of the problem here is that the contents of that client
directory are collected into libertem
directory, as instructed. The target directory should be libertem\web\client
, as it is when the package is installed.
But if the build process here assumes that libertem
is installed (in non-editable mode) in the python environment prior to the build (which I suspect is the case, otherwise PyInstaller will have no way of finding libertem
modules...), then the data files could be simply collected by hook-libertem.py
:
from PyInstaller.utils.hooks import collect_data_files
datas = collect_data_files('libertem')
The second part of the problem seems to be that in frozen application, tornado.template.Loader
receives relative root_directory
(libertem\web
), which it incorrectly resolves to absolute path using current working directory. When running unfrozen, that root_directory
is already a correct absolute path. Will need to dig around a bit more to see what exactly is going wrong...
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.
The second part of the problem seems to be that in frozen application,
tornado.template.Loader
receives relativeroot_directory
(libertem\web
), which it incorrectly resolves to absolute path using current working directory. When running unfrozen, thatroot_directory
is already a correct absolute path. Will need to dig around a bit more to see what exactly is going wrong...
Ah yes, tornado
is trying to infer the path from co_filename
of code objects, which are anonymized relative paths in PyInstaller builds.
I suppose the easiest way for you to work around this insanity is to set template_path
in the application settings, similarly to how it is done for static_path
. In this case, the value should be os.path.dirname(__file__)
.
@rokm thank you for the pointers, much appreciated! |
Current status: libertem-server starts up, but doesn't find the static files where they are expected
Fixes #39
Contributor Checklist:
Reviewer Checklist:
/azp run libertem.libertem-data
passed