diff --git a/packages/jsii-pacmak/lib/targets/python.ts b/packages/jsii-pacmak/lib/targets/python.ts index 4ec6c0c278..681e56ae18 100644 --- a/packages/jsii-pacmak/lib/targets/python.ts +++ b/packages/jsii-pacmak/lib/targets/python.ts @@ -1597,6 +1597,8 @@ class PythonModule implements PythonType { code.line(`${member},`); } code.unindent(']'); + } else { + code.line('__all__: List[typing.Any] = []'); } // Finally, we'll use publication to ensure that all of the non-public names diff --git a/packages/jsii-pacmak/test/generated-code/__snapshots__/target-python.test.ts.snap b/packages/jsii-pacmak/test/generated-code/__snapshots__/target-python.test.ts.snap index 9b29fb48f5..2b999b5824 100644 --- a/packages/jsii-pacmak/test/generated-code/__snapshots__/target-python.test.ts.snap +++ b/packages/jsii-pacmak/test/generated-code/__snapshots__/target-python.test.ts.snap @@ -10589,6 +10589,7 @@ import typing_extensions from .._jsii import * +__all__: List[typing.Any] = [] publication.publish() @@ -10805,6 +10806,7 @@ import typing_extensions from .._jsii import * +__all__: List[typing.Any] = [] publication.publish() @@ -11161,6 +11163,7 @@ import typing_extensions from .._jsii import * +__all__: List[typing.Any] = [] publication.publish()