jsii icon indicating copy to clipboard operation
jsii copied to clipboard

Split Generated Code into Multiple Files

Open skorfmann opened this issue 4 years ago • 2 comments

:rocket: Feature Request

Affected Languages

  • [ ] TypeScript or Javascript
  • [x] Python
  • [ ] Java (haven't checked)
  • [ ] .NET (C#, F#, ...) (haven't checked)

General Information

  • JSII Version: 1.17
  • [x] I may be able to implement this feature request

Description

The cdktf provider for AWS generates a 19 MB __init__.py file which contains all the classes for the Terraform AWS Provider. You can check it with this project which publishes a prebuilt PyPi package.

According to this issue, this might lead to a subpar development experience in certain IDEs. At least in PyCharm, it doesn't work out of the box. After setting custom indexing settings for intellisense it seems to work, but the indexing process is still slow. I don't know how other IDEs are behaving.

Copied from the issue:

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 the imports.aws module, but notice how slow the indexing operation is, because of the large file size.

Proposed Solution

Without having looked at this in detail, one option could be to somehow provide an option to create submodules for each input class / namespace. Is this possible already, can't really tell from the docs?

This is possibly related to https://github.com/aws/jsii/issues/1919

skorfmann avatar Jan 19 '21 10:01 skorfmann

I've actually been thinking about this a lot recently, and I sure am very favorable to this idea.

I'm not sure when we'll have time to work on this however... I'll gladly review any PR to this effect 😉

RomainMuller avatar Feb 24 '21 12:02 RomainMuller

Cannot adopt cdktf here, as python just became irresponsive.Looking forward to this feature.

fbrodrigorezino avatar Mar 01 '22 18:03 fbrodrigorezino