You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* enhance verify_whl tox environment to check that the classifier for the package matches the package version being released
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: McCoy Patiño <39780829+mccoyp@users.noreply.github.com>
Verify that the package classifiers match the expected classifiers.
900
+
:param str package_name: The name of the package being verified. Used for detail in the error response.
901
+
:param str package_version: The version of the package being verified.
902
+
:param List[str] package_classifiers: The classifiers of the package being verified.
903
+
:returns: A tuple, (x, y), where x is whether the package version matches its classifiers, and y is an error message or None.
904
+
"""
905
+
906
+
dev_status=parse(package_version)
907
+
908
+
# gather all development‐status classifiers
909
+
dev_classifiers= [cforcinpackage_classifiersifc.startswith("Development Status ::")]
910
+
911
+
# beta releases: enforce that only development status 4 is present
912
+
ifdev_status.is_prerelease:
913
+
forcindev_classifiers:
914
+
if"4 - Beta"notinc:
915
+
returnFalse, f"{package_name} has version {package_version} and is a beta release, but has development status '{c}'. Expected 'Development Status :: 4 - Beta' ONLY."
916
+
returnTrue, None
917
+
918
+
# ga releases: all development statuses must be >= 5
919
+
forcindev_classifiers:
920
+
try:
921
+
# "Development Status :: 5 - Production/Stable"
922
+
# or Development Status :: 6 - Mature
923
+
# or Development Status :: 7 - Inactive
924
+
num=int(c.split("::")[1].split("-")[0].strip())
925
+
except (IndexError, ValueError):
926
+
returnFalse, f"{package_name} has version {package_version} and is a GA release, but failed to pull a status number from status '{c}'. Expecting format identical to 'Development Status :: 5 - Production/Stable'."
927
+
ifnum<5:
928
+
returnFalse, f"{package_name} has version {package_version} and is a GA release, but had development status '{c}'. Expecting a development classifier that is equal or greater than 'Development Status :: 5 - Production/Stable'."
0 commit comments