Pytest: dropping python3.5?

Created on 28 Sep 2020  路  17Comments  路  Source: pytest-dev/pytest

since it is now end-of-lifed we should decide how much longer we'd like to support it

when dropping 3.5, we should maybe consider dropping 3.6.0 as well (3.6.0 has a broken implementation of NamedTuple for example) and only support 3.6.1+

deprecation infrastructure

Most helpful comment

Closing as we have effectively dropped 3.5 on master already. 馃榿

Thanks everyone!

All 17 comments

We have some workarounds for Python 3.5.0 and 3.5.1 in which can be removed then (eg. #5752) together with Travis CI (which we only use to test Python 3.5.1).

Can you elaborate on the exact issues with 3.6.0? IIRC some people (@nicoddemus?) were against dropping 3.5.0 and 3.5.1 when I suggested it (can't find the thread anymore...) because it's easier to communicate "We require Python 3.5" than "We require Python 3.5.2+".

I'm in favor of dropping Python 3.5 as soon as practical, and updating black to target_version=py36.
(for Hypothesis we also ran pyupgrade --py36-plus, but YMMV)

IIRC some people (@nicoddemus?) were against dropping 3.5.0 and 3.5.1 when I suggested it (can't find the thread anymore...)

Don't recall either....

I guess we can then drop Python 3.5 in 6.2 then?

I guess we can then drop Python 3.5 in 6.2 then?

I suppose following our own backwards compatibility statement we'd first need to deprecate it and such? Then again maybe this is a bit of a special case since it's already EOL upstream.

In the past we just dropped versions in major minor releases without a warning in advance, but we can improve that for sure. How would we "warn" users in that aspect?

It looks like in the past we dropped support for minor versions in minor releases (pytest 3.3 dropped python 2.6 and 3.3) -- the execption is when we dropped python2.7 but that seems exceptional on its own

True, minor releases (updated my comment).

imo python-version-based warnings are unlikely to be helpful, most situations the user is unable to update their (eol) python version

my proposal:

  • target the 6.2.0 pytest release
  • allow python_requires to do its thing

this will allow us to use these typing imports we could not use before:

>>> flake8_typing_imports.SYMBOLS[10][1] - flake8_typing_imports.SYMBOLS[0][1]
frozenset({'AsyncIterator', 'NewType', 'ContextManager', 'DefaultDict', 'Coroutine', 'TYPE_CHECKING', 'Type', 'Collection', 'AsyncIterable', 'ClassVar', 'Awaitable', 'Text'})

optional proposal:

  • use python 3.6.1+ so we can convert this namedtuple to the new syntax (3.6.0 has a few other critical bugs with dict as well and it's very unlikely someone is still using the .0 patch release this far after it has been released)

3.6.1 also allows us to freely use these typing imports that we could not use before:

>>> flake8_typing_imports.SYMBOLS[11][1] - flake8_typing_imports.SYMBOLS[10][1]
frozenset({'ChainMap', 'Counter', 'Deque', 'GenericMeta', 'AsyncGenerator'})

Sounds good. @The-Compiler what do you think?

Right, I suppose with python_requires this shouldn't be a breaking change for anyone with a recent enough pip.

A few more things we might want to do:

  • Remove TYPE_CHECKING guard/quoting from NoReturn
  • Use attr.s(auto_attribs=True) (suggested by @graingert)
  • Issue #5196 "Use simple definition order in Python>3.6" ?

for NoReturn we'd want to go to >=3.6.2

Closing as we have effectively dropped 3.5 on master already. 馃榿

Thanks everyone!

Is version 6.1.2 supposed to be compatible with Python 3.5? I have an older OS with Python 3.5 and I'm having issues running pytest. With 6.1.2 and a few earlier ones I get:

> python3 -m pytest
Traceback (most recent call last):
  File "/usr/lib/python3.5/runpy.py", line 174, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/usr/lib/python3.5/runpy.py", line 133, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/usr/lib/python3.5/runpy.py", line 109, in _get_module_details
    __import__(pkg_name)
  File "/root/.local/lib/python3.5/site-packages/pytest/__init__.py", line 3, in <module>
    from . import collect
  File "/root/.local/lib/python3.5/site-packages/pytest/collect.py", line 8, in <module>
    from _pytest.deprecated import PYTEST_COLLECT_MODULE
  File "/root/.local/lib/python3.5/site-packages/_pytest/deprecated.py", line 11, in <module>
    from _pytest.warning_types import PytestDeprecationWarning
  File "/root/.local/lib/python3.5/site-packages/_pytest/warning_types.py", line 7, in <module>
    from _pytest.compat import final
  File "/root/.local/lib/python3.5/site-packages/_pytest/compat.py", line 57, in <module>
    import importlib_metadata  # noqa: F401
  File "/root/.local/lib/python3.5/site-packages/importlib_metadata/__init__.py", line 88
    dist: Optional['Distribution'] = None
        ^
SyntaxError: invalid syntax

On the latest 6.2.0 I get:

> python3 -m pytest
Traceback (most recent call last):
  File "/usr/lib/python3.5/runpy.py", line 174, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/usr/lib/python3.5/runpy.py", line 133, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/usr/lib/python3.5/runpy.py", line 109, in _get_module_details
    __import__(pkg_name)
  File "/root/.local/lib/python3.5/site-packages/pytest/__init__.py", line 3, in <module>
    from . import collect
  File "/root/.local/lib/python3.5/site-packages/pytest/collect.py", line 8, in <module>
    from _pytest.deprecated import PYTEST_COLLECT_MODULE
  File "/root/.local/lib/python3.5/site-packages/_pytest/deprecated.py", line 13, in <module>
    from _pytest.warning_types import PytestDeprecationWarning
  File "/root/.local/lib/python3.5/site-packages/_pytest/warning_types.py", line 8, in <module>
    from _pytest.compat import final
  File "/root/.local/lib/python3.5/site-packages/_pytest/compat.py", line 39
    NOTSET: "Final" = NotSetType.token  # noqa: E305
          ^
SyntaxError: invalid syntax

My setup:

> lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.6 LTS
Release:    16.04
Codename:   xenial
> python3 --version
Python 3.5.2

it is, however whatever version if importlib-metadata you've installed is incompatible

Thanks! I got it to work with importlib_metadata==2.1.1

Was this page helpful?
0 / 5 - 0 ratings