Commit graph

125 commits

Author SHA1 Message Date
Komal af9f636eef
Split schema tests by language (#5540) 2020-10-10 13:47:23 -07:00
Levi Blackstone 38172999e7
[codegen] Extract common test logic (#5480) 2020-09-30 14:41:52 -06:00
Levi Blackstone 64602798b1
[codegen/python] Don't generate get methods for ComponentResources (#5459) 2020-09-30 10:16:25 -06:00
Komal 59b906eb76
Update nodejs gen-tests (#5477) 2020-09-29 16:00:03 -07:00
Levi Blackstone 9363f606b6
[codegen/schema] Add IsComponent to resource schema (#5395)
Add support for ComponentResources to the schema by
adding a new IsComponent field to the Resource spec.
2020-09-23 18:23:46 -06:00
Levi Blackstone 81580289a7
[codegen/python] Handle ResourceType (#5444) 2020-09-23 13:39:25 -06:00
Mikhail Shilkov 0d38c6737e
[codegen] Tweak docs and example generation for azure-nextgen (#5390)
[codegen] Tweak docs and example generation so that azure-nextgen is represented correctly
2020-09-16 20:11:56 +02:00
Mikhail Shilkov da1f25928d
[codegen] Adjust Go/Python package naming for Azure NextGen (#5373) 2020-09-15 13:56:58 +02:00
Justin Van Patten 5164725cb5
[codegen/python] Remove panic from PyName (#5341)
The codegen updates have been run against all providers, so there's no longer a need to keep the panic.
2020-09-14 08:42:01 -07:00
Justin Van Patten 5e06da464a
[codege/python] Use int as the type annotation for integers (#5309) 2020-09-11 14:56:29 -07:00
Justin Van Patten 4dd40e4490
[codegen/python] Use pulumi.runtime.to_json (#5308)
Non-string provider inputs must be projected as JSON formatted strings. The current codegen simply calls `json.dumps` for such properties, but this does not work for the new input types, which aren't JSON serializable.

To address this, make use of the new `pulumi.runtime.to_json` utility function, which is capable of serializing raw dicts and input types as JSON.
2020-09-11 14:27:36 -07:00
Justin Van Patten dee923d99c
[codegen/python] Emit array types as Sequence (#5283)
We currently emit array types as `List[T]` for Python, but `List[T]` is invariant, which causes type checkers like mypy to produce errors when values like `["foo", "bar"]` are passed as args typed as `List[pulumi.Input[str]]`. Instead, we should move to using `Sequence[T]` which is covariant, and does not have this problem.

We actually already do this for `Dict` vs. `Mapping`, emitting map types as `Mapping[str, T]` rather than `Dict[str, T]` because `Mapping[str, T]` is covariant. This change makes us consistent for array types.
2020-09-10 14:54:27 -07:00
Vivek Lakshmanan e84e0401f0
Speed up doc generation by avoiding repeated python language import (#5277)
Fixes https://github.com/pulumi/pulumi/issues/5184
2020-09-10 16:12:09 +02:00
Mikhail Shilkov 53b48cef2f
Exclude two more names from PyName (#5285) 2020-09-03 18:02:21 +02:00
Albert Zhong 69c57f8b47
Add ignorePyNamePanic python flag (#5268) 2020-09-02 16:25:19 -07:00
Justin Van Patten 7eb99fe7bb
[codegen/python] Emit properties named "property" last (#5247)
This avoids conflicting with the built-in `@property` decorator function for other properties.
2020-08-28 08:55:02 -07:00
Justin Van Patten 910aa96016
[codegen/python] Add type annotation to resource_name arg (#5217) 2020-08-25 12:07:08 -07:00
Justin Van Patten 502685ed0e
[codegen/python] Fix resource outputs type annotations (#5221)
These should be typed as `Output[T]`.
2020-08-25 11:07:22 -07:00
Mikhail Shilkov 4c42e5e850
Relax submodule generation for Node and Python (#5204) 2020-08-23 00:00:21 +02:00
Mikhail Shilkov b9b3c836bc
Exclude more names from Python name validation (#5205) 2020-08-21 20:41:33 +02:00
Justin Van Patten 6292543342
[codegen/python] Fix unintended name changes from PyName and some whitespace cleanup (#5202)
If PyName(name) != PyNameLegacy(name), we panic, unless name is in an exclusion list.

Once all providers have been updated to this codegen (and we've added to `useLegacyName` and `excludeFromPanic` as appropriate), we can go back and remove the panic behavior along with the `excludeFromPanic` behavior.
2020-08-20 20:51:32 -07:00
Justin Van Patten ca7536e17f
[codgen/python] Always consider the config subpackage non-empty (#5195)
If there's a config subpackage, we had explicitly added it to the map of modules because there *are* config properties, so we know it will be non-empty. This change ensures the config subpackage is imported in the top-level package's __init__.py and that the config subpackage itself has an __init__.py emitted.
2020-08-20 11:07:09 -07:00
Justin Van Patten 92c0d1dc30
Docgen changes for Python input/output types (#5137)
Resource doc changes for Python:

- Types are included in constructor/function args
- The property names for input/output types are now always snake_case, regardless of the generated mapping tables, to match the new input/output classes
- Some other minor tweaks to function/constructor signatures (e.g. removed the `__props__` arg, as it's not meant to be used directly; use `@staticmethod` for static `get` methods).
2020-08-19 08:34:06 -07:00
Justin Van Patten 78edb28590
Add Python input/output classes to provider codegen (#5034)
This updates the Python codegen to emit input/output classes.
2020-08-19 01:16:47 -07:00
Vivek Lakshmanan 8777dd77ca
Merge pull request #5170 from pulumi/vl/ResourceOptions
Map python resource options to provider options
2020-08-17 17:36:05 -07:00
Vivek Lakshmanan f6fd98544d
Update pkg/codegen/python/gen.go
Co-authored-by: Justin Van Patten <jvp@justinvp.com>
2020-08-17 16:58:59 -07:00
Komal d7ce0e586c
[codegen/python] - Include single word props in casing tables. (#5181) 2020-08-17 16:44:55 -07:00
Vivek Lakshmanan 38387f1742 Set the snake case translation for provider input properties
Fixes https://github.com/pulumi/pulumi-kubernetes/issues/1244
2020-08-14 14:34:46 -07:00
Komal 2f2e62e2e4
[codegen/python] - Normalize module names in program gen (#5128) 2020-08-07 09:30:07 -07:00
Komal ff219a2381
Use input/output classes in program gen (#5086) 2020-08-06 15:09:23 -07:00
Levi Blackstone ba18683d9a
[codegen] Generate null values for model.NoneType (#5122) 2020-08-06 14:12:27 -06:00
Komal 269b537e57
[codegen/python] - Fix python resource tokens (#5107) 2020-08-05 12:50:54 -07:00
Komal d2dd990866
[codegen/python] Fix pyname bug (#4918) 2020-08-05 10:08:52 -07:00
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
Praneet Loke 1acc8231b1
[codegen/docs] Use the correct format for package name when module name is empty (#4889)
* Use the correct format for package name when module name is empty.

* Add an exclusion for Docker's Image component resource when generating the Python formal params.

* Prefix the type name with the package name when linking to Python function names.
2020-07-07 17:24:07 -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
Pat Gavlin a8a20ecb4b
[codegen/*] Add support for explicit secrets. (#4927)
- Add a new builtin function, secret, that marks its input value as
  secret
- Add support for this function to the various code generators

Fixes #4924.
2020-06-30 11:35:24 -07:00
Mikhail Shilkov bb358c4d21
Escape \x in Python comments (#4922) 2020-06-30 11:19:45 +02:00
Pat Gavlin 69ba47cff2
[codegen/*] Add support for resource options. (#4925)
The PCL binder has supported resource options for some time, but these
options haven't been used or processed by the various code generators.
These options--particularly the parent and provider options0--are
critical for import codegen. These changes implement the basic set of
options, and add a note about fleshing out the rest as necessary.

One component of these changes is a new rewriter that rewrites property
references into property paths that are understood by the Pulumi engine.
This rewriter is used to preprocess the contents of the `ignoreChanges`
resource option.

These changes also hack around a weakness in the HCL2 type system:
In Go, references to resources should be typed as `hcl2.ResourceType`.
Unfortunately, this breaks the existing collection semantics associated
with resources. Because of this, the Go code generator does not have
enough information to know that it should generate a `[]pulumi.Resource`
for lists of resources. These changes hack around that limitation using
a Go-specific opaque type and some hardcoded comparisons in
`argumentTypeName`.

Fixes #4923.
2020-06-29 16:33:52 -07:00
Mikhail Shilkov 14a3871346
Avoid stack overflow in Python codegen in case of recursive types (#4908) 2020-06-26 20:47:13 +02:00