Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
PLIP: Add support for Python 3.8 #2890
PLIP (Plone Improvement Proposal)
Proposer: Philip Bauer
Python 3.8 is in beta right now and the final final release is scheduled for October 21st 2019. (see https://www.python.org/dev/peps/pep-0569/#schedule)
We should make sure that Plone 5.2 supports it asap. Zope 4.1 already has preliminary support for Python 3.8.
Python 3.8 has many new features and a bunch of spee-optimizations from which we might also benefit. See https://docs.python.org/3.8/whatsnew/3.8.html for details
Keeping up-to-date with current Python versions.
Updating our codebase should be relatively easy. Some deprecated imports need to be replaces (most notably
Proposal & Implementation
I implemented support for Python 3.8 with the following pull-requests:
With these Plone seems to run fine on Python 3.8.
When running the application or the test many warnings such as these appear:
They appear when identity checks (
2. Failing Tests
Running the test in Python 3.8 yields some new failing tests. We'll need a jenkins-job to make these publicly visible. But locally you can reproduce them. Errors are
@pbauer The files with the syntax warnings seem to be generated by
Ironically the SyntaxWarnings seem to show a paradigm shift in using
Maybe is is no longer true for the beta versions of Python 3.8. I've seen it on alpha versions.
referenced this issue
Jun 21, 2019
Thanks for the tip, that helps. After
The issues seems to be in Chameleon and not in the templates. Here is one example:
# <Boolean "python:'selected' if chain == () else None" (162:81)> -> __attr_selected __token = 7798 __attr_selected = ('selected' if (getitem('chain') == ()) else None) if (__attr_selected is '__default__'): __attr_selected = None else: if __attr_selected: __attr_selected = 'selected' else: __attr_selected = None if (__attr_selected is not None): __append((' selected="%s"' % __attr_selected)) __append('>') __stream_4752630400 =  __append_4752630400 = __stream_4752630400.append __append_4752630400('No workflow') __msgid_4752630400 = __re_whitespace(''.join(__stream_4752630400)).strip() if 'label_mapping_no_workflow': __append(translate('label_mapping_no_workflow', mapping=None, default=__msgid_4752630400, domain=__i18n_domain, context=__i18n_context, target_language=getitem('target_language'))) __append('</option>') __append('\n\n ')
The original template here is
With this information I was able to find the code that created that and with malthe/chameleon#293 the warnings are gone.
@icemac can you estimate how significant the performance-benefit of
@pbauer I think in union.cms it reduced the time for the test runs by 10 to 20 %. Each template which is used more than 2 to 3 times should benefit from the cache as it does not have to be recompiled.
We are using the caching in development, tests and production. (In development we also use
Yes, the directory has to exist, it is not created automatically.
I tested the speed-difference for our tests. I ran
But the difference when using
That's a speed-increase of more than 20% when setting a cache. I think this means we should configure a
@gforcada created the jenkins-jobs https://jenkins.plone.org/job/plone-5.2-python-3.8/ and https://jenkins.plone.org/job/plone-5.2-python-3.8-robot-chrome. Thanks! They are not yet triggered by github changes though.
The last failing tests should be fixed with #2903.
After that is merged and the 3.8 tests are green we could hook them up with github changes and create a pull-request-job as well.
Also: RestrictedPython 4.0 supports Python 3.8.
That's a serious case of inside knowledge.
RestrictedPython and Zope both declare support for 3.8. The respective pull-requests are zopefoundation/RestrictedPython#145, zopefoundation/RestrictedPython#150 and zopefoundation/Zope#477. And none mentions any unresolved issues.
If the @plone/security-team says we should not declare support for 3.8 for whatever reason they should please tell me so. Then I'll remove the classifier again.