-
Notifications
You must be signed in to change notification settings - Fork 91
Description
Would you accept a Python 2 support PR?
It looks like not a lot of code changes are required.
I played around a little, here are my findings:
-
the Cython code just compiles and seems to work on Python 2 unchanged
-
the
__all__
in the__init__.py
fails, because I think__all__
in Cython is a unicode object, something Python 2 doesn't like. I'd advocate changing the__init__.py
to explicitly import everything needed instead of doing afrom .. import *
. This way you are in full control of what's exposed in the public API. -
the test suite relies on some features from Python 3:
- in particular
unitest.mock
, which is available asmock
on PyPI so that's easy assertRaisesRegex
which is missing. It'd need to be backported, or the test rewritten
as the regexes used aren't complicated.subTest
, either backported or the test rewritten.
I'm a fan of pytest myself so alternatively we can port the tests over over to that; it's compatible
with Python 2 and Python 3. I'd be happier doing that instead. - in particular
-
I recommend a tool like tox so we can easily run the tests on both Pythons.
-
the Makefile is geared towards Python 3, but doesn't do all that much. I just called the build_ext command myself with Python 2. We could cruftify the makefile to support Python 2. Alternatively we could also just simply document the few standard Python commands needed; tox should care of building stuff and running stuff anyway and that's a simple command.