Commit graph

11 commits

Author SHA1 Message Date
Justin Van Patten 9bcf02e7ed
Support remote components in Python (#5375) 2020-09-30 14:09:20 -07:00
CyrusNajmabadi 20058f982d
Make 'ResourceOptions.merge' static so downstream clients don't have to manually handle None cases. (#3072) 2019-08-14 15:55:03 -07:00
CyrusNajmabadi a13a04b193
Move resource-options check down to core layer. (#3043) 2019-08-06 17:39:34 -07:00
CyrusNajmabadi d1376db975
Support arbitrary stack export values in python. (#3015) 2019-08-01 20:00:07 -07:00
Luke Hoban fa4da84669
Add get_object functions to Python SDK (#2959)
Fixes #2320
2019-07-20 07:04:18 -07:00
Sean Gillespie ad32d9d8ac
Plumb provider version through language hosts to engine (#2656)
* NodeJS: allow callers to override provider version

* Python: allow callers to override provider version

* NodeJS: add version for invoke

* Python: add version to invoke

* NodeJS: add tests for ReadResource

* Post-merge cleanup

* update doc comments
2019-04-23 11:02:51 -07:00
Sean Gillespie a37b3d89e3
Implement first-class providers for Python (#2335)
* Implement first-class providers for Python

First-class providers are an explicit projection of providers themselves
into Pulumi programs. For the most post, providers are just regular
resources, but the addition of providers to the fray (and the ability of
resources to be constructed by providers in the same program) requires
some changes to the Python resource model.

A summary of the changes:

1. Added ProviderResource, a custom resource that is the base class of
all providers.
2. ResourceOptions now has 'provider' and 'providers' fields.
'provider', when passed to a custom resource, allows users to override
the provider that is used to construct a resource to an instance of a
ProviderResource. 'providers', when passed to a component resource,
allows users to override providers used to construct children of the
component resource.
3. 'protect', 'providers', and 'provider' are all now inherited from
a resource's parent if they aren't specified in the child.

This commit adds the requisite code for the above changes and, in
addition, adds a number of new tests that exercise them and related code
paths.

* Rebase against master
2019-01-04 15:44:27 -08:00
Pat Gavlin b753341686
Exclude the unscriptable-object rule (#2184)
Python 3.7 gets this rule wrong for `Generic[]`.

https://github.com/PyCQA/pylint/issues/2416 tracks this issue in pylint.
2018-11-08 18:26:13 -08:00
Sean Gillespie 8ca2840577
Enable and fix Pylint warnings (#2146)
* Enable pylint warnings

* Fix or ignore pylint warnings
2018-11-01 14:29:06 -07:00
Joe Duffy 98aaf12cdf
Reenable Pylint (#1024)
This change uses virtualenv to insulate us from platform differences
in our building of the Python SDK, and to create an isolated Python 2
environment.  This includes meaning we don't need to worry about the
specific location and behavior of Pylint.  I *think* this will work
no matter whether it's Mac, Ubuntu, ArchLinux, Windows, and so on.

We do install to the --user directory in the install target using
`pip install -e`, however, which enables the machine-wide symlinking
that we need to support various workflows.

This fixes pulumi/pulumi#1007.
2018-03-09 15:11:37 -08:00
joeduffy 74563afdc8 Get the empty Python program working
This change gets enough of the Python SDK up and running that the
empty Python program will work.  Mostly just scaffolding, but the
basic structure is now in place.  The primary remaining work is to
wire up resource creation to the gRPC interfaces.

In summary:

* The basic structure is as follows:

    - Everything goes into sdk/python/.

    - sdk/python/cmd/pulumi-langhost-python is a Go language host
      that simply knows how to spawn Python processes to run out
      entrypoint in response to requests by the engine.

    - sdk/python/cmd/pulumi-langhost-python-exec is a little Python
      shim that is invoked by the language host to run Python programs,
      and is responsible for setting up the minimal goo before we can
      do so (RPC connections and the like).

    - sdk/python/lib/ contains a Python Pip package suitable for PyPi.

    - In there, we have two packages: the root pulumi package that
      contains all of the basic Pulumi programming model abstractions,
      and pulumi.runtime, which contains the implementation of
      resource registration, RPC interfacing with the engine, and so on.

* Add logic in our test framework to conditionalize on the language
  type and react accordingly.  This will allow us to skip Yarn for
  Python projects and eventually run Pip if there's a requirements.txt.

* Created the basic project structure, including all of the usual
  Make targets for installing into the proper places.

* Building also runs Pylint and we are clean.

There are a few other minor things in here:

* Add an "empty" test for both Node.js and Python.  These pass.

* Fix an existing bug in plugin shutdown logic.  At some point, we
  started waiting for stderr/stdout to flush before shutting down
  the plugin; but if certain failures happen "early" during the
  plugin launch process, these channels will never get initialized
  and so waiting for them deadlocks.

* Recently we seem to have added logic to delete test temp
  directories  if a failure happened during initialization of said
  temp directories.  This is unfortunate, because you often need to
  look at the temp directory to see what failed.  We already clean
  them up elsewhere after the full test completes successfully, so
  I don't think we need to be doing this, and I've removed it.

Still many loose ends (config, resources, etc), but it's a start!
2018-02-23 19:33:02 -08:00