-
Notifications
You must be signed in to change notification settings - Fork 457
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
Allow partial PyPi installs for cdktf-cdktf-provider-aws #2835
Comments
Hi @vladmiller 👋 thank you for raising this – I think this would be something that would need some upstream work in JSII. That said, we did recently fix the size of the pre-built packages – e.g. the AWS Python package should be 50% smaller now – maybe you can already see an improvement there? |
Thank you, @ansgarm for the feedback. I will try and see how it goes. Maybe there is a way to provide an alternative entry point that lazy-loads only requested libraries? |
The main issue is that the provider library loads all service modules in the root Simply deleting the root |
The loading of all modules was added via aws/jsii#3049. It is done to ensure types not directly referenced are loaded correctly. Perhaps an option could be added to not do this as it is currently less relevant for cdktf. Alternatively, a smarter lazy loading solution may be possible. |
Just curious, why not use the common typing conditional?: if typing.TYPE_CHECKING:
# load all 200 aws services for 30+ seconds That way, synth executions take way less time. |
The typing is used at runtime to lookup how to bridge between the internal JSII runtime and the python application. |
Community Note
Description
It takes a while for Python to load entire
cdktf-cdktf-provider-aws
bundle as well it takes quite a bit of time to install the provider because of it's size.It would be very useful, if it was possible to install only the APIs one may require in their project. Similar like it's possible with moto:
pip install 'moto[ec2,s3,all]'
For example:
That would reduce the overall bandwith requirements as well as improve unit-testing for custom cdktf constructs and synth process.
The text was updated successfully, but these errors were encountered: