diff mbox series

[01/37] python: Require 3.6+

Message ID 20200915224027.2529813-2-jsnow@redhat.com
State New
Headers show
Series qapi: static typing conversion, pt1 | expand

Commit Message

John Snow Sept. 15, 2020, 10:39 p.m. UTC
Python 3.5 is now EOL. Python 3.6 brings with it several nice things:

- Literal string interpolation (PEP 498)
- Syntax for variable annotations (PEP 526)
- Preserving keyword argument order (PEP 468) *

PEP 526 in particular will allow us to convert the QAPI module to the
statically typed subset of the Python language. These static type hints
improve the interactive editing experience in IDEs and help make
refactoring and adding new features faster, easier and safer.

*Note: **kwargs is now guaranteed to preserve keyword ordering, but dict
itself is still allowed to have an arbitrary order based on
implementation. It is not until Python 3.7 that the dict type guarantees
insertion order.

Signed-off-by: John Snow <jsnow@redhat.com>
---
 docs/conf.py                  | 4 ++--
 configure                     | 6 +++---
 .readthedocs.yml              | 2 +-
 .travis.yml                   | 8 --------
 tests/qemu-iotests/iotests.py | 2 --
 5 files changed, 6 insertions(+), 16 deletions(-)

Comments

Markus Armbruster Sept. 16, 2020, 8:42 a.m. UTC | #1
John Snow <jsnow@redhat.com> writes:

> Python 3.5 is now EOL. Python 3.6 brings with it several nice things:

>

> - Literal string interpolation (PEP 498)

> - Syntax for variable annotations (PEP 526)

> - Preserving keyword argument order (PEP 468) *

>

> PEP 526 in particular will allow us to convert the QAPI module to the

> statically typed subset of the Python language. These static type hints

> improve the interactive editing experience in IDEs and help make

> refactoring and adding new features faster, easier and safer.

>

> *Note: **kwargs is now guaranteed to preserve keyword ordering, but dict

> itself is still allowed to have an arbitrary order based on

> implementation. It is not until Python 3.7 that the dict type guarantees

> insertion order.

>

> Signed-off-by: John Snow <jsnow@redhat.com>

> ---

>  docs/conf.py                  | 4 ++--

>  configure                     | 6 +++---

>  .readthedocs.yml              | 2 +-

>  .travis.yml                   | 8 --------

>  tests/qemu-iotests/iotests.py | 2 --

>  5 files changed, 6 insertions(+), 16 deletions(-)

>

> diff --git a/docs/conf.py b/docs/conf.py

> index 0dbd90dc11..8aeac40124 100644

> --- a/docs/conf.py

> +++ b/docs/conf.py

> @@ -36,9 +36,9 @@

>  # In newer versions of Sphinx this will display nicely; in older versions

>  # Sphinx will also produce a Python backtrace but at least the information

>  # gets printed...

> -if sys.version_info < (3,5):

> +if sys.version_info < (3,6):

>      raise ConfigError(

> -        "QEMU requires a Sphinx that uses Python 3.5 or better\n")

> +        "QEMU requires a Sphinx that uses Python 3.6 or better\n")

>  

>  # The per-manual conf.py will set qemu_docdir for a single-manual build;

>  # otherwise set it here if this is an entire-manual-set build.

> diff --git a/configure b/configure

> index ce27eafb0a..33292500e7 100755

> --- a/configure

> +++ b/configure

> @@ -913,7 +913,7 @@ fi

>  

>  : ${make=${MAKE-make}}

>  

> -# We prefer python 3.x. A bare 'python' is traditionally

> +# We prefer python 3.6+. A bare 'python' is traditionally


We require

>  # python 2.x, but some distros have it as python 3.x, so

>  # we check that too

>  python=

> @@ -1961,8 +1961,8 @@ fi

>  

>  # Note that if the Python conditional here evaluates True we will exit

>  # with status 1 which is a shell 'false' value.

> -if ! $python -c 'import sys; sys.exit(sys.version_info < (3,5))'; then

> -  error_exit "Cannot use '$python', Python >= 3.5 is required." \

> +if ! $python -c 'import sys; sys.exit(sys.version_info < (3,6))'; then

> +  error_exit "Cannot use '$python', Python >= 3.6 is required." \

>        "Use --python=/path/to/python to specify a supported Python."

>  fi

>  

> diff --git a/.readthedocs.yml b/.readthedocs.yml

> index 8355dbc634..7fb7b8dd61 100644

> --- a/.readthedocs.yml

> +++ b/.readthedocs.yml

> @@ -17,4 +17,4 @@ formats: all

>  # we require for other Python in our codebase (our conf.py

>  # enforces this, and some code needs it.)

>  python:

> -  version: 3.5

> +  version: 3.6

