@@ -42,7 +42,8 @@ creating a version:
42
42
43
43
Module level functions are marked as *deprecated * in version 2.9.2 now.
44
44
These functions will be removed in semver 3.
45
- For details, see section :ref: `sec_replace_deprecated_functions `.
45
+ For details, see the sections :ref: `sec_replace_deprecated_functions ` and
46
+ :ref: `sec_display_deprecation_warnings `.
46
47
47
48
48
49
A version can be created in different ways:
@@ -475,3 +476,39 @@ them with code which is compatible for future versions:
475
476
>> > s2 = str (semver.VersionInfo.parse(' 1.2.3' ).replace(major = 2 , patch = 10 ))
476
477
>> > s1 == s2
477
478
True
479
+
480
+
481
+ .. _sec_display_deprecation_warnings :
482
+
483
+ Displaying Deprecation Warnings
484
+ -------------------------------
485
+
486
+ By default, deprecation warnings are `ignored in Python <https://docs.python.org/3/library/warnings.html#warning-categories >`_.
487
+ This also affects semver's own warnings.
488
+
489
+ It is recommended that you turn on deprecation warnings in your scripts. Use one of
490
+ the following methods:
491
+
492
+ * Use the option `-Wd <https://docs.python.org/3/using/cmdline.html#cmdoption-w >`_
493
+ to enable default warnings:
494
+
495
+ * Directly running the Python command::
496
+
497
+ $ python3 -Wd scriptname.py
498
+
499
+ * Add the option in the shebang line (something like ``#!/usr/bin/python3 ``)
500
+ after the command::
501
+
502
+ #!/usr/bin/python3 -Wd
503
+
504
+ * In your own scripts add a filter to ensure that *all * warnings are displayed:
505
+
506
+ .. code-block :: python
507
+
508
+ import warnings
509
+ warnings.simplefilter(" default" )
510
+ # Call your semver code
511
+
512
+ For further details, see the section
513
+ `Overriding the default filter <https://docs.python.org/3/library/warnings.html#overriding-the-default-filter >`_
514
+ of the Python documentation.
0 commit comments