Repository: conda/conda-build

Issue:
Deprecate `noarch_python_build_age` MetaData/Config setting
### Checklist

- [X] I added a descriptive title
- [X] I searched open requests and couldn't find a duplicate

### What is the idea?

Let's deprecate the unused `noarch_python_build_age` configuration value. It is not formally defined in either the old nor new recipe formats, isn't mentioned in our docs, and has no hits on [GitHub](https://github.com/search?q=noarch_python_build_age+NOT+is%3Afork&type=code) or on [Google](https://www.google.com/search?q=%22noarch_python_build_age%22).

It was introduced in https://github.com/conda/conda-build/commit/26dfe8e795abc38ec68d33f760f17a344bb346b7 (in `conda-build 3.21.0`).

### Why is this needed?

Remove tech-debt related to this block of code:

https://github.com/conda/conda-build/blob/683ea916432254125c58efc365a191f1f1fd816a/conda_build/render.py#L805-L832

### What should happen?

_No response_

### Additional Context

_No response_


Discussion:

Resolving patch:
diff --git a/conda_build/config.py b/conda_build/config.py
--- a/conda_build/config.py
+++ b/conda_build/config.py
@@ -54,7 +54,7 @@ def set_invocation_time():
 _src_cache_root_default = None
 error_overlinking_default = "false"
 error_overdepending_default = "false"
-noarch_python_build_age_default = 0
+deprecated.constant("24.5", "24.7", "noarch_python_build_age_default", 0)
 enable_static_default = "false"
 no_rewrite_stdout_env_default = "false"
 ignore_verify_codes_default = []
@@ -157,12 +157,6 @@ def _get_default_settings():
             ).lower()
             == "true",
         ),
-        Setting(
-            "noarch_python_build_age",
-            context.conda_build.get(
-                "noarch_python_build_age", noarch_python_build_age_default
-            ),
-        ),
         Setting(
             "enable_static",
             context.conda_build.get("enable_static", enable_static_default).lower()
diff --git a/conda_build/render.py b/conda_build/render.py
--- a/conda_build/render.py
+++ b/conda_build/render.py
@@ -795,11 +795,11 @@ def reparse(metadata):
 
 
 def distribute_variants(
-    metadata,
+    metadata: MetaData,
     variants,
-    permit_unsatisfiable_variants=False,
-    allow_no_other_outputs=False,
-    bypass_env_check=False,
+    permit_unsatisfiable_variants: bool = False,
+    allow_no_other_outputs: bool = False,
+    bypass_env_check: bool = False,
 ) -> list[MetaDataTuple]:
     rendered_metadata: dict[
         tuple[str, str, tuple[tuple[str, str], ...]], MetaDataTuple
@@ -810,27 +810,13 @@ def distribute_variants(
     # which python version we prefer. `python_age` can use used to tweak which
     # python gets used here.
     if metadata.noarch or metadata.noarch_python:
-        age = int(
-            metadata.get_value(
-                "build/noarch_python_build_age", metadata.config.noarch_python_build_age
-            )
-        )
-        versions = []
-        for variant in variants:
-            if "python" in variant:
-                vo = variant["python"]
-                if vo not in versions:
-                    versions.append(vo)
-        version_indices = sorted(
-            range(len(versions)), key=lambda k: VersionOrder(versions[k].split(" ")[0])
-        )
-        if age < 0:
-            age = 0
-        elif age > len(versions) - 1:
-            age = len(versions) - 1
-        build_ver = versions[version_indices[len(versions) - 1 - age]]
+        # filter variants by the newest Python version
+        version = sorted(
+            {version for variant in variants if (version := variant.get("python"))},
+            key=lambda key: VersionOrder(key.split(" ")[0]),
+        )[-1]
         variants = filter_by_key_value(
-            variants, "python", build_ver, "noarch_python_reduction"
+            variants, "python", version, "noarch_python_reduction"
         )
 
     # store these for reference later


Test patch:
diff --git a/tests/conftest.py b/tests/conftest.py
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -27,7 +27,6 @@
     filename_hashing_default,
     ignore_verify_codes_default,
     no_rewrite_stdout_env_default,
-    noarch_python_build_age_default,
 )
 from conda_build.metadata import MetaData
 from conda_build.utils import check_call_env, copy_into, prepend_bin_path
@@ -100,7 +99,6 @@ def boolify(v):
         _src_cache_root=_src_cache_root_default,
         error_overlinking=boolify(error_overlinking_default),
         error_overdepending=boolify(error_overdepending_default),
-        noarch_python_build_age=noarch_python_build_age_default,
         enable_static=boolify(enable_static_default),
         no_rewrite_stdout_env=boolify(no_rewrite_stdout_env_default),
         ignore_verify_codes=ignore_verify_codes_default,
@@ -112,7 +110,6 @@ def boolify(v):
     assert result.no_rewrite_stdout_env is False
     assert result._src_cache_root is None
     assert result.src_cache_root == testing_workdir
-    assert result.noarch_python_build_age == 0
     return result