@@ -153,85 +153,114 @@ informal relationship between ``Home-page``, ``Download-URL``, and their
153
153
154
154
This formalization has two parts:
155
155
156
- 1. A set of rules for canonicalizing ``Project-URL `` labels;
157
- 2. A set of "well-known" canonical label values that indices may specialize
156
+ 1. A set of rules for normalizing ``Project-URL `` labels;
157
+ 2. A set of "well-known" normalized label values that indices may specialize
158
158
URL presentation for.
159
159
160
- Label canonicalization
161
- ----------------------
160
+ Label normalization
161
+ -------------------
162
162
163
163
The core metadata specification stipulates that ``Project-URL `` labels are
164
164
free text, limited to 32 characters.
165
165
166
- This PEP proposes adding the concept of a "canonicalized " label to the core
167
- metadata specification. Label canonicalization is defined via the following
166
+ This PEP proposes adding the concept of a "normalized " label to the core
167
+ metadata specification. Label normalization is defined via the following
168
168
Python function:
169
169
170
170
.. code-block :: python
171
171
172
172
import string
173
- def canonicalize_label (label : str ) -> str :
173
+ def normalize_label (label : str ) -> str :
174
174
chars_to_remove = string.punctuation + string.whitespace
175
175
removal_map = str .maketrans(" " , " " , chars_to_remove)
176
176
return label.translate(removal_map).lower()
177
177
178
- In plain language: a label is *canonicalized * by deleting all ASCII punctuation and
178
+ In plain language: a label is *normalized * by deleting all ASCII punctuation and
179
179
whitespace, and then converting the result to lowercase.
180
180
181
181
The following table shows examples of labels before (raw) and after
182
- canonicalization :
182
+ normalization :
183
183
184
184
.. csv-table ::
185
- :header: "Raw", "Canonicalized "
185
+ :header: "Raw", "Normalized "
186
186
187
187
"``Homepage ``", "``homepage ``"
188
188
"``Home-page ``", "``homepage ``"
189
189
"``Home page ``", "``homepage ``"
190
190
"``Change_Log ``", "``changelog ``"
191
191
"``What's New? ``", "``whatsnew ``"
192
192
193
- Metadata producers **SHOULD ** emit the canonicalized form of a user
194
- specified label, but **MAY ** choose to emit the un-canonicalized form so
193
+ Metadata producers **SHOULD ** emit the normalized form of a user
194
+ specified label, but **MAY ** choose to emit the un-normalized form so
195
195
long as it adheres to the existing 32 character constraint.
196
196
197
- Package indices **SHOULD NOT ** use the canonicalized labels belonging to the set
197
+ Package indices **SHOULD NOT ** use the normalized labels belonging to the set
198
198
of well-known labels directly as UI elements (instead replacing them with
199
199
appropriately capitalized text labels). Labels not belonging to the well-known
200
200
set **MAY ** be used directly as UI elements.
201
201
202
202
Well-known labels
203
203
-----------------
204
204
205
- In addition to the canonicalization rules above, this PEP proposes a
205
+ In addition to the normalization rules above, this PEP proposes a
206
206
fixed (but extensible) set of "well-known" ``Project-URL `` labels,
207
- as well as equivalent aliases.
208
-
209
- The following table lists these labels, in canonical form:
210
-
211
- .. csv-table ::
212
- :header: "Label", "Description", "Aliases"
213
- :widths: 20, 50, 30
214
-
215
- "``homepage ``", "The project's home page", "*(none) *"
216
- "``download ``", "A download URL for the current distribution, equivalent to ``Download-URL ``", "*(none) *"
217
- "``changelog ``", "The project's changelog", "``changes ``, ``releasenotes ``, ``whatsnew ``, ``history ``"
218
- "``documentation ``", "The project's online documentation", "``docs ``"
219
- "``issues ``", "The project's bug tracker", "``bugs ``, ``issue ``, ``bug ``, ``tracker ``, ``report ``"
220
- "``sponsor ``", "Sponsoring information", "``funding ``, ``donate ``, ``donation ``"
207
+ as well as aliases and human-readable equivalents.
208
+
209
+ The following table lists these labels, in normalized form:
210
+
211
+ .. list-table ::
212
+ :header-rows: 1
213
+
214
+ * - Label (Human-readable equivalent)
215
+ - Description
216
+ - Aliases
217
+ * - ``homepage `` (Homepage)
218
+ - The project's home page
219
+ - *(none) *
220
+ * - ``source `` (Source Code)
221
+ - The project's hosted source code or repository
222
+ - ``repository ``, ``sourcecode ``, ``github ``
223
+ * - ``download `` (Download)
224
+ - A download URL for the current distribution, equivalent to ``Download-URL ``
225
+ - *(none) *
226
+ * - ``changelog `` (Changelog)
227
+ - The project's comprehensive changelog
228
+ - ``changes ``, ``whatsnew ``, ``history ``
229
+ * - ``releasenotes `` (Release Notes)
230
+ - The project's curated release notes
231
+ - *(none) *
232
+ * - ``documentation `` (Documentation)
233
+ - The project's online documentation
234
+ - ``docs ``
235
+ * - ``issues `` (Issue Tracker)
236
+ - The project's bug tracker
237
+ - ``bugs ``, ``issue ``, ``tracker ``, ``issuetracker ``, ``bugtracker ``
238
+ * - ``funding `` (Funding)
239
+ - Funding Information
240
+ - ``sponsor ``, ``donate ``, ``donation ``
241
+
242
+ Indices **MAY ** choose to use the human-readable equivalents suggested above
243
+ in their UI elements, if appropriate. Alternatively, indices **MAY ** choose
244
+ their own appropriate human-readable equivalents for UI elements.
221
245
222
246
Packagers and metadata producers **MAY ** choose to use these well-known
223
- labels to communicate specific URL intents to package indices and downstreams.
247
+ labels or their aliases to communicate specific URL intents to package indices
248
+ and downstreams.
224
249
225
- Packagers and metadata producers **SHOULD ** produce the canonicalized version
226
- of the well-known labels in package metadata.
250
+ Packagers and metadata producers **SHOULD ** produce the normalized version
251
+ of the well-known labels or their aliases in package metadata. Packaging tools
252
+ **MUST NOT ** transform between equivalent aliases, i.e.. **SHOULD **
253
+ normalize ``GitHub `` to ``github `` but **MUST NOT ** transform
254
+ ``github `` to ``source ``.
227
255
228
256
Similarly, indices **MAY ** choose to specialize their rendering or presentation
229
257
of URLs with these labels, e.g. by presenting an appropriate icon or tooltip
230
258
for each label.
231
259
232
- Indices **MAY ** also specialize the rendering or presentation of additional labels or URLs,
233
- including (but not limited to), labels that start with a well-known label, and URLs that refer
234
- to a known service provider domain (e.g. for documentation hosting or issue tracking).
260
+ Indices **MAY ** also specialize the rendering or presentation of additional
261
+ labels or URLs, including (but not limited to), labels that start with a
262
+ well-known label, and URLs that refer to a known service provider domain (e.g.
263
+ for documentation hosting or issue tracking).
235
264
236
265
This PEP recognizes that the list of well-known labels is unlikely to remain
237
266
static, and that subsequent additions to it should not require the overhead
@@ -275,11 +304,11 @@ the core metadata standards:
275
304
next major core metadata version. If removed, package indices and consumers
276
305
**MUST ** reject metadata containing these fields when said metadata is of
277
306
the new major version.
278
- * Enforcement of label canonicalization . If enforced, package producers
279
- **MUST ** emit only canonicalized ``Project-URL `` labels when generating
307
+ * Enforcement of label normalization . If enforced, package producers
308
+ **MUST ** emit only normalized ``Project-URL `` labels when generating
280
309
distribution metadata, and package indices and consumers **MUST ** reject
281
- distributions containing non-canonicalized labels. Note: requiring
282
- canonicalization merely restricts labels to lowercase text, and excludes
310
+ distributions containing non-normalized labels. Note: requiring
311
+ normalization merely restricts labels to lowercase text, and excludes
283
312
whitespace and punctuation. It does NOT restrict project URLs solely to
284
313
the use of "well-known" labels.
285
314
@@ -292,7 +321,7 @@ Security Implications
292
321
293
322
This PEP does not identify any positive or negative security implications
294
323
associated with deprecating ``Home-page `` and ``Download-URL `` or with
295
- label canonicalization .
324
+ label normalization .
296
325
297
326
How To Teach This
298
327
=================
0 commit comments