Python updates, news, and policy
Joshua Root
jmr at macports.org
Tue Dec 28 13:28:36 UTC 2021
Here are a few Python-related FYIs and one proposal to solidify our policy.
Python 3.6 reached end-of-life as of 2021-12-23. Please feel free to
start removing use of it from ports, and accelerate removal of use of
3.5 and older. But *please* remember to only remove py36 subports (and
indeed any ports) *after* they have no remaining dependents.
Python upstream has switched to an annual release cycle[1]. This means
that new major versions will always be released in October going
forward. I propose that we sync up with this schedule and change the
default Python version in MacPorts, i.e. the default value of
python.default_version in the python portgroup and the recommended
default variant for ports that offer pythonXY variants, to the latest
upstream release every year on the 1st of January, unless there are
known issues that would make this significantly problematic. This timing
means that the new major version will have had its first bugfix release
for a few weeks, giving time for evaluation; plus it has the advantage
of being easy to remember. :)
Setuptools has deprecated 'setup.py install', which is currently the
default installation method used by the python portgroup. It still works
fine for now, but at some unspecified point in the future it will be
going away, so all ports using the portgroup need to start being
migrated to use the new PEP 517 style builds. This is done by setting
'python.pep517 yes' in the Portfile. That option is only supported with
Python 3.6 and newer, so ports that still support older pythons will
need to set it conditionally based on the python version.
Setting python.pep517 will add dependencies on an appropriate build
front-end automatically, but each port will need to specify its
dependencies for the back-end used by the project being built. Most will
use setuptools, but others may use different back-ends such as flit or
poetry.
Unfortunately, setuptools alone is not sufficient to do a pep517 build,
and any ports that use setuptools as their pep517 back-end will need to
additionally depend on pyXY-wheel. You also can't just build with
distutils in a PEP 517 world (and distutils will also be disappearing
from the stdlib in a future Python release.) So anything currently
relying on distutils (i.e. no dependencies but pythonXY) will need to
add dependencies on setuptools and wheel.
- Josh
[1] https://www.python.org/dev/peps/pep-0602/
More information about the macports-dev
mailing list