Tons of deprecation warnings in Plone 5.2

What is the story with deprecation warnings under Plone 5.2? If you start a Plone instance then you the console is flooded with tons of warnings...

/Users/ajung/src/xmldirector.connector/eggs/Products.PythonScripts-4.2-py3.7.egg/Products/PythonScripts/PythonScript.py:53: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
  import imp  # NOQA
/Users/ajung/src/xmldirector.connector/eggs/plone.api-1.9.1-py3.7.egg/plone/api/validation.py:15: DeprecationWarning: inspect.getargspec() is deprecated since Python 3.0, use inspect.signature() or inspect.getfullargspec()
  signature_args, _, _, _ = inspect.getargspec(func)
/Users/ajung/src/xmldirector.connector/eggs/jsonschema-2.6.0-py3.7.egg/jsonschema/compat.py:6: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  from collections import MutableMapping, Sequence  # noqa
/Users/ajung/src/xmldirector.connector/eggs/Products.PluggableAuthService-2.0b2-py3.7.egg/Products/PluggableAuthService/utils.py:253: DeprecationWarning: inspect.getargspec() is deprecated since Python 3.0, use inspect.signature() or inspect.getfullargspec()
  args, varargs, kwargs, defaults = inspect.getargspec(wrapped)
/Users/ajung/src/xmldirector.connector/eggs/Products.PluggableAuthService-2.0b2-py3.7.egg/Products/PluggableAuthService/utils.py:264: DeprecationWarning: `formatargspec` is deprecated since Python 3.5. Use `signature` and the `Signature` object directly
  argspec = inspect.formatargspec(formatvalue=lambda v: '=None', *spec)
/Users/ajung/src/xmldirector.connector/eggs/Products.PluggableAuthService-2.0b2-py3.7.egg/Products/PluggableAuthService/utils.py:265: DeprecationWarning: `formatargspec` is deprecated since Python 3.5. Use `signature` and the `Signature` object directly
  callargs = inspect.formatargspec(formatvalue=lambda v: '', *spec)
/Users/ajung/src/xmldirector.connector/eggs/plone.api-1.9.1-py3.7.egg/plone/api/validation.py:15: DeprecationWarning: inspect.getargspec() is deprecated since Python 3.0, use inspect.signature() or inspect.getfullargspec()
  signature_args, _, _, _ = inspect.getargspec(func)
/Users/ajung/src/xmldirector.connector/eggs/WebTest-2.0.32-py3.7.egg/webtest/forms.py:408: DeprecationWarning: invalid escape sequence \s
  '''<label\s+(?:[^>]*)for=(?:"|')([a-z0-9_\-]+)(?:"|')(?:[^>]*)>''',
Running xmldirector.connector.tests.base.PolicyFixture:Integration tests:
  Set up plone.testing.zca.LayerCleanup in 0.004 seconds.
  Set up plone.testing.zope.Startup in 0.329 seconds.
  Set up plone.app.testing.layers.PloneFixture /Users/ajung/src/xmldirector.connector/eggs/Products.CMFFormController-4.0.1-py3.7.egg/Products/CMFFormController/FormAction.py:6: DeprecationWarning: InitializeClass is deprecated. Please import from AccessControl.class_init.
  from App.class_init import InitializeClass
/Users/ajung/src/xmldirector.connector/eggs/Products.PortalTransforms-3.1.5-py3.7.egg/Products/PortalTransforms/libtransforms/retransform.py:25: DeprecationWarning: Flags not at the start of the expression '<script [^>]>.*</scr' (truncated)
  r = re.compile(pat)
/Users/ajung/src/xmldirector.connector/eggs/Products.PortalTransforms-3.1.5-py3.7.egg/Products/PortalTransforms/libtransforms/retransform.py:25: DeprecationWarning: Flags not at the start of the expression '<style [^>]>.*</styl' (truncated)
  r = re.compile(pat)
/Users/ajung/src/xmldirector.connector/eggs/Products.PortalTransforms-3.1.5-py3.7.egg/Products/PortalTransforms/libtransforms/retransform.py:25: DeprecationWarning: Flags not at the start of the expression '<head [^>]>.*</head>' (truncated)
  r = re.compile(pat)
