-
Notifications
You must be signed in to change notification settings - Fork 456
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
feat: remove root-level import of all modules in python #3030
feat: remove root-level import of all modules in python #3030
Conversation
fe27fd3
to
dd99965
Compare
554991c
to
3f9b9dd
Compare
3f9b9dd
to
5f8e677
Compare
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.
Looking good! Only a small typo and a question.
As this is a breaking change, I think we should add an unreleased section to the changelog and give some before & after examples for this change. Upon the next release, we should also copy that to an upgrade guide (not sure if adding an upgrade guide already would release it too soon 😄)
3152fb5
to
3e1bd14
Compare
a14eff2
to
5b1f0e9
Compare
5b1f0e9
to
133819c
Compare
133819c
to
60f51d1
Compare
I'm going to lock this pull request because it has been closed for 30 days. This helps our maintainers find and focus on the active issues. If you've found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
In python importing a submodule leads to all
__init__.py
files below the import path being executed. We have anindex.ts
with a namespaced import for all submodules as an entry point for JSII (It needs to be there so all the submodules are being registered). This leads to a from a provider point of view top-level__init__.py
importing all the namespaces, so even if users use specific submodule imports they import the entire provider.This change cuts the synth time in half for the AWS example (from 30s to 15s).
This is a breaking change since top-level imports (
from imports.aws import s3Bucket
) don't work anymore, they need to be replaced with namespace imports (from imports.aws.s3_bucket import S3Bucket
).Additionally this PR upgrades JSII and JSII-Srcmak, allowing us to use the new lazy loading mechanism within JSII bringing the initial synth time down from 15s to 5s and every iterative synth (after the providers and modules are in the JSII cache) down to 2s.
TL;DR: Breaking change bringing Pythons synth time down from 30s to 2s