Ask Your Question
1

use additional code checkers?

asked 2019-10-05 05:48:05 -0500

Chris Curvey gravatar image

updated 2019-10-05 10:12:19 -0500

Is there a way to use code checkers besides pylint, pep8 and mypy?

I'm asking because I would like to start playing around with type hints as a start to migrating my python2 stuff to python3. I can't use mypy because it requires python3 (and then complains that all my libraries don't exist). I'm examining other type checkers (pytype), but can't seem to figure a way to integrate them into Wing.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-10-05 10:11:51 -0500

There isn't a way to integrate another external checker into Wing right now other than getting the sources for Wing (which you can do under nondisclosure agreement) and adding the feature. Each checker requires custom code in various places and there's not yet a plugin interface.

You could of course just invoke a checker in the OS Commands tool, but it won't be a tight integration as is available for pylint, etc.

Another idea is to look at script/pylintpanel.py in your Wing installation and copy and adapt it. That is the old pylint integration from Wing 6 and earlier. It's disabled in Wing 7 but could be enabled and would give you a new panel in Wing's interface that contains the list of warnings found by your added type checker.

Incidentally, 2to3 helps a bit with the conversion for some things, particularly changing print to print() and things like y.has_key(x) to x in y (and with experience you can configure it to disable harmful or broken conversions). But it likely won't help with string encodings and the conversion from the Python 2 to 3 model for str/unicode -> bytes/str; also not for conversion of extension modules. In any case, best to convert to latest Python 2.7 and remove as much Python 2 specific stuff as you can before then introducing incompatible Python 3 changes. We have a fair amount of code that actually runs under both Python 2 and Python 3 w/o changes, but that's maybe only a good idea if you do need to maintain for Python 2 and not otherwise (it's doable but more work).

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2019-10-05 05:48:05 -0500

Seen: 36 times

Last updated: Oct 05