/Users/ajung/src/xmldirector.connector/eggs/Products.PortalTransforms-3.1.5-py3.7.egg/Products/PortalTransforms/libtransforms/retransform.py:25: DeprecationWarning: Flags not at the start of the expression '<[^>]*>(?i)(?m)'
  r = re.compile(pat)
/Users/ajung/src/xmldirector.connector/eggs/Products.CMFEditions-3.3.0-py3.7.egg/Products/CMFEditions/StandardModifiers.py:46: DeprecationWarning: ComponentLookupError is deprecated. Import from zope.interface.interfaces
  from zope.component.interfaces import ComponentLookupError
/Users/ajung/src/xmldirector.connector/eggs/plone.dexterity-2.8.0-py3.7.egg/plone/dexterity/events.py:3: DeprecationWarning: ObjectEvent is deprecated. Import from zope.interface.interfaces
  from zope.component.interfaces import ObjectEvent
/Users/ajung/src/xmldirector.connector/eggs/Products.DCWorkflow-2.4.0b2-py3.7.egg/Products/DCWorkflow/interfaces.py:18: DeprecationWarning: IObjectEvent is deprecated. Import from zope.interface.interfaces
  from zope.component.interfaces import IObjectEvent
/Users/ajung/src/xmldirector.connector/eggs/z3c.caching-2.1-py3.7.egg/z3c/caching/registry.py:16: DeprecationWarning: IComponents is deprecated. Import from zope.interface.interfaces
  from zope.component.interfaces import IComponents
/Users/ajung/src/xmldirector.connector/eggs/plone.app.event-3.2.1-py3.7.egg/plone/app/event/__init__.py:2: DeprecationWarning: setDefaultRoles is deprecated. Please use addPermission from AccessControl.Permission.
  from Products.CMFCore.permissions import setDefaultRoles
/Users/ajung/src/xmldirector.connector/eggs/plone.stringinterp-1.3.1-py3.7.egg/plone/stringinterp/adapters.py:13: DeprecationWarning: zope.site.hooks has moved to zope.component.hooks. Import of zope.site.hooks will become unsupported in Version 5.0
  from zope.site.hooks import getSite
/Users/ajung/src/xmldirector.connector/eggs/zope.configuration-4.3.0-py3.7.egg/zope/configuration/config.py:240: DeprecationWarning: IComponentRegistry is deprecated. Import from zope.interface.interfaces
  obj = getattr(mod, oname)
/Users/ajung/src/xmldirector.connector/eggs/zope.configuration-4.3.0-py3.7.egg/zope/configuration/config.py:240: DeprecationWarning: LazyMap is deprecated. Please import from ZTUtils.Lazy.
  obj = getattr(mod, oname)
/Users/ajung/src/xmldirector.connector/eggs/zope.configuration-4.3.0-py3.7.egg/zope/configuration/config.py:240: DeprecationWarning: LazyCat is deprecated. Please import from ZTUtils.Lazy.
  obj = getattr(mod, oname)
/Users/ajung/src/xmldirector.connector/eggs/plone.app.viewletmanager-3.0.0-py3.7.egg/plone/app/viewletmanager/manager.py:23: DeprecationWarning: Retry is deprecated. Please import from ZPublisher.
  from ZPublisher.Publish import Retry
/Users/ajung/src/xmldirector.connector/eggs/calmjs.parse-1.1.3-py3.7.egg/calmjs/parse/io.py:7: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  from collections import Iterable
/Users/ajung/src/xmldirector.connector/eggs/pyScss-1.3.5-py3.7-macosx-10.14-x86_64.egg/scss/namespace.py:172: DeprecationWarning: inspect.getargspec() is deprecated since Python 3.0, use inspect.signature() or inspect.getfullargspec()
  argspec = inspect.getargspec(function)
