mirror of https://github.com/pulumi/pulumi.git
17 Commits
Author | SHA1 | Message | Date |
---|---|---|---|
![]() |
6cfa4afcaf
|
Display full type names in Python references in the docs (#15784)
<!--- Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation. --> # Description Currently, our resource API docs for Python only display a type name itself. If the type is defined in a different module, we do not indicate this explicitly, which causes confusion. For example, [K8s Pod Inputs](https://www.pulumi.com/registry/packages/kubernetes/api-docs/core/v1/pod/#inputs) is in `core.v1` module itself but refer to the `meta.v1.ObjectMeta` type. Node.js docs display the type as <img width="719" alt="image" src="https://github.com/pulumi/pulumi/assets/1454008/fb3e8fc5-7dc8-4661-ac6f-95e7d7918cfc"> but Python simply shows <img width="725" alt="image" src="https://github.com/pulumi/pulumi/assets/1454008/4cd4c09c-13cb-4070-b716-0b78ad98379b"> The same problem exists when we reference types from external packages, and even for composed types like `Sequence[some_external_type]`. This PR removes a special case for Python that reduces a full type name to its name. Instead, it executes on the same path as Node.js and C#. I had to apply some cleaning to Python types to remove underscore prefixes of modules. We use underscore-prefixed imports in SDK gen, but they should not be visible in user docs. I expect we need to apply the same fix to Go, but I suggest we do that as a follow-up. Testing: the existing test suite seems adequate for testing the change. All the discrepancies look like improvements to me. Fixes #15137 ## Checklist - [x] I have run `make tidy` to update any new dependencies - [x] I have run `make lint` to verify my code passes the lint check - [x] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [x] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [ ] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. --> |
|
![]() |
4a012def4b
|
[sdk-gen, dotnet/go] Fixes SDK-generation when referencing shared types in config variables (#15772)
# Description Fixes #15751 - In .NET, non-primitive types such as objects used in config variables will be generated anyways under the `Types` namespace as plain-shaped objects inside of the `Config` class. This is because the types from `Outputs` or `Inputs` cannot be used directly from config. Also no longer marking objects used from config variables as "outputs" (doesn't make any sense) - In Go, disable adding imports into the `config.go` based on used shared types because these are not used/referenced in the config module anywhere anyways. ## Checklist - [x] I have run `make tidy` to update any new dependencies - [x] I have run `make lint` to verify my code passes the lint check - [x] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [x] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. --> |
|
![]() |
3d1641b100
|
[program-gen/tests] Replace discriminated unions test program with a program from a synthetic schema of basic unions (#15771)
# Description This PR replaces the test program `discriminated-unions` with a new program `basic-unions` that uses a synthetic schema that has basic union definitions. The former program was failing compilation with Go because of a **faulty** azure-native SDK (tests using v1.56.0). It didn't generate the extra types for union objects (those with suffix `Args`). Those missing extra types are added in newer versions of azure-native SDK but the shape of the same resource doesn't have unions anymore so we can't just upgrade the version of the azure-native sdk we are testing with. I decided not to depend on a specific azure-native SDK and instead use a synthetic schema with the sole purpose of showing that we can emit correct code for fields assigned to object which are bound to different union cases. The downside here is that we can't compile the example for any language since it is a synthetic schema with no generated SDK (conformance tests in Go would make this possible but we are far away from that 😢) Closes #10834 since the original issue was due to faulty SDK, not program-gen. ## Checklist - [ ] I have run `make tidy` to update any new dependencies - [ ] I have run `make lint` to verify my code passes the lint check - [ ] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [x] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [ ] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. --> |
|
![]() |
00b685606d
|
[docs] Implement Java constructor syntax examples (#15805)
# Description This PR implements Java constructor syntax examples, rendering them into the docs. It upgrades pulumi-java to 0.10.0 which includes features from https://github.com/pulumi/pulumi-java/pull/1338 It also updates contructor syntax generator to emit an unbound variable for resource-typed properties. We use the name of the resource as the name of the variable: ```typescript const example = new Resource("name", { pet: randomPet }) ```` where `pet` is a property that is typed as `random.RandomPet` so it gets assigned the (unbound) variable called `randomPet` Previously we would skip emitting any code for resource-typed properties. I think this gives better docs even though it doesn't compile ## Checklist - [ ] I have run `make tidy` to update any new dependencies - [x] I have run `make lint` to verify my code passes the lint check - [x] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [x] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. --> |
|
![]() |
9297e25c42
|
Add a link to the Import documentation from API docs pages (#15792)
Adds a link to the Import docs from the API docs (to help answer questions about how import works, where to look for identifiers, etc.) and adds a line break to the `import --help` CLI output. (Sorry, my bad!)  Fixes https://github.com/pulumi/registry/issues/3039. |
|
![]() |
5f5c311e71
|
[docs] Implement YAML constructor syntax examples (#15791)
# Description This PR implements constructor syntax examples in YAML, rendering them into the docs. ## Checklist - [ ] I have run `make tidy` to update any new dependencies - [x] I have run `make lint` to verify my code passes the lint check - [x] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [x] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. --> |
|
![]() |
c7c91f023f
|
[program-gen/csharp] Fixes generated code for a list of resources used in resource option DependsOn (#15773)
# Description Fixes #14462 by special casing how we handle `dependsOn` and generating `DependsOn = { ... }` instead of `DependsOn = new[] { ... }` ## Checklist - [ ] I have run `make tidy` to update any new dependencies - [x] I have run `make lint` to verify my code passes the lint check - [ ] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [x] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. --> --------- Co-authored-by: Thomas Gummerer <t.gummerer@gmail.com> |
|
![]() |
7627d8097e
|
[program-gen/go,dotnet] Fixes emited code for object expressions assigned to properties of type Any (#15770)
# Description Fixes #15769 by specifically handling object expressions that are annotated as `Any` and emitting the correct code. - In case of Go, expression `X` is emitted as `pulumi.Any(X)` where the type name here is `map[string]interface{}`. - In case of C#, we generate `Dictionary<string, object?>` expressions (similar to what we do inside `toJSON` calls) - Updates the test aws-native schema from 0.13.0 to 0.99.0 ## Checklist - [ ] I have run `make tidy` to update any new dependencies - [x] I have run `make lint` to verify my code passes the lint check - [x] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [x] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. --> |
|
![]() |
3043adeeb3
|
Add SupportPack to schemas to write out in the new style (#15713)
<!--- Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation. --> # Description <!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. --> This adds a new flag to the schema metadata to tell codegen to use the new proposed style of SDKs where we fill in versions and write go.mods etc. I've reworked pack to operate on packages assuming they're in this new style. That is pack no longer has the responsibility to fill in any version information. This updates python and node codegen to write out SDKs in this new style, and fixes their core libraries to still be buildable via pack. There are two approaches to fixing those, I've chosen option 1 below but could pretty easily rework for option 2. 1) Write the version information directly to the SDKs at the same time as we edit the .version file. To simplify this I've added a new 'set-version.py' script that takes a version string an writes it to all the relevant places (.version, package.json, etc). 2) Write "pack" in the language host to search up the directory tree for the ".version" file and then fill in the version information as we we're doing before with envvar tricks and copying and editing package.json. I think 1 is simpler long term, but does force some amount of cleanup in unrelated bits of the system right now (release makefiles need a small edit). 2 is much more localised but keeps this complexity that sdk/nodejs sdk/python aren't actually valid source modules. ## Checklist - [x] I have run `make tidy` to update any new dependencies - [x] I have run `make lint` to verify my code passes the lint check - [x] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [x] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [ ] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. --> |
|
![]() |
ad56486bf0
|
[docs] Emit example constructor syntax for resources in typescript, python, go and csharp (#15624)
# Description This PR is an initial implementation of emitting constructor syntax of resources into the docs for typescript, python, go and csharp. ## Checklist - [ ] I have run `make tidy` to update any new dependencies - [x] I have run `make lint` to verify my code passes the lint check - [ ] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [x] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. --> |
|
![]() |
3bdc65c6e5
|
[program-gen] Fix enum resolution from types of the form Union[string, Enum] and emit fully qualified enum cases (#15696)
# Description This PR improves enum type resolution from strings. When we try to resolve `Union[string, Enum]` for a string expression, we choose `string` because it is the more general type since not every string is assignable to `Enum`. However, here we spacial case strings that are actually part of that `Enum`. The result is that `pcl.LowerConversion` will choose `Enum` from `Union[string, Enum]` when the value of the input string is compatible with the enum. This greatly improves program-gen for all of typescript, python, csharp and go which now will emit the fully qualified enum cases instead of emitting strings. Closes https://github.com/pulumi/pulumi-dotnet/issues/41 which is supposed to be a duplicate of https://github.com/pulumi/pulumi-azure-native/issues/2616 but that is not the case (the former is about unions of objects, the latter is unions of enums and strings) ## Checklist - [ ] I have run `make tidy` to update any new dependencies - [x] I have run `make lint` to verify my code passes the lint check - [x] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [x] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. --> |
|
![]() |
f95007e0ba
|
Update descriptions for property types defined in an external package (#15651)
intermediary fix for: https://github.com/pulumi/pulumi/issues/12765 For types that are defined in an external package, we do not render a description and its links are broken. This is an intermediary solution until we can render out nested types defined in external packages on the page or derive the resource page in the external package that contains the type definition. This PR identifies if a property type is externally defined and places a message indicating the type is defined externally in the description field. <img width="764" alt="Screen Shot 2024-03-13 at 10 10 26 AM" src="https://github.com/pulumi/pulumi/assets/16751381/4be9a771-d3a0-4930-8469-d54f3b5e4e54"> <img width="747" alt="Screen Shot 2024-03-13 at 10 03 54 AM" src="https://github.com/pulumi/pulumi/assets/16751381/45312baa-4929-434c-829a-a5e6494afad8"> |
|
![]() |
6b554338b3
|
Ensure package generation for Go SDKs doesn't panic when encountering overly nested arrays or maps of primitive types (#15680)
# Description Fixes #15478 where sdk-gen should no longer panic when encountering overly nested arrays or maps of primitive types. The generated code still fails to compile but validation can be added later to cover cases where we are missing primitives in the core SDK to handle overly nested type definitions. ## Checklist - [ ] I have run `make tidy` to update any new dependencies - [x] I have run `make lint` to verify my code passes the lint check - [ ] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [x] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. --> |
|
![]() |
72ce48afd5
|
[sdkgen/python] Replace-on-changes values should be camelCased (#15666)
<!--- Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation. --> # Description When replaceOnChanges is set in the schema for a property with a multi-word name, currently, Python SDK generation incorrectly puts its Python name into replace_on_changes. This is wrong, because these property names are passed to the engine and they should be engine names (i.e. schema names). All other languages (Node.js, .NET, Go) do this correctly. This PR adds a test case and fixes the Python generation to use the same naming as all other SDKs. Fixes #15665 ## Checklist - [x] I have run `make tidy` to update any new dependencies - [x] I have run `make lint` to verify my code passes the lint check - [ ] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [x] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. --> |
|
![]() |
8b3f94b89c
|
[program-gen] Fix panic when generating programs for MLC packages using external types (#15605)
# Description For an MLC package such as `aws-static-website`, it has some types which are referenced from the `aws` package. Program-gen assumes packages are inferred from resources and invokes, not types which caused panics in Go (#15597), dotnet and python (https://github.com/pulumi/pulumi-converter-constructor-syntax/issues/2) This PR fixes those panics. In Go the panic was due to using package name instead of the package reference from the imported type. In dotnet and python was due to assuming no external type references. Now we generate nice code for all these languages. That said, there is still an issue of resolving imports for the packages of these external types. It works in Go, TypeScript doesn't need it but dotnet and python do. That is why the latter are added in `SkipCompile` in the test program. Fixes #15597 Fixes https://github.com/pulumi/pulumi-converter-constructor-syntax/issues/3 Fixes https://github.com/pulumi/pulumi-converter-constructor-syntax/issues/2 ## Checklist - [ ] I have run `make tidy` to update any new dependencies - [x] I have run `make lint` to verify my code passes the lint check - [ ] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [x] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. --> |
|
![]() |
27041c93d8
|
[program-gen/go] Fix optional primitive values being derefrenced (#15592)
# Description Fixes #15524 where the primitive optional types were being derefrenced. It took me a while to figure where the problem was because I couldn't really reproduce the original issue with a new PCL program. The `aws-optionals-pp` test case program in PCL would repro the issue when converted from the CLI via `convert --from pcl` but not from the unit tests even when using the exact same schema 🤔 this was really weird. That said, the fix turned out straightforward and it does fix the same issue in generated component resources. ## Checklist - [ ] I have run `make tidy` to update any new dependencies - [x] I have run `make lint` to verify my code passes the lint check - [ ] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [ ] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. --> |
|
![]() |
d62c398bfb
|
Move codegen testdata (#15549)
<!--- Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation. --> # Description <!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. --> It appears that Go copies testdata into every GOMODCACHE of a project that depends on pulumi/pkg; the schemas in codegen testdata add 300MB of weight to the GOMODCACHE needed for download. What if we moved the testdata out from under the tree. The move looks like this: ``` from=pkg/codegen/testing/test/testdata to=tests/testdata/codegen/ git mv "$from" "$to" (cd pkg/codegen/testing/test && ln -s ../../../../tests/testdata/codegen ./testdata) git add "$from" ``` The previous location is symlinked to the new location. Evidence of `GOMODCACHE` pressure reduction: https://gist.github.com/t0yv0/05dd8be5880171045aed01e123ae2b09 ## Checklist - [ ] I have run `make tidy` to update any new dependencies - [ ] I have run `make lint` to verify my code passes the lint check - [ ] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [ ] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [ ] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. --> |