@@ -345,6 +345,8 @@ Introducing
345
345
- Use ``_api.warn_deprecated() `` for general deprecation warnings
346
346
- Use the decorator ``@_api.deprecated `` to deprecate classes, functions,
347
347
methods, or properties
348
+ - Use the decorator ``@_api.deprecate_privatize_attribute `` to deprecate
349
+ attributes while keeping the internal private version.
348
350
- To warn on changes of the function signature, use the decorators
349
351
``@_api.delete_parameter ``, ``@_api.rename_parameter ``, and
350
352
``@_api.make_keyword_only ``
@@ -354,6 +356,23 @@ Introducing
354
356
355
357
You can use standard rst cross references in *alternative *.
356
358
359
+ 3. Make appropriate changes to the type hints in the associated `.pyi ` file.
360
+ The general guideline is to match runtime reported behavior.
361
+
362
+ - Items marked with ``@_api.deprecated `` or ``@_api.deprecate_privatize_attribute ``
363
+ are generally kept during the expiry period, and thus no changes are needed on
364
+ introduction.
365
+ - Items decorated with ``@_api.rename_parameter `` or ``@_api.make_keyword_only ``
366
+ report the *new * (post deprecation) signature at runtime, and thus *should * be
367
+ updated on introduction.
368
+ - Items decorated with ``@_api.delete_parameter `` should include a default value hint
369
+ for the deleted parameter, even if it did not previously have one (e.g.
370
+ ``param: <type> = ... ``). Even so, the decorator changes the default value to a
371
+ sentinel value which should not be included in the type stub. Thus, Mypy Stubtest
372
+ needs to be informed of the inconsistency by placing the method into
373
+ ``ci/mypy-stubtest-allowlist.txt `` under a heading indicating the deprecation
374
+ version number.
375
+
357
376
Expiring
358
377
~~~~~~~~
359
378
@@ -365,6 +384,19 @@ Expiring
365
384
information. For the content, you can usually copy the deprecation notice
366
385
and adapt it slightly.
367
386
2. Change the code functionality and remove any related deprecation warnings.
387
+ 3. Make appropriate changes to the type hints in the associated `.pyi ` file.
388
+
389
+ - Items marked with ``@_api.deprecated `` or ``@_api.deprecate_privatize_attribute ``
390
+ are to be removed on expiry.
391
+ - Items decorated with ``@_api.rename_parameter `` or ``@_api.make_keyword_only ``
392
+ will have been updated at introduction.
393
+ - Items decorated with ``@_api.delete_parameter `` will need to be updated to the
394
+ final signature, in the same way as the ``.py `` file signature is updated.
395
+ The entry in ``ci/mypy-stubtest-allowlist.txt `` should be removed.
396
+ - Any other entries in ``ci/mypy-stubtest-allowlist.txt `` under a versions
397
+ deprecations should be double checked, as only ``delete_parameter `` should normally
398
+ require that mechanism for deprecation. For removed items that were not in the stub
399
+ file, only deleting from the allowlist is required.
368
400
369
401
Adding new API
370
402
--------------
@@ -391,6 +423,7 @@ New modules and files: installation
391
423
* If you have added new files or directories, or reorganized existing
392
424
ones, make sure the new files are included in the match patterns in
393
425
in *package_data * in :file: `setupext.py `.
426
+ * New modules *may * be typed inline or using parallel stub file like existing modules.
394
427
395
428
C/C++ extensions
396
429
----------------
0 commit comments