Commit graph

105 commits

Author SHA1 Message Date
Mikhail Shilkov 044bb6bb61
Match module versions also outside the kubernetes compat flag (#5088) 2020-07-31 21:50:34 +02:00
Mikhail Shilkov 526e5264b8
Handle resource_name properties to avoid conflicts in Python codegen (#5052) 2020-07-30 16:29:36 +02:00
Lee Briggs 3b0462f0e0
Merge branch 'master' into jaxxstorm/provider-info 2020-07-20 17:35:47 -07:00
Komal 1a10e06588
Add a helper function to clean the codegen dir (#5018) 2020-07-15 16:11:37 -07:00
Komal 6682da5fa5
[codegen/python] Add underscores to private modules to avoid exporting them. (#4959) 2020-07-15 13:10:52 -07:00
Pat Gavlin a19843f433
[codegen/{go,nodejs,python}] Normalize modules. (#5006)
In general, a package/module name in these targets is derived from the
module portion of a type token. If the type token is not already in an
expected form--namely, all lowercase--the generated package/module names
will also be in unexpected forms. These changes normalize the module
names to lowercase s.t. the generated package/module names conform to
expectations.
2020-07-14 10:58:29 -07:00
Komal bdc86e002a
Change how submodules are imported to work with Intellisense (#4948) 2020-07-08 18:34:59 -07:00
Komal 56fa087bd6
[codegen/python] pep-8 compliant spacing (#4958)
* pep-8 compliant spacing

* PR fixes
2020-07-07 11:32:48 -07:00
Levi Blackstone d611740ab0
[codegen] Set additionalSecretOutputs for secret props (#4956) 2020-07-02 13:30:10 -06:00
Lee Briggs c25cbf0fc8
switch terminology to plugin download URL
After a discussion about terminology, the better phrasing is to use
pluginDownloadURL
2020-07-02 09:29:19 -07:00
Lee Briggs f310c21b85
Add providerURL to package definition 2020-07-01 19:10:25 -07:00
Levi Blackstone 956d362d8b
[codegen] Don't log deprecation warnings in k8s SDKs (#4942)
The k8s SDK logs deprecations warnings as part of the
provider logic, and includes a flag to suppress these
warnings. Including them in the SDKs breaks this logic.
2020-07-01 13:50:26 -06:00
Mikhail Shilkov bb358c4d21
Escape \x in Python comments (#4922) 2020-06-30 11:19:45 +02:00
Mikhail Shilkov 14a3871346
Avoid stack overflow in Python codegen in case of recursive types (#4908) 2020-06-26 20:47:13 +02:00
Komal 3eacf8bf90
[codegen/python] Only add item to map if it doesn't already exist. (#4907) 2020-06-26 09:05:36 -07:00
Komal b35a94cac6
[codegen/python] - Exclude single word properties from casing tables. (#4895)
Co-authored-by: Levi Blackstone <levi@pulumi.com>
2020-06-25 11:51:57 -07:00
Komal 93fa20a44b
[codegen/python] - Only import json when needed (#4892) 2020-06-25 09:59:00 -07:00
Komal ed752bc384
[codegen/python] Don't use __all__ (#4873) 2020-06-24 11:41:03 -07:00
Komal 669448ab40
[codegen/python] Use CamelCase filenames for k8s. (#4878) 2020-06-23 13:02:22 -07:00
Komal 1837c0a779
[codegen/python] Allow setting constant values for props (#4864)
* Allow setting constant values for props

* PR feedback
2020-06-22 10:58:13 -07:00
Komal 9a62c92efc
[codegen/python] Add missing props to casing table (#4863) 2020-06-22 09:49:34 -07:00
Levi Blackstone 282c95ee40
[codegen] Use nullish coalescing for provider defaults on k8s (#4841)
For the NodeJS k8s SDK, rather than falling back to default values
using the || operator, use the nullish coalescing operator (??).
This avoid situations where the primary value is set to false,
and then is overridden by the default value.
2020-06-22 09:38:20 -06:00
Komal 14ef36553d
[codegen/python] Add whitespace to make the linter happy (#4857) 2020-06-18 17:32:52 -07:00
Komal 63e7388879
[codegen/python] Remaining k8s updates (#4786) 2020-06-18 15:46:17 -07:00
Pat Gavlin 4a903f95b9
[codegen/docs] Reimplement example extraction. (#4851)
Use the schema package's Markdown parser and walk its AST to extract
examples.

These changes also rename StripNonRelevantExamples to FilterExamples.

This is preparatory work for #4159 and #4632.
2020-06-18 12:32:15 -07:00
stack72 0a93270ffd Escape deprecation messages coming from upstream TF providers
Fixes: #4827

Diff:

```
             if encrypted is not None:
-                warnings.warn("Rename PostgreSQL role resource attribute "encrypted" to "encrypted_password"", DeprecationWarning)
+                warnings.warn("Rename PostgreSQL role resource attribute \"encrypted\" to \"encrypted_password\"", DeprecationWarning)
                 pulumi.log.warn("encrypted is deprecated: Rename PostgreSQL role resource attribute "encrypted" to "encrypted_password"")

```
2020-06-17 20:25:06 +03:00
Komal 92e44bee6d
[codegen/python] Handle extra files (#4842) 2020-06-16 19:27:06 -07:00
Komal f9074f6bcb
[codegen/python] - Exclude nested docs for k8s (#4828) 2020-06-15 16:17:05 -07:00
Komal 481750ec5b
[codegen/python] Fix edge case in relative import (#4809) 2020-06-11 15:31:39 -07:00
Komal ea3d6aa005
[codegen/python] Don't use config for k8s (#4807) 2020-06-11 11:52:26 -07:00
Komal 5ec251ae66
[codegen/python] Fix relative import path (#4796) 2020-06-11 09:10:53 -07:00
Komal 074eb67e82
[codegen/python] Add newlines to be pep8 compliant (#4797) 2020-06-10 15:11:59 -07:00
Komal d699627ff6
[codegen/python] Fix k8s __init__.py generation (#4795)
* Fix k8s __init__.py generation

* Add comment for regex
2020-06-10 13:55:10 -07:00
Komal 238adf2f2f
[codegen/python] Allow import path overrides (#4787)
* Allow import path overrides

* Fix typo

* Rename ModuleToPackage to ModuleNameOverrides
2020-06-09 14:33:02 -07:00
Komal b93259c6bb
[codegen/python] Fix readme generation (#4759)
* Fix readme generation

* Allow readme text to be passed in with the package.
2020-06-08 13:07:56 -07:00
Komal 6c29b67c03
[codegen/python] Fix doc generation in python codegen (#4757) 2020-06-08 12:44:57 -07:00
Paul Stack 58002bae62
Ensuring a property level deprecation warning is set for python codegen (#4744) 2020-06-04 11:29:23 +01:00
Pat Gavlin bd1c0e6d7b
[codegen/schema] Support default union types. (#4746)
Add support for union types that indicate a default type for targets
that do not support unions, or do not support unions in certain
positions (e.g. output properties). The NodeJS backend makes use of this
in combination with a new flag, `disableUnionOutputTypes`, to avoid
generating unions in output types.

These changes also refactor the various module ->
package/module/namespace mapping methods so that these entities can be
fetched by their language name rather than their token.
2020-06-02 18:15:21 -07:00
Pat Gavlin 7b446d6c55
Escape """ in Python doc comments. (#4570)
With the addition of Python examples, doc comments may now contain
triple quotes. These must be escaped in order to avoid malformed source
files.

Fixes #4568.
2020-05-05 12:39:35 -07:00
Mikhail Shilkov d91f658576
Codegen changes to prepare for C# Kubernetes schema (#4531)
Codegen changes to prepare for C# Kubernetes schema
2020-05-01 12:45:47 +02:00
Pat Gavlin 5271eda247
[codegen/python] Fix case mapping. (#4538)
Mapping happens at package scope, not type scope. This is what causes
some of the surprising mixes of camel and snake casing in our packages.

In order to accommodate this, build the case mapping tables up front,
and refer to them when performing case mapping.
2020-04-30 14:16:56 -07:00
Pat Gavlin af344d9b72
Fix Python module names. (#4473)
In particular, ensure that they are keyword-safe. This affects
`aws:lambda:*` in particular: prior to these changes, we were generating
code into `pulumi_aws.lamdba`, which is not referencable due to its use
of the `lamdba` keyword. With these changes, we generate code into
`pulumi_aws.lambda_`.

There is also a small fix for multi-line non-formatted strings: these
strings do not need escaped braces.
2020-04-24 08:52:36 -07:00
Pat Gavlin 1d672563da Fix output property names in Python codegen.
Some property names are mapped from their `camelCase` Pulumi name to a
`snake_case` Python name. This mapping is irregular, and only occurs for
resources properties and function calls.

Note that there's still more work to do here: this only fixes names on
the output side; the input side is still broken for nested resource
proprerties and function calls.

The underlying design--annotated types in `hcl2/model`--may need some
additional work in the future, but I _believe_ it's good enough for now.
2020-04-21 10:25:27 -07:00
Pat Gavlin 1f19cbbe08
Clean up the language-specific schema APIs. (#4454)
Rather than forcing consumers to deal with language-specific data
ad-hoc, add an API that allows all language-specific data to be decoded
up-front.
2020-04-20 16:36:05 -07:00
CyrusNajmabadi 66bd3f4aa8
Breaking changes due to Feature 2.0 work
* Make `async:true` the default for `invoke` calls (#3750)

* Switch away from native grpc impl. (#3728)

* Remove usage of the 'deasync' library from @pulumi/pulumi. (#3752)

* Only retry as long as we get unavailable back.  Anything else continues. (#3769)

* Handle all errors for now. (#3781)


* Do not assume --yes was present when using pulumi in non-interactive mode (#3793)

* Upgrade all paths for sdk and pkg to v2

* Backport C# invoke classes and other recent gen changes (#4288)

Adjust C# generation

* Replace IDeployment with a sealed class (#4318)

Replace IDeployment with a sealed class

* .NET: default to args subtype rather than Args.Empty (#4320)

* Adding system namespace for Dotnet code gen

This is required for using Obsolute attributes for deprecations

```
Iam/InstanceProfile.cs(142,10): error CS0246: The type or namespace name 'ObsoleteAttribute' could not be found (are you missing a using directive or an assembly reference?) [/Users/stack72/code/go/src/github.com/pulumi/pulumi-aws/sdk/dotnet/Pulumi.Aws.csproj]
Iam/InstanceProfile.cs(142,10): error CS0246: The type or namespace name 'Obsolete' could not be found (are you missing a using directive or an assembly reference?) [/Users/stack72/code/go/src/github.com/pulumi/pulumi-aws/sdk/dotnet/Pulumi.Aws.csproj]
```

* Fix the nullability of config type properties in C# codegen (#4379)
2020-04-14 09:30:25 +01:00
Praneet Loke 729ae08c9d
Handle k8s cases in the resource doc generator (#4337)
* Add a check for the Python code gen to prevent infinte recursion. Remove the custom logic for k8s for generating Python property case maps.

* Fix bug with C# links for k8s constructor resources.

* Apply a style on the deprecation message.

* Use the display name when rendering a property type that does not have a link.

* Fix the python type string generator for docs to inspect union types.

* Update cleanTypeString to account for nodejs package names.

* Add missing lookup names for packages.
2020-04-10 14:07:52 -07:00
Praneet Loke 651d951416
Remove non-relevant examples and empty examples section from docs comments (#4184)
* Add tests for the examples processing.

* Update the schema-based code generators to strip out non-relevant code examples wrapped in short-codes.

* Extract language relevant examples for Functions too.

* Simpler way of extracting the surrounding text from the description.

* Add some more new-line characters to clean-up the examples sections.
2020-03-26 10:30:04 -07:00
evanboyle fccf301d14 move pkg/util/contract -> sdk/go/common/util/contract 2020-03-18 14:40:07 -07:00
Pat Gavlin 8111d33438
Shorten Python package descriptions. (#4068)
These descriptions should only be one line, and should not contain markdown.
2020-03-12 21:43:54 -07:00
Pat Gavlin 622cac4dd4
Stabilize Python codegen. (#4056)
Make sure all property casing conversions are computed prior to codegen.
2020-03-11 15:42:15 -07:00
stack72 b100f8494e Ensure python overlays work as expected
Fixes: https://github.com/pulumi/pulumi-terraform-bridge/issues/119

This allows us to specify an overlays block e.g.

```
Overlay: &tfbridge.OverlayInfo{
	DestFiles: []string{
		"pulumi_docker/docker.py",
		"pulumi_docker/image.py",
	},
},
```

The overlays files are treated differently to normal module files
as they are not generated. This structure means that we will emit
the correct entries in the __init__.py file

Without this structure (ie. pulumi_pkgname), the generator actually
copies the file (i.e. docker.py) to the root of the Python SDK. This
is because the structure of the Python SDK has a sub-folder than that
of the NodeJS SDK

I tested this using PR https://github.com/pulumi/pulumi-docker/pull/141
and this now works as expected and we can take advantage of the new
Python overlays for Docker
2020-03-10 00:03:41 +02:00
Pat Gavlin 2b59d1405d
Fix a few codegen issues. (#3915)
- Make go comment generation lint-clean for blank comment lines
- Fix the casing of `Provider.py` in Python to `provider.py`
- Fix a spacing issue in the NodeJS code generator
2020-02-11 14:34:22 -08:00
Pat Gavlin add181e57c
Small fixes in schema codegen. (#3889)
- Do not JSON-encode provider properties that are token types with an
  underlying string type
- Emit PEP 561 type metadata in setup.py
2020-02-07 09:43:20 -08:00
Pat Gavlin ad96a45a05
Align defaults with OpenAPI (#3859)
Replace the various `defaults` maps in the schema with per-property
`default` and `defaultInfo` fields. The former holds the static default
value; the latter holds the envvars and language-specific info.

Also, fix a minor bug in the Python codegen that caused diffs in
property docstrings.
2020-02-05 11:43:39 -08:00
Pat Gavlin d400f26832
Add a schema package and code generators. (#3749)
The schema format is described in pkg/codegen/schema/schema.go. The code
generators are derived from the code generators contained in
https://github.com/pulumi/pulumi-terraform-bridge/pkg/tfgen, with the
exception of the Go code generator, which is net new.
2020-01-21 14:45:48 -08:00