python-pytest-cases icon indicating copy to clipboard operation
python-pytest-cases copied to clipboard

Drop Python 2.7 support

Open saroad2 opened this issue 4 years ago • 5 comments

As of January 2020, Python 2.7 (and Python 2 in general) is not supported by the Python Software Foundation (PSF). The same implies to Python 3.5 as from December 2020.

I think it's about time that pytest-cases will do the same. This will allow us to use f-strings, type hints (not as comments), data classes, and many more abilities which are currently out of reach.

What do you think?

saroad2 avatar Feb 23 '21 07:02 saroad2

I have considered this but I would prefer not to do it for now. The pros are much lower than the cons (you can use pyfields if you need dataclass in python 2, even though I agree that type hinting class attributes without type comments is a bit less convenient :) )

Even if PSF dropped support, for the month of december 2020 only 73.6% of the total pytest-cases downloads were on python 3... So python 2 is clearly still around.

smarie avatar Feb 23 '21 13:02 smarie

I suggest keeping this issue open and marking it as blocked.

I'm pretty sure that one day we would want to drop Python 2.7 and 3.5 support. This issue can help us track it.

saroad2 avatar Feb 23 '21 17:02 saroad2

Good point

smarie avatar Feb 23 '21 20:02 smarie

Hey @smarie .

I'm bumping this issue again. I think that a year later, it's about time to drop python 2.7 support.

Keeping 2.7 makes the code a lot harder to read than it should be. I truly believe that people should have moved to python 3 by now.

Would love to hear your opinion about this.

saroad2 avatar Feb 24 '22 08:02 saroad2

Thanks @saroad2 for coming back at this point !

Indeed this could be something doable, if you are motivated.

Knowing the details inside pytest-cases, I am just afraid that by far the largest complexity by far is not due to python 2 support, but to working around the pytest engine with tweaks that are more or less ugly (creation of fixtures behind the users' back in particular, and manipulating the callspecs).

This is why I thought that the first refactoring to happen would be #170 and not #186

Maybe doing #186 first is a way to reduce the amount of code and increase readability , before doing the #170. Unfortunately I have absolutely no bandwidth these days... I can try to keep some time for review activity, if a focused PR (only solving this issue) pops up.

smarie avatar Mar 01 '22 20:03 smarie