> diff --git a/.travis.yml b/.travis.yml

> index 65341634d0..0dca15a5e8 100644

> --- a/.travis.yml

> +++ b/.travis.yml

> @@ -267,14 +267,6 @@ jobs:

>  

>  

>      # Python builds

> -    - name: "GCC Python 3.5 (x86_64-softmmu)"

> -      env:

> -        - CONFIG="--target-list=x86_64-softmmu"

> -        - CACHE_NAME="${TRAVIS_BRANCH}-linux-gcc-default"

> -      language: python

> -      python: 3.5

> -

> -

>      - name: "GCC Python 3.6 (x86_64-softmmu)"

>        env:

>          - CONFIG="--target-list=x86_64-softmmu"

> diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py

> index 91e4a57126..f48460480a 100644

> --- a/tests/qemu-iotests/iotests.py

> +++ b/tests/qemu-iotests/iotests.py

> @@ -40,8 +40,6 @@

>  from qemu import qtest

>  from qemu.qmp import QMPMessage

>  

> -assert sys.version_info >= (3, 6)

> -

>  # Use this logger for logging messages directly from the iotests module

>  logger = logging.getLogger('qemu.iotests')

>  logger.addHandler(logging.NullHandler())
Daniel P. Berrangé Sept. 16, 2020, 8:51 a.m. UTC | #2
On Tue, Sep 15, 2020 at 06:39:51PM -0400, John Snow wrote:
> Python 3.5 is now EOL. Python 3.6 brings with it several nice things:


NB Upstream EOL is not relevant. We need to base min version changes
on the OS platform support matrix. So it would be better for the
commit message to provide details of the version in the various
distros we target, to show that the min version change is valid.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
diff mbox series

Patch

diff --git a/docs/conf.py b/docs/conf.py
index 0dbd90dc11..8aeac40124 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -36,9 +36,9 @@ 
 # In newer versions of Sphinx this will display nicely; in older versions
 # Sphinx will also produce a Python backtrace but at least the information
 # gets printed...
-if sys.version_info < (3,5):
+if sys.version_info < (3,6):
     raise ConfigError(
-        "QEMU requires a Sphinx that uses Python 3.5 or better\n")
+        "QEMU requires a Sphinx that uses Python 3.6 or better\n")
 
 # The per-manual conf.py will set qemu_docdir for a single-manual build;
 # otherwise set it here if this is an entire-manual-set build.
diff --git a/configure b/configure
index ce27eafb0a..33292500e7 100755
--- a/configure
+++ b/configure
@@ -913,7 +913,7 @@  fi
 
 : ${make=${MAKE-make}}
 
-# We prefer python 3.x. A bare 'python' is traditionally
+# We prefer python 3.6+. A bare 'python' is traditionally
 # python 2.x, but some distros have it as python 3.x, so
 # we check that too
 python=
@@ -1961,8 +1961,8 @@  fi
 
 # Note that if the Python conditional here evaluates True we will exit
 # with status 1 which is a shell 'false' value.
-if ! $python -c 'import sys; sys.exit(sys.version_info < (3,5))'; then
-  error_exit "Cannot use '$python', Python >= 3.5 is required." \
+if ! $python -c 'import sys; sys.exit(sys.version_info < (3,6))'; then
+  error_exit "Cannot use '$python', Python >= 3.6 is required." \
       "Use --python=/path/to/python to specify a supported Python."
 fi
 
diff --git a/.readthedocs.yml b/.readthedocs.yml
index 8355dbc634..7fb7b8dd61 100644
--- a/.readthedocs.yml
+++ b/.readthedocs.yml
@@ -17,4 +17,4 @@  formats: all
 # we require for other Python in our codebase (our conf.py
 # enforces this, and some code needs it.)
 python:
-  version: 3.5
+  version: 3.6
diff --git a/.travis.yml b/.travis.yml
index 65341634d0..0dca15a5e8 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -267,14 +267,6 @@  jobs:
 
 
     # Python builds
-    - name: "GCC Python 3.5 (x86_64-softmmu)"
-      env:
-        - CONFIG="--target-list=x86_64-softmmu"
-        - CACHE_NAME="${TRAVIS_BRANCH}-linux-gcc-default"
-      language: python
-      python: 3.5
-
-
     - name: "GCC Python 3.6 (x86_64-softmmu)"
       env:
         - CONFIG="--target-list=x86_64-softmmu"
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index 91e4a57126..f48460480a 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -40,8 +40,6 @@ 
 from qemu import qtest
 from qemu.qmp import QMPMessage
 
-assert sys.version_info >= (3, 6)
-
 # Use this logger for logging messages directly from the iotests module
 logger = logging.getLogger('qemu.iotests')
 logger.addHandler(logging.NullHandler())