mirror of https://github.com/pulumi/pulumi.git
e9ac6f3c9c
In preparation for supporting Python 3.12... This test is generating a local example library using SDKgen and then running a program that uses it. When running on Python 3.12, without this fix, we get an error from the generated example library's `_utilities.py` file: ``` ModuleNotFoundError: No module named 'pkg_resources' ``` This is because `_utilities.py` depends on `pkg_resources` from `setuptools`, but our generated provider SDKs do not specify they have a dependency on `setuptools`. The problem on Python 3.12 is because virtual environments created with `python -m venv` no longer include `setuptools` in the virtual environment (https://github.com/python/cpython/issues/95299). This generally isn't a problem with projects created using `pulumi new` because we will explicitly install `setuptools` in the created virtual environment. But it is a problem in this case, because `ProgramTest` is creating the virtual environment, and it doesn't install setuptools in it. To workaround, for now, include `setuptools` in the test program's `requirements.txt`. When we fix Python SDKgen to no longer use `pkg_resources`, we can remove `setuptools` from the test program's `requirements.txt` (https://github.com/pulumi/pulumi/issues/12414). Also remove the `pulumi` dependency in `requirements.txt` as it the currently published package can't be installed on Python 3.12 due to the dependency on `grpcio` that doesn't work on Python 3.12. The test installs the locally built Python SDK, so it's not needed in `requirements.txt` anyway. Aside: This test really should be a runtime SDKgen test, which wouldn't have this problem because it uses the CLI's code for creating the virtual environment, which installs `setuptools`. Also note: While looking at this test, I cleaned up a part of the test that was replacing `${VERSION}` in the generated library's `setup.py`, which is no longer necessary because that's not how the version is replaced anymore. A default placeholder version is included that will work as-is. |
||
---|---|---|
.. | ||
.gitignore | ||
Pulumi.yaml | ||
__main__.py | ||
requirements.txt | ||
schema.json |