pulumi/scripts
Justin Van Patten 7309681b5b
Support Python 3.12 (#15190)
Python 3.12 requires `grpcio` 1.59.0 or higher. Unfortunately, there is
a regression in `grpcio` 1.58.0 through the latest version (currently
1.60.0) which causes any error returned from a Python gRPC server to be
written to stderr, including UNIMPLEMENTED errors. This primarily
affects Python dynamic providers, which don't have implementations for
`CheckConfig` and `DiffConfig`, resulting in a traceback error being
emitted to stderr when the engine calls these, which is visible to
users. This `grpcio` regression has been fixed upstream, but the fix has
not been released yet. We've been waiting for a 1.60.1 patch release.

This has not been great for our Python users who are using Python 3.12.
It's particularly bad for new Pulumi users who are using Python 3.12 and
are trying to get started with Pulumi. For these users, when trying to
install the `pulumi` PyPi package (i.e. via `pulumi new python`) the
installation fails with an error because it is pinned to depending on an
older version of `grpcio` which doesn't work on Python 3.12.

This commit works around the problem by providing default
implementations of `CheckConfig` and `DiffConfig` for python dynamic
providers and the component provider API, so that no error is emitted to
stderr when the engine calls these methods. The default implementations
for these are the same behavior that the engine would use if these
methods had returned UNIMPLEMENTED. I believe these are the only two
methods affected by this. Other methods like `Invoke`, `Call`,
`StreamInvoke`, `Construct`, `Attach`, `GetMapping`, and `GetMappings`,
continue to return UNIMPLEMENTED for dynamic providers, which I think is
OK; I don't believe these will be called by the engine under normal
circumstances.

Out of an abundance of caution, the `pulumi` package continues to depend
on the pinned version of `grpcio` when installing on versions of Python
less than 3.12. On Python 3.12 or greater, we now depend on `grpcio`
`~=1.60.0`. 1.60.0 doesn't have the fix for the regression, but the
workaround should allow things to work on Python 3.12 as before.

Once 1.60.1 is released, we can look into updating the `grpcio`
dependency to `~=1.60.1` for all versions of Python, and possibly revert
the workarounds, if we want.

Note: #14474 added a test for dynamic providers to ensure nothing is
written to stderr. The test would fail if the workaround in this PR did
not work as intended:
https://github.com/pulumi/pulumi/pull/14474/files#diff-d92ccd283e08eadab2597825103e45cdaa96fea93324bc4d4d3b1d2b83c51b76

This PR depends on several other smaller PRs:
- https://github.com/pulumi/pulumi/pull/15220
- https://github.com/pulumi/pulumi/pull/15221
- https://github.com/pulumi/pulumi/pull/15222
- https://github.com/pulumi/pulumi/pull/15223
- https://github.com/pulumi/pulumi/pull/15224
- https://github.com/pulumi/pulumi/pull/15225
- https://github.com/pulumi/pulumi/pull/15226

Fixes #14258
2024-01-24 22:24:34 +00:00
..
brew.sh ci: Enable goreleaser prep script to build for local os & arch 2022-09-16 09:50:10 -07:00
get-job-matrix.py Support Python 3.12 (#15190) 2024-01-24 22:24:34 +00:00
get-language-providers.sh Update dotnet (#14577) 2023-11-15 16:09:15 +00:00
get-pulumi-watch.sh ci: Enable goreleaser prep script to build for local os & arch 2022-09-16 09:50:10 -07:00
get-version ci: ensure trunk is always green 2022-09-13 13:38:14 -07:00
go-test.py Revert "Disable `--rerun-fails` in tests" (#15234) 2024-01-24 18:13:21 +00:00
go-update.sh ci: Remove -compat=1.18 flags to validate that tests pass on current and minimum supported Go versions 2022-09-27 10:41:25 -07:00
go-wrapper.sh go-wrapper: fix script if PULUMI_TEST_COVERAGE_PATH is set (#15121) 2024-01-10 19:08:31 +00:00
integration_test_subsets.py Start policy packs in parallel (#14495) 2023-11-20 14:08:32 +00:00
normpath Toward replacing MSBuild with make+bash on Windows (#8617) 2022-01-07 22:27:14 -05:00
prep-for-goreleaser.sh ci: Enable goreleaser prep script to build for local os & arch 2022-09-16 09:50:10 -07:00
publish_npm.sh Temporary changes to unblock v3.88.1 release (#14163) 2023-10-11 22:58:47 +00:00
pulumi-version.sh ci: ensure trunk is always green 2022-09-13 13:38:14 -07:00
retry [ci] improve test logging on retries (#14706) 2023-12-01 23:05:04 +00:00
reversion.js Substitute ${VERSION} on Windows builds too 2018-02-20 14:37:28 -08:00
tidy.sh Support returning plain values from methods (#13592) 2023-11-18 06:02:06 +00:00
versions.sh ci: ensure trunk is always green 2022-09-13 13:38:14 -07:00