From 316d1c2a341b0f026693fa76f265b3213f8766fe Mon Sep 17 00:00:00 2001 From: Huon Wilson Date: Wed, 24 May 2023 07:35:40 +1000 Subject: [PATCH] Switch deprecation to the layout option --- .../backend/python/subsystems/lambdex.py | 40 +++++++------------ .../pants/backend/python/util_rules/faas.py | 1 - 2 files changed, 14 insertions(+), 27 deletions(-) diff --git a/src/python/pants/backend/python/subsystems/lambdex.py b/src/python/pants/backend/python/subsystems/lambdex.py index e0d70b8a5b34..3f079df22bbf 100644 --- a/src/python/pants/backend/python/subsystems/lambdex.py +++ b/src/python/pants/backend/python/subsystems/lambdex.py @@ -39,34 +39,22 @@ class Lambdex(PythonToolBase): Lambdex-based layout to the plain zip layout, as recommended by cloud vendors. """ ), + removal_version="2.19.0.dev0", + removal_hint=softwrap( + """ + Remove the whole [lambdex] section, as Lambdex is deprecated and its functionality be + removed. If you have `layout = "zip"`, no further action is required, as you are already using + the recommended layout. + + If you have `layout = "lambdex"`, removing the section will switch any + `python_awslambda` and `python_google_cloud_function` targets to using the `zip` layout, + as recommended by cloud vendors. (If you are using `python_awslambda`, you will need to + also update the handlers configured in the cloud from `lambdex_handler.handler` to + `lambda_function.handler`.) + """ + ), ) - def warn_for_layout(self, target_alias: str) -> None: - if self.options.is_default("layout"): - lambda_message = ( - " (you will need to also update the handlers configured in the cloud from `lambdex_handler.handler` to `lambda_function.handler`)" - if target_alias == "python_awslambda" - else "" - ) - - warn_or_error( - "2.19.0.dev0", - f"using the Lambdex layout for `{target_alias}` targets", - softwrap( - f""" - Set the `[lambdex].layout` option explicitly to `zip` (recommended) or `lambdex` - (compatibility), in `pants.toml`. Recommended: set to `zip` to opt-in to the new - layout recommended by cloud vendors{lambda_message}: - - [lambdex] - layout = "zip" - - You can also explicitly set `layout = "lambdex"` to silence this warning and - continue using the Lambdex-based layout in this release of Pants. This layout - will disappear in future. - """ - ), - ) def rules(): diff --git a/src/python/pants/backend/python/util_rules/faas.py b/src/python/pants/backend/python/util_rules/faas.py index 21ff0ecd99bb..c18f3df397c2 100644 --- a/src/python/pants/backend/python/util_rules/faas.py +++ b/src/python/pants/backend/python/util_rules/faas.py @@ -323,7 +323,6 @@ async def build_lambdex( f" {bin_name()} package. (See https://realpython.com/python-wheels/ for more about" " wheels.)\n\n(If the build does not raise an exception, it's safe to use macOS.)" ) - lambdex.warn_for_layout(request.target_name) output_filename = request.output_path.value_or_default( # FaaS typically use the .zip suffix, so we use that instead of .pex.