From kwrite-devel Mon Nov 11 13:14:07 2013 From: "Philipp A." Date: Mon, 11 Nov 2013 13:14:07 +0000 To: kwrite-devel Subject: Re: Switching to Python 3 Message-Id: X-MARC-Message: https://marc.info/?l=kwrite-devel&m=138418879110647 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--===============2070373073934930532==" --===============2070373073934930532== Content-Type: multipart/alternative; boundary=089e015384d6ce7d3d04eae68111 --089e015384d6ce7d3d04eae68111 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 2013/11/11 Sven Brauch > Why not just run those utilities as provided by the system? There's pep8- > python2 and pep8-python3, so you can just execute those programs and have > both > language versions supported, no? > > Or does kate currently invoke them using libpython too? In that case this > should maybe be changed. > > Sven > the tool is written using python and has a python api, so it=E2=80=99s pret= ty natural to just use that instead of letting the tool create python datastructures, convert them to text, write that text to a pipe, read that text from the pipe, and parse it into python datastructures again. but i agree: if pep8.py can=E2=80=99t be fixed to work on scripts written i= n the version of python that it isn=E2=80=99t run with, we should do that. for th= e sake of elegance, however, we should only use that backwards way for the other version (i.e. use the python api to use pep8.py on python 3 files, and use a shell to run python2 pep8.py and parse the output on python2 files) PS: we have quite a bunch of linters now. i think it=E2=80=99s time to gene= rate a common linter base class that can be subclassed. like: 1. BaseLinter (base class for all linters with methods to run it and show line highlights and a method that runs it and returns a list of err= ors) 2. ConsoleLinter (where you have to pass a console command and if it can use stdin or has to use a tmpfile, as well as have to override a method = to parse its output to a list of errors) 3. JSLinter (uses my new JS framework that currently lives in jsutils to load a JS module and pass the lintable source through it) i=E2=80=99ll be glad to write it once my changes to jsutils get pulled and = we got rid of kate.gui in favor of a better alternative. --089e015384d6ce7d3d04eae68111 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
2013= /11/11 Sven Brauch <svenbrauch@googlemail.com>
Why not just run those utilities as provided by the system? There's pep= 8-
python2 and pep8-python3, so you can just execute those programs and have b= oth
language versions supported, no?

Or does kate currently invoke them using libpython too? In that case this should maybe be changed.

Sven

the tool is written = using python and has a python api, so it=E2=80=99s pretty natural to just u= se that instead of letting the tool create python datastructures, convert t= hem to text, write that text to a pipe, read that text from the pipe, and p= arse it into python datastructures again.

but i agree: if pep8.py can=E2=80=99t be fixed to work on sc= ripts written in the version of python that it isn=E2=80=99t run with, we s= hould do that. for the sake of elegance, however, we should only use that b= ackwards way for the other version (i.e. use the python api to use pep8.py = on python 3 files, and use a shell to run python2 pep8.py and parse the out= put on python2 files)

PS: we have quite a bunch of linters now. i think it=E2=80= =99s time to generate a common linter base class that can be subclassed. li= ke:
  1. BaseLinter (base class for all linters with methods to run i= t and show line highlights and a method that runs it and returns a list of = errors)
  2. ConsoleLinter (where you have to pass a console command and if it can u= se stdin or has to use a tmpfile, as well as have to override a method to p= arse its output to a list of errors)
  3. JSLinter (uses my new JS frame= work that currently lives in jsutils to load a JS module and pass the linta= ble source through it)

i=E2=80=99ll be glad to write it once my changes to jsutils get pul= led and we got rid of kate.gui in favor of a better alternative.

--089e015384d6ce7d3d04eae68111-- --===============2070373073934930532== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ KWrite-Devel mailing list KWrite-Devel@kde.org https://mail.kde.org/mailman/listinfo/kwrite-devel --===============2070373073934930532==--