freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ft-devel] Fwd: Custom search functionality & Python3 compatibility


From: Nikolaus Waxweiler
Subject: Re: [ft-devel] Fwd: Custom search functionality & Python3 compatibility of 'docmaker'
Date: Sat, 28 Apr 2018 21:58:22 +0000

As Hin-Tak mentioned, it is possible and relatively easy to support both 2.7 and 3.x in the same code base. One library I used personally is future: http://python-future.org/quickstart.html

I'd write Python 3 code and use future to make it work on Py2.

Haven't looked at your code so far, may weight in later.

Also, I suggest using pytest and tox to test your code in both 2.7 and 3.6. Have a look at Python libraries like https://github.com/rougier/freetype-py. Pytest for writing unit tests, tox for running them in both versions. Look at coverage to test your unit test coverage of your code, as used in e.g. https://github.com/googlefonts/fontbakery/blob/master/tox.ini -- the generated HTML report is very useful to see what you got covered.

I furthermore recommend looking at a code formatter like yapf (or, if you're feeling edgy, black on GitHub) and maybe even hook it into a format-on-save thing so you spend your brain cycles on more important things.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]