-
Notifications
You must be signed in to change notification settings - Fork 450
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
Split auto-generated imports
files into smaller files
#504
Comments
@trondhindenes I have just a couple questions which may help find a solution:
|
On 2) I would assume yes, since one typically only would import a small subset of those 150-200 files. Will try 1) and report back! |
regarding 1), it's not clear to me how to use prebuilt providers in python - the examples are only for typescript, as far as I can see. |
We do publish python packages as well, e.g. the AWS Provider. They should be usable as any other Python package. |
Thanks! Found it. As far as I can see, the prepackaged aws provider also consists of a single monster-file (about half a million lines). It's interesting that the source (https://github.com/terraform-cdk-providers/cdktf-provider-aws/tree/master/src) seems to be nicely separated per service, so I guess there is at least a theoretical option of avoding bunching everything together in a single file? |
This would be something for jsii. I'm not aware of an option for the code generation to split this up into multiple files. Perhaps a good issue to add this to might be this one aws/jsii#1919 |
how about iterating over the source *ts files and generate (jsii-compile) one python (sub)module per? Note: I know very little about the internals of jsii so this may not be viable. |
I haven't verified it, but I don't think jsii is capable of doing this at the moment. I'll create an issue in jsii to track this. |
+10 to this issue - the generated Python being difficult to use with auto-complete/easily openable by symbol etc makes it very difficult to figure out what is going on. Between that and what seems to be a lack in documentation for Python modules for each provider, there is a lot of trial and error going on to get anything working with Python + CDK TF |
FWIW still a huge time on the pre-built. I've no number but it was 30s+ at least. |
Closing this as we now split the AWS provider into smaller chunks by using namespaces |
I'm going to lock this issue 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 similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Community Note
Description
As a pycharm user, I'm noticing that the auto-generated
imports.aws
package from the quickstart doesnt perform auto-complete and similar. This seems to be because theimports.aws.__init__.py
file size is around 17MB, which exceeds pycharm's default of 2.56MB.It's totally doable to increase that size in pycharm's settings, but I'd still argue that an 18MB text file is rather large (there's almost half a million lines of code in that file)
Since part of the reason for considering CDK is to have the support of rich programming languages, and many people rely on full IDE's to take advantage of that support, it would be good if terraform-cdk tried to be a "good citizen" and generated imports in a way that didn't lead to overly large files.
Step to repro: Create the following cdk-tf file using python:
Open the project in Pycharm, and witnes how the
Instance, AwsProvider
has red squiggles meaning the import is not valid.Change the system property
idea.max.intellisense.filesize
(https://www.jetbrains.com/help/pycharm/tuning-the-ide.html#configure-platform-properties) to enable intellisense for theimports.aws
module, but notice how slow the indexing operation is, because of the large file size.References
The text was updated successfully, but these errors were encountered: