5.3. Displaying Deprecation Warnings

By default, deprecation warnings are ignored in Python. This also affects semver’s own warnings.

It is recommended that you turn on deprecation warnings in your scripts. Use one of the following methods:

  • Use the option -Wd to enable default warnings:

    • Directly running the Python command:

      $ python3 -Wd scriptname.py
      
    • Add the option in the shebang line (something like #!/usr/bin/python3) after the command:

      #!/usr/bin/python3 -Wd
      
  • In your own scripts add a filter to ensure that all warnings are displayed:

    import warnings
    warnings.simplefilter("default")
    # Call your semver code
    

    For further details, see the section Overriding the default filter of the Python documentation.