/Users/ajung/src/xmldirector.connector/eggs/pyScss-1.3.5-py3.7-macosx-10.14-x86_64.egg/scss/selector.py:54: FutureWarning: Possible nested set at position 329
  ''', re.VERBOSE | re.MULTILINE)
/Users/ajung/src/xmldirector.connector/eggs/plone.portlet.collection-3.3.1-py3.7.egg/plone/portlet/collection/collection.py:2: DeprecationWarning: isDefaultPage is deprecated. Import from Products.CMFPlone instead
  from plone.app.layout.navigation.defaultpage import isDefaultPage
/Users/ajung/src/xmldirector.connector/eggs/Products.CMFPlone-5.2b1-py3.7.egg/Products/CMFPlone/browser/syndication/views.py:17: DeprecationWarning: wrap_form is deprecated. Import from plone.z3cform.layout instead.
  from plone.app.z3cform.layout import wrap_form
/Users/ajung/src/xmldirector.connector/eggs/plone.protect-4.1.2-py3.7.egg/plone/protect/utils.py:28: DeprecationWarning: inspect.getargspec() is deprecated since Python 3.0, use inspect.signature() or inspect.getfullargspec()
  spec = inspect.getargspec(callable)
Could not install product Products.CMFPlacefulWorkflow
/Users/ajung/src/xmldirector.connector/eggs/Products.ExtendedPathIndex-3.4.1-py3.7.egg/Products/ExtendedPathIndex/ExtendedPathIndex.py:5: DeprecationWarning: safe_callable is deprecated. Please import from Products.PluginIndexes.util.
  from Products.PluginIndexes.common import safe_callable
Could not install product Products.ResourceRegistries
/Users/ajung/src/xmldirector.connector/eggs/Products.PortalTransforms-3.1.5-py3.7.egg/Products/PortalTransforms/libtransforms/retransform.py:25: DeprecationWarning: Flags not at the start of the expression '<script [^>]>.*</scr' (truncated)
  r = re.compile(pat)
/Users/ajung/src/xmldirector.connector/eggs/Products.PortalTransforms-3.1.5-py3.7.egg/Products/PortalTransforms/libtransforms/retransform.py:25: DeprecationWarning: Flags not at the start of the expression '<style [^>]>.*</styl' (truncated)
  r = re.compile(pat)
/Users/ajung/src/xmldirector.connector/eggs/Products.PortalTransforms-3.1.5-py3.7.egg/Products/PortalTransforms/libtransforms/retransform.py:25: DeprecationWarning: Flags not at the start of the expression '<head [^>]>.*</head>' (truncated)
  r = re.compile(pat)
/Users/ajung/src/xmldirector.connector/eggs/Products.PortalTransforms-3.1.5-py3.7.egg/Products/PortalTransforms/libtransforms/retransform.py:25: DeprecationWarning: Flags not at the start of the expression '<[^>]*>(?i)(?m)'
  r = re.compile(pat)
/Users/ajung/src/xmldirector.connector/eggs/plone.resource-2.1.1-py3.7.egg/plone/resource/manifest.py:82: DeprecationWarning: The SafeConfigParser class has been renamed to ConfigParser in Python 3.2. This alias will be removed in future versions. Use ConfigParser directly instead.
  parser = SafeConfigParser()
in 10.080 seconds.

See https://github.com/plone/Products.CMFPlone/issues/2724 and https://github.com/plone/plone.recipe.zope2instance/pull/70.

The causes for the warnings need to be fixed. You can control the display with the environment-variable PYTHONWARNINGS. See https://docs.python.org/3.7/library/warnings.html#the-warnings-filter for details.

1 Like

Is there an official strategy for fixing the deprecation warnings?

/home/dgho/onkopedia_buildout/eggs/plone.app.layout-3.1.1-py3.6.egg/plone/app/layout/viewlets/common.py:126: DeprecationWarning: cgi.escape is deprecated, use html.escape instead
  return escape(safe_unicode(context_state.object_title()))
/home/dgho/onkopedia_buildout/eggs/plone.resource-2.1.1-py3.6.egg/plone/resource/manifest.py:82: DeprecationWarning: The SafeConfigParser class has been renamed to ConfigParser in Python 3.2. This alias will be removed in future versions. Use ConfigParser directly instead.

We can use try...except ImportError or check the Python version using six or fix the deprecation warnings that are related to Python 3 at the time when we move to a Python3-only stack.

What is your preferred way for contributions here?