box-python-sdk
box-python-sdk copied to clipboard
Not all module statically reachable from package root
By that I mean, if you run certain static analyzers on boxsdk
, they might tell you that some modules are never used.
For example, import boxsdk
will run from .object import *
, and boxsdk.object
has folder
in its __all__
. So at runtime, import boxsdk
should import boxsdk.object.folder
and include it in sys.modules
.
However, some static analyzers aren't smart enough to realize that folder
is imported this way, and may assume that folder
is not used somewhere. We've found that py2app
and pyinstaller
both make this assumption, and will optimize boxsdk.object.folder
out of the build, along with some other modules.
We should:
- Make sure that all modules are included at least once in a very explicit way.
- Write a test to assert this.
I've started working on this.
Hi, I am working with the boxsdk and pyinstaller modules to create a stand alone application, but I am getting the following error:
File "/usr/local/lib/python3.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 627, in exec_module
exec(bytecode, module.dict)
File "boxsdk/init.py", line 8, in
Is this still being worked on now?
this issue is blocking deployment of my project, what can we do to resolve this. does anyone know the broken hidden imports!
added to spec file
hiddenimports=['box[jwt]','boxsdk.object'],
im still getting the following error.
File "site-packages\boxsdk_init_.py", line 8, in
Hi, I had to specifically import each module for it to work, ie. collaboration_whitelist_entry is a specific import line for me.
hiddenimports=[
'boxsdk.object.collaboration',
'boxsdk.object.collaboration_whitelist',
'boxsdk.object.collaboration_whitelist_entry',
'boxsdk.object.collaboration_whitelist_exempt_target',
'boxsdk.object.collection',
'boxsdk.object.comment',
'boxsdk.object.device_pinner',
'boxsdk.object.enterprise',
'boxsdk.object.events',
'boxsdk.object.event',
'boxsdk.object.file',
'boxsdk.object.file_version',
'boxsdk.object.file_version_retention',
'boxsdk.object.folder',
'boxsdk.object.group',
'boxsdk.object.group_membership',
'boxsdk.object.legal_hold',
'boxsdk.object.legal_hold_policy',
'boxsdk.object.legal_hold_policy_assignment',
'boxsdk.object.metadata_cascade_policy',
'boxsdk.object.metadata_template',
'boxsdk.object.recent_item',
'boxsdk.object.retention_policy',
'boxsdk.object.retention_policy_assignment',
'boxsdk.object.search',
'boxsdk.object.storage_policy',
'boxsdk.object.storage_policy_assignment',
'boxsdk.object.terms_of_service',
'boxsdk.object.terms_of_service_user_status',
'boxsdk.object.trash',
'boxsdk.object.task',
'boxsdk.object.task_assignment',
'boxsdk.object.user',
'boxsdk.object.upload_session',
'boxsdk.object.webhook',
'boxsdk.object.watermark',
'boxsdk.object.web_link']
YOU ARE AWESOME! thank you so much
i've been there before! glad to help
Nice one @eliasIBM Thank you
I suggest a different method.
In .spec
file I added:
import boxsdk.object
boxsdk_objects = [f"boxsdk.object.{i}" for i in dir(boxsdk.object) if not i.startswith("__")]
...
hiddenimports=boxsdk_objects,
...
In my project it works.
This issue has been automatically marked as stale because it has not been updated in the last 30 days. It will be closed if no further activity occurs within the next 7 days. Feel free to reach out or mention Box SDK team member for further help and resources if they are needed.
This issue has been automatically closed due to maximum period of being stale. Thank you for your contribution to Box Python SDK and feel free to open another PR/issue at any time.