Frappe Deprecation Warnings
Frappe uses a system of deprecation warnings to alert developers about features that are being phased out or have already been removed. These warnings are categorized based on the version in which the deprecation takes effect.
Graduation
Graduation refers to a deprecation being converted to an Error during an entire major version before being removed entirely from the next major version.
- Conversion to error: from release of the graduation version
- Removed entirely: from release of the next version after the graduation version
Classes of Deprecation Warnings
Deprecations warnings inherit from the following base classes for ease of managing warning notifications with PYTHONWARNINGS.
FrappeDeprecationError
Feature is being graduated during this major version.
Tip
To temporarily downgrade these errors to warnings in an emergency:
export PYTHONWARNINGS="always::frappe.deprecation_dumpster.FrappeDeprecationError"
FrappeDeprecationWarning
Feature will be graduated during the next major version.
Important
You should not ignore these warnings and follow the instructions timely.
PendingFrappeDeprecationWarning
Feature may be potentially graduated during a major version beyond the next major version.
Note
These warnings are ignored by default.
It is possible that such a deprecation decision may be reverted, meaning that the old and the new way will be considered stable.
Tip
The new variant is considered stable and preferred. You are encouraged to migrate, regardless of whether the formal deprecation of the old variant may be dropped.
VXXFrappeDeprecationWarning
As long as the corresponding base class is not suppressed, you'll see the specific version in which a feature is slated for graduation in the logs:
V15FrappeDeprecationWarning: frappe.utils.make_esc is deprecated. ...
V16FrappeDeprecationWarning: frappe.utils.make_esc is deprecated. ...
V17FrappeDeprecationWarning: frappe.utils.make_esc is deprecated. ...
V18FrappeDeprecationWarning: frappe.utils.make_esc is deprecated. ...
...
Configuration
To configure how to show warnings, you can use the PYTHONWARNINGS env variable in your development, CI and production environments according to the respective needs.
Examples
-
Ignore all deprecation warnings:
export PYTHONWARNINGS="ignore::frappe.deprecation_dumpster.FrappeDeprecationWarning" -
Emergency downgrade FrappeDeprecationErrors from default
errortoalways:export PYTHONWARNINGS="always::frappe.deprecation_dumpster.FrappeDeprecationError" -
Upgrade PendingFrappeDeprecationWarnings from default
ignoretoalways:export PYTHONWARNINGS="always:frappe.deprecation_dumpster.PendingFrappeDeprecationWarning" -
Specifically show deprecations which will graduate in v18:
export PYTHONWARNINGS="always::frappe.deprecation_dumpster.V18FrappeDeprecationWarning"