-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Python codegen omits __init__.py when only enums are present #16221
Labels
area/codegen
SDK-gen, program-gen, convert
kind/bug
Some behavior is incorrect or out of spec
language/python
resolution/fixed
This issue was fixed
Milestone
Comments
thomas11
added
area/codegen
SDK-gen, program-gen, convert
needs-triage
Needs attention from the triage team
python
Pull requests that update Python code
labels
May 17, 2024
justinvp
added
language/python
and removed
python
Pull requests that update Python code
labels
May 17, 2024
iwahbe
pushed a commit
to pulumi/pulumi-command
that referenced
this issue
May 17, 2024
The `Logging` enum defined in the `common` package was not correctly exposed in the Python SDK due to pulumi/pulumi#16221, causing the error ``` AttributeError: module 'pulumi_command.common' has no attribute 'Logging' ``` As a workaround, this PR moves the Logging enum into both the `local` and the `remote` package. This duplicates some code but keeps the packages separated. As the provider is not GA yet, we could reverse this once the upstream is fixed, at the cost of a breaking change. Tested a local `pulumi up`. Fixes #445
lunaris
added a commit
that referenced
this issue
May 20, 2024
The current Python code generator does not emit `__init__.py` files for modules that only contain enumerations. This is problematic in cases such as #16221, whereby `pulumi-command` wishes to define an enumeration to be shared across modules, in a module with no other types or resources. In such cases, an SDK is generated that does not type check, since the enumeration types are not exported appropriately. This commit addresses this by generating `__init__.py` files in these cases as expected.
lunaris
added a commit
that referenced
this issue
May 20, 2024
The current Python code generator does not emit `__init__.py` files for modules that only contain enumerations. This is problematic in cases such as #16221, whereby `pulumi-command` wishes to define an enumeration to be shared across modules, in a module with no other types or resources. In such cases, an SDK is generated that does not type check, since the enumeration types are not exported appropriately. This commit addresses this by generating `__init__.py` files in these cases as expected.
lunaris
added a commit
that referenced
this issue
May 20, 2024
The current Python code generator does not emit `__init__.py` files for modules that only contain enumerations. This is problematic in cases such as #16221, whereby `pulumi-command` wishes to define an enumeration to be shared across modules, in a module with no other types or resources. In such cases, an SDK is generated that does not type check, since the enumeration types are not exported appropriately. This commit addresses this by generating `__init__.py` files in these cases as expected.
github-merge-queue bot
pushed a commit
that referenced
this issue
May 20, 2024
The current Python code generator does not emit `__init__.py` files for modules that only contain enumerations. This is problematic in cases such as #16221, whereby `pulumi-command` wishes to define an enumeration to be shared across modules, in a module with no other types or resources. In such cases, an SDK is generated that does not type check, since the enumeration types are not exported appropriately. This commit addresses this by generating `__init__.py` files in these cases as expected. Fixes #16221
Cannot close issue:
Please fix these problems and try again. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area/codegen
SDK-gen, program-gen, convert
kind/bug
Some behavior is incorrect or out of spec
language/python
resolution/fixed
This issue was fixed
In pulumi-command v0.11.0, a new enum
Logging
was introduced to be used an input and output type. It worked in all languages but Python. In Python, programs failed with@lunaris determined that the problem was a missing init.py for the module containing the enum, so the symbols weren't being re-exported.
Codegen generates an init.py if it thinks the module is "not empty". This checks for resources, functions, and types, but not, it seems, enums.
Schema and Python SDK can be seen at the v0.11.0 tag.
The text was updated successfully, but these errors were encountered: