-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Retain valid names with underscores in egg_info. #4159
Conversation
I'm pleased to see that tests are passing (ignoring diffcov, which is obviously wrong), so making the fix doesn't violate any tested expectations. Therefore, I'm inclined to make the change in the hopes that it doesn't break any untested assumptions. If it causes undue disruption, we can roll it back and revisit a transitional approach. |
A recent change in pypa/setuptools#4159 may have caused our `dask-cudf` wheels to be published as `dask_cudf-cu12` instead of `dask-cudf-cu12`. Additionally, `cudf_kafka` wheels would have this issue, but 1) we do not publish wheels for `cudf_kafka` and 2) the conda packages are published as `cudf_kafka` (with underscore), so be a larger refactor later on. Authors: - Ray Douglass (https://github.com/raydouglass) Approvers: - Bradley Dice (https://github.com/bdice) - Charles Blackmon-Luca (https://github.com/charlesbluca) - Jake Awe (https://github.com/AyodeAwe)
When creating a PyPi package, Python setuptools prior to v69 would record the name of a package in egg_info by replacing underscores with dashes. So after installing `pulumi-random==4.15.0`, `pip list` would report the package name as `pulumi-random`. However, setuptools >= 69 now retains the underscore in egg_info (pypa/setuptools#4159). So after installing the latest version of `pulumi-random==4.15.1`, `pip list` now reports the package name as `pulumi_random` instead of `pulumi-random`. We use pip to list installed packages so we can determine which ones are Pulumi packages for `GetRequiredPlugins`. It turns out that this change is largely benign for us. We don't really care if the reported name is `pulumi-random` or `pulumi_random`, because we will replace dashes with underscores in the returned name anyway, because the location the package is installed on disk is going to have the underscore, and it's in this location where we look for `pulumi-plugin.json`. https://github.com/pulumi/pulumi/blob/8bcef51fb8a781fcb9b9b630b4cc96fecc859640/sdk/python/cmd/pulumi-language-python/main.go#L393-L398 All that's required is updating the test's expected value, which is now `pulumi_random` as of 4.15.1 of that package. Fixes #15192
I think this might have changed wheel building for projects with a |
In #4167, I believe the consensus is that the name should be retained in metadata but that the filenames should not have changed. I'll be working on it there. |
Updated pre-commit deps
- Updated pyproject.toml to fix the changes made in pypa/setuptools#4159 (#6) - Updated pre-commit deps
#4) * Updated pyproject.toml to fix the changes made in pypa/setuptools#4159 * Added more pre-commit hooks
* Updated pyproject.toml to fix the changes made in pypa/setuptools#4159 * Added more pre-commit hooks
#3) * Drop Python 3.7 support * Added more pre-commit hooks * Updated pyproject.toml to fix the changes made in pypa/setuptools#4159
Pulumi automatically determines required plugins for a program. For Python programs, it essentially does this by running `python -m pip list --format json`, and any packages prefixed with `pulumi-` or `pulumi_` are assumed to have associated plugins, unless the package includes a `pulumi-plugin.json` file that has indicated there is no plugin via `{ "resource": false }`. When the `GetRequiredPlugins` support was originally added to the Python language host, it [hardcoded](https://github.com/pulumi/pulumi/blob/e6d20d26f7f64a624238f86204d862642ff27e16/sdk/python/cmd/pulumi-language-python/main.go#L428-L430) that `pulumi-policy` did not have an associated plugin. The hardcode mainly for older versions of `pulumi-policy` that did not contain a `pulumi-plugin.json` file. `pulumi-plugin.json` was actually originally named `pulumiplugin.json` (no dash). This file wasn't used anywhere, aside from in `pulumi-policy`, but the hardcod prevented it from ever being loaded in that case. It turned out that there was a bug parsing `pulumiplugin.json` that caused the CLI to error when that file existed in other packages. Since we were planning to expand the use of the file to other languages, and make it generated by default by SDKgen, we changed the name from `pulumiplugin.json` to `pulumi-plugin.json` to avoid breaking older CLIs with the bug (see pulumi/pulumi#8593). After making that change, we never followed up to rename the `pulumiplugin.json` file in `pulumi-policy` to `pulumi-plugin.json`, largely because it didn't matter since we had the hardcode. However, this hardcode no longer works with the latest version of `pulumi-policy` (v1.11.0). This version was built with a newer version of `setuptools` which has a behavior change where the package name in the metadata will now allow underscores, instead of having underscores replaced with dashes (pypa/setuptools#4159). This means that the package name reported from `pip list` is now `pulumi_policy` instead of `pulumi-policy`, which doesn't match the hardcoded list. And since there is no `pulumi-plugin.json` file in the package (it's still the old `pulumiplugin.json` name), the Pulumi Python language host thinks this package needs a plugin and tries to retrieve one that doesn't exist. This change addresses the issue by renaming `pulumiplugin.json` to `pulumi-plugin.json` in the package.
Pulumi automatically determines required plugins for a program. For Python programs, it essentially does this by running `python -m pip list --format json`, and any packages prefixed with `pulumi-` or `pulumi_` are assumed to have associated plugins, unless the package includes a `pulumi-plugin.json` file that has indicated there is no plugin via `{ "resource": false }`. When the `GetRequiredPlugins` support was originally added to the Python language host, it [hardcoded](https://github.com/pulumi/pulumi/blob/e6d20d26f7f64a624238f86204d862642ff27e16/sdk/python/cmd/pulumi-language-python/main.go#L428-L430) that `pulumi-policy` did not have an associated plugin. The hardcode mainly for older versions of `pulumi-policy` that did not contain a `pulumi-plugin.json` file. `pulumi-plugin.json` was actually originally named `pulumiplugin.json` (no dash). This file wasn't used anywhere, aside from in `pulumi-policy`, but the hardcod prevented it from ever being loaded in that case. It turned out that there was a bug parsing `pulumiplugin.json` that caused the CLI to error when that file existed in other packages. Since we were planning to expand the use of the file to other languages, and make it generated by default by SDKgen, we changed the name from `pulumiplugin.json` to `pulumi-plugin.json` to avoid breaking older CLIs with the bug (see pulumi/pulumi#8593). After making that change, we never followed up to rename the `pulumiplugin.json` file in `pulumi-policy` to `pulumi-plugin.json`, largely because it didn't matter since we had the hardcode. However, this hardcode no longer works with the latest version of `pulumi-policy` (v1.11.0). This version was built with a newer version of `setuptools` which has a behavior change where the package name in the metadata will now allow underscores, instead of having underscores replaced with dashes (pypa/setuptools#4159). This means that the package name reported from `pip list` is now `pulumi_policy` instead of `pulumi-policy`, which doesn't match the hardcoded list. And since there is no `pulumi-plugin.json` file in the package (it's still the old `pulumiplugin.json` name), the Pulumi Python language host thinks this package needs a plugin and tries to retrieve one that doesn't exist. This change addresses the issue by renaming `pulumiplugin.json` to `pulumi-plugin.json` in the package.
In the Python language host, we hardcode that `pulumi-policy` doesn't have an associated resource (provider) plugin, because we know it doesn't have one. However, this hardcode no longer works with the latest version of `pulumi-policy` (v1.11.0) because it was built with a newer version of `setuptools` which has a behavior change where the package name in the metadata will now allow underscores, instead of having underscores replaced with hyphens (pypa/setuptools#4159). This means that the package name reported from `pip list` is now `pulumi_policy` instead of `pulumi-policy`, which doesn't match the hardcoded list. Note that this change is really only to help with `pulumi-policy` v1.11.0. Future versions of `pulumi-policy` will have a `pulumi-plugin.json` file in the package, which properly indicates that it doesn't have an associated plugin.
In the Python language host, we hardcode that `pulumi-policy` doesn't have an associated resource (provider) plugin, because we know it doesn't have one. However, this hardcode no longer works with the latest version of `pulumi-policy` (v1.11.0) because it was built with a newer version of `setuptools` which has a behavior change where the package name in the metadata will now allow underscores, instead of having underscores replaced with hyphens (pypa/setuptools#4159). This means that the package name reported from `pip list` is now `pulumi_policy` instead of `pulumi-policy`, which doesn't match the hardcoded list. Note that this change is really only to help with `pulumi-policy` v1.11.0. Future versions of `pulumi-policy` will have a `pulumi-plugin.json` file in the package, which properly indicates that it doesn't have an associated plugin. Related: pulumi/pulumi-policy#358 Part of addressing: pulumi/pulumi-policy#356
In the Python language host, we hardcode that `pulumi-policy` doesn't have an associated resource (provider) plugin, because we know it doesn't have one. However, this hardcode no longer works with the latest version of `pulumi-policy` (v1.11.0) because it was built with a newer version of `setuptools` which has a behavior change where the package name in the metadata will now allow underscores, instead of having underscores replaced with hyphens (pypa/setuptools#4159). This means that the package name reported from `pip list` is now `pulumi_policy` instead of `pulumi-policy`, which doesn't match the hardcoded list. Note that this change is really only to help with `pulumi-policy` v1.11.0. Future versions of `pulumi-policy` will have a `pulumi-plugin.json` file in the package, which properly indicates that it doesn't have an associated plugin. Related: pulumi/pulumi-policy#358 Part of addressing: pulumi/pulumi-policy#356
In the Python language host, we hardcode that `pulumi-policy` doesn't have an associated resource (provider) plugin, because we know it doesn't have one. However, this hardcode no longer works with the latest version of `pulumi-policy` (v1.11.0) because it was built with a newer version of `setuptools` which has a behavior change where the package name in the metadata will now allow underscores, instead of having underscores replaced with hyphens (pypa/setuptools#4159). This means that the package name reported from `pip list` is now `pulumi_policy` instead of `pulumi-policy`, which doesn't match the hardcoded list. Note that this change is really only to help with `pulumi-policy` v1.11.0. Future versions of `pulumi-policy` will have a `pulumi-plugin.json` file in the package, which properly indicates that it doesn't have an associated plugin. Related: pulumi/pulumi-policy#358 Part of addressing: pulumi/pulumi-policy#356
Pulumi automatically determines required plugins for a program. For Python programs, it essentially does this by running `python -m pip list --format json`, and any packages prefixed with `pulumi-` or `pulumi_` are assumed to have associated plugins, unless the package includes a `pulumi-plugin.json` file that has indicated there is no plugin via `{ "resource": false }`. When the `GetRequiredPlugins` support was originally added to the Python language host, it [hardcoded](https://github.com/pulumi/pulumi/blob/e6d20d26f7f64a624238f86204d862642ff27e16/sdk/python/cmd/pulumi-language-python/main.go#L428-L430) that `pulumi-policy` did not have an associated plugin. The hardcode mainly for older versions of `pulumi-policy` that did not contain a `pulumi-plugin.json` file. `pulumi-plugin.json` was actually originally named `pulumiplugin.json` (no dash). This file wasn't used anywhere, aside from in `pulumi-policy`, but the hardcod prevented it from ever being loaded in that case. It turned out that there was a bug parsing `pulumiplugin.json` that caused the CLI to error when that file existed in other packages. Since we were planning to expand the use of the file to other languages, and make it generated by default by SDKgen, we changed the name from `pulumiplugin.json` to `pulumi-plugin.json` to avoid breaking older CLIs with the bug (see pulumi/pulumi#8593). After making that change, we never followed up to rename the `pulumiplugin.json` file in `pulumi-policy` to `pulumi-plugin.json`, largely because it didn't matter since we had the hardcode. However, this hardcode no longer works with the latest version of `pulumi-policy` (v1.11.0). This version was built with a newer version of `setuptools` which has a behavior change where the package name in the metadata will now allow underscores, instead of having underscores replaced with dashes (pypa/setuptools#4159). This means that the package name reported from `pip list` is now `pulumi_policy` instead of `pulumi-policy`, which doesn't match the hardcoded list. And since there is no `pulumi-plugin.json` file in the package (it's still the old `pulumiplugin.json` name), the Pulumi Python language host thinks this package needs a plugin and tries to retrieve one that doesn't exist. This change addresses the issue by renaming `pulumiplugin.json` to `pulumi-plugin.json` in the package.
Pulumi automatically determines required plugins for a program. For Python programs, it essentially does this by running `python -m pip list --format json`, and any packages prefixed with `pulumi-` or `pulumi_` are assumed to have associated plugins, unless the package includes a `pulumi-plugin.json` file that has indicated there is no plugin via `{ "resource": false }`. When the `GetRequiredPlugins` support was originally added to the Python language host, it [hardcoded](https://github.com/pulumi/pulumi/blob/e6d20d26f7f64a624238f86204d862642ff27e16/sdk/python/cmd/pulumi-language-python/main.go#L428-L430) that `pulumi-policy` did not have an associated plugin. The hardcode mainly for older versions of `pulumi-policy` that did not contain a `pulumi-plugin.json` file. `pulumi-plugin.json` was actually originally named `pulumiplugin.json` (no dash). This file wasn't used anywhere, aside from in `pulumi-policy`, but the hardcod prevented it from ever being loaded in that case. It turned out that there was a bug parsing `pulumiplugin.json` that caused the CLI to error when that file existed in other packages. Since we were planning to expand the use of the file to other languages, and make it generated by default by SDKgen, we changed the name from `pulumiplugin.json` to `pulumi-plugin.json` to avoid breaking older CLIs with the bug (see pulumi/pulumi#8593). After making that change, we never followed up to rename the `pulumiplugin.json` file in `pulumi-policy` to `pulumi-plugin.json`, largely because it didn't matter since we had the hardcode. However, this hardcode no longer works with the latest version of `pulumi-policy` (v1.11.0). This version was built with a newer version of `setuptools` which has a behavior change where the package name in the metadata will now allow underscores, instead of having underscores replaced with dashes (pypa/setuptools#4159). This means that the package name reported from `pip list` is now `pulumi_policy` instead of `pulumi-policy`, which doesn't match the hardcoded list. And since there is no `pulumi-plugin.json` file in the package (it's still the old `pulumiplugin.json` name), the Pulumi Python language host thinks this package needs a plugin and tries to retrieve one that doesn't exist. This change addresses the issue by renaming `pulumiplugin.json` to `pulumi-plugin.json` in the package.
Closes #2522.
Summary of changes
Closes
Pull Request Checklist
newsfragments/
.(See documentation for details)