@@ -149,66 +149,23 @@ Alternative possibilities related to the ``license`` key in the
149
149
``pyproject.toml `` project source metadata.
150
150
151
151
152
- Add `` expression `` and `` files `` subkeys to table
153
- '''''''''''''''''''''''''''''''''''''''''''''''''
152
+ Add new subkeys to table
153
+ ''''''''''''''''''''''''
154
154
155
- A previous draft of PEP 639 added ``expression `` and ``files `` subkeys
156
- to the existing ``license `` table in the project source metadata, to parallel
157
- the existing ``file `` and ``text `` subkeys. While this seemed the
158
- most obvious approach at first glance, it had serious drawbacks
159
- relative to that ultimately taken here.
160
-
161
- This means two very different types of metadata are being
162
- specified under the same top-level key that require very different handling,
163
- and unlike the previous arrangement, the subkeys were not mutually
164
- exclusive and could both be specified at once, with some subkeys potentially
165
- being dynamic and others static, and mapping to different Core Metadata fields.
166
-
167
- There are further downsides to this as well. Both users and tools would need to
168
- keep track of which fields are mutually exclusive with which of the others,
169
- greatly increasing complexity, and the probability
170
- of errors. Having so many different fields under the
171
- same key leads to a much more complex mapping between
172
- ``[project] `` keys and Core Metadata fields, not in keeping with :pep: `621 `.
173
- This causes the ``[project] `` table naming and structure to diverge further
174
- from both the Core Metadata and native formats of the various popular packaging
175
- tools that use it. Finally, this results in the spec being significantly more
176
- complex to understand and implement than the alternatives.
177
-
178
- The approach PEP 639 now takes, using the reserved top-level string value
179
- of the ``license `` key, adding a new ``license-files `` key
180
- and deprecating the ``license `` table subkeys (``text `` and ``file ``),
181
- avoids most of the issues identified above,
182
- and results in a much clearer and cleaner design overall.
183
- It allows ``license `` and ``license-files `` to be tagged
184
- ``dynamic `` independently, separates two independent types of metadata
185
- (syntactically and semantically), restores a closer to 1:1 mapping of
186
- ``[project] `` table keys to Core Metadata fields,
187
- and reduces nesting by a level for both.
188
- Other than adding one extra key to the file, there was no significant
189
- apparent downside to this latter approach, so it was adopted for PEP 639.
190
-
191
-
192
- Add an ``expression `` subkey instead of a string value
193
- ''''''''''''''''''''''''''''''''''''''''''''''''''''''
155
+ There were proposals to add various subkeys to the table.
156
+ Combining different types of metadata which require different handling,
157
+ adding new guidance regarding the subkeys mutual exclusivity and
158
+ the possibility to define some of them as dynamic would make the
159
+ transition harder and create more confusion rather than clarity for the users.
160
+ This approach has been rejected in favour of more flat ``pyproject.toml ``
161
+ design, clear mapping between ``pyproject.toml `` keys and Core Metadata fields,
162
+ and increased readability of the separate keys.
163
+
164
+ Rejected proposals:
194
165
195
- Adding just an ``expression `` subkey to the ``license `` table,
196
- instead of using the top-level string value,
197
- would be more explicit for readers and writers,
198
- in line with PEP 639's goals.
199
- However, it still has the downsides listed above
200
- that are not specific to the inclusion of the ``files `` key.
201
-
202
- Relative to a flat string value,
203
- it adds complexity and an extra level of nesting,
204
- and requires users and tools to remember and handle
205
- the mutual exclusivity of the subkeys
206
- and remember which are deprecated,
207
- instead of cleanly deprecating the table subkeys as a whole.
208
- Furthermore, it is less clearly the "default" choice for modern use,
209
- given users tend to gravitate toward the most obvious option.
210
- Finally, it seems reasonable to follow the suggested guidance in :pep: `621 `,
211
- given the top-level string value was specifically reserved for this purpose.
166
+ - add ``expression `` and ``files `` subkeys to table
167
+ - add an ``expression `` subkey instead of a string value
168
+ - add a ``type `` key to treat ``text `` as expression
212
169
213
170
214
171
Define a new top-level ``license-expression `` key
@@ -267,39 +224,6 @@ Therefore, a top-level string value for ``license`` was adopted for PEP 639,
267
224
as an earlier working draft had temporarily specified.
268
225
269
226
270
- Add a ``type `` key to treat ``text `` as expression
271
- ''''''''''''''''''''''''''''''''''''''''''''''''''
272
-
273
- Instead of using the reserved top-level string value
274
- of the ``license `` key in the ``[project] `` table,
275
- one could add a ``type `` subkey to the ``license `` table
276
- to control whether ``text `` (or a string value)
277
- is interpreted as free-text or a license expression. This could make
278
- backward compatibility a bit easier, as older tools could ignore
279
- it and always treat ``text `` as ``license ``, while newer tools would
280
- know to treat it as a license expression, if ``type `` was set appropriately.
281
- Indeed, :pep: `621 ` seems to suggest something of this sort as a possible
282
- way that SPDX license expressions could be implemented.
283
-
284
- However, it has got all the same downsides as in the previous item,
285
- including greater complexity, a more complex mapping between the project
286
- source metadata and Core Metadata and inconsistency between the presentation
287
- in tool config, project source metadata and Core Metadata,
288
- a harder deprecation, further bikeshedding over what to name it,
289
- and inability to mark one but not the other as dynamic, among others.
290
-
291
- In addition, while theoretically a little easier in the short
292
- term, in the long term it would mean users would always have to remember
293
- to specify the correct ``type `` to ensure their license expression is
294
- interpreted correctly, which adds work and potential for error; we could
295
- never safely change the default while being confident that users
296
- understand that what they are entering is unambiguously a license expression,
297
- with all the false positive and false negative issues as above.
298
-
299
- Therefore, for these reasons, we reject this here in favor of
300
- the reserved string value of the ``license `` key.
301
-
302
-
303
227
Source metadata ``license-files `` key
304
228
-------------------------------------
305
229
0 commit comments