Skip to content
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

Rewrite package code to reduce inter-module dependencies #5

Open
rth opened this issue May 9, 2022 · 0 comments
Open

Rewrite package code to reduce inter-module dependencies #5

rth opened this issue May 9, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@rth
Copy link
Member

rth commented May 9, 2022

One reason why this bundler is not able to reduce sizes that much is because of the convention of using top-level imports in Python.
With top-level imports, even if a functionality is required for a function that we don't use, if we use other functions from that module, it would have to be included. This is particularly problematic for dynamic libraries which take a long time to load.

There are two ways around this,

  1. Manual fixes: we could do upstream fixes, to reduce inter-module dependencies
  2. Automatic code rewrites: one could imagine, under some conditions, trying to rewrite all code (e.g. via AST) to move top level imports under the functions / methods where they are used. Maybe starting by doing this only for .so libraries, and or imports used only a few times.
@rth rth added the enhancement New feature or request label May 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant