-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Prevent deprecated license classifiers from being written to core metadata #4833
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
Changes from 4 commits
6410380
778e679
ee51110
9bdad9f
ea4095d
3af67b8
3b71b5f
29302de
a20512e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| Added deprecation warning for license classifiers, | ||
| according to `PEP 639 | ||
| <https://peps.python.org/pep-0639/#deprecate-license-classifiers>`_. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -406,22 +406,28 @@ def _normalize_requires(self): | |
|
|
||
| def _finalize_license_expression(self) -> None: | ||
| """Normalize license and license_expression.""" | ||
| classifiers = self.metadata.get_classifiers() | ||
| license_classifiers = {cl for cl in classifiers if cl.startswith("License :: ")} | ||
|
|
||
| if license_classifiers: | ||
| SetuptoolsDeprecationWarning.emit( | ||
| "License classifiers are deprecated in favor of the license expression.", | ||
| "Please remove the classifiers:\n\n" + "\n".join(license_classifiers), | ||
| see_url="https://peps.python.org/pep-0639/", | ||
| due_date=(2027, 2, 17), # Introduced 2025-02-17 | ||
| ) | ||
|
|
||
| license_expr = self.metadata.license_expression | ||
| if license_expr: | ||
| normalized = canonicalize_license_expression(license_expr) | ||
| if license_expr != normalized: | ||
| InformationOnly.emit(f"Normalizing '{license_expr}' to '{normalized}'") | ||
| self.metadata.license_expression = normalized | ||
|
|
||
| for cl in self.metadata.get_classifiers(): | ||
| if not cl.startswith("License :: "): | ||
| continue | ||
| SetuptoolsDeprecationWarning.emit( | ||
| "License classifier are deprecated in favor of the license expression.", | ||
| f"Please remove the '{cl}' classifier.", | ||
| see_url="https://peps.python.org/pep-0639/", | ||
| due_date=(2027, 2, 17), # Introduced 2025-02-17 | ||
| ) | ||
| if license_classifiers: | ||
| # Filter classifiers but preserve "static-ness" of metadata | ||
| list_ = _static.List if _static.is_static(classifiers) else list | ||
| filtered = (cl for cl in classifiers if cl not in license_classifiers) | ||
| self.metadata.set_classifiers(list_(filtered)) | ||
|
||
|
|
||
| def _finalize_license_files(self) -> None: | ||
| """Compute names of all license files which should be included.""" | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if we should indeed preserve the "static-ness" of the classifiers, or simply let
Dynamic: classifierappear in the core metadata (we are modifying them after all...)