Re: Python 3 as the default for 2.4

2018-03-31 Thread Kornel Benko
Am Samstag, 31. März 2018 00:25:00 CEST schrieb José Abílio Matos 
:
> On Friday, 30 March 2018 20.21.53 WEST Kornel Benko wrote:
> > And we should distinguish usage of python at configure and build time,
> > from
> > the use at lyx-run-time.
> > 
> > Kornel
> 
> That is where I respectfully disagree. :-)
> 
> What you are suggesting is equivalent to release a lyx version with the
> documentation file format that is smaller than the current file format.
> Although it does work we never do that, before the release we always update
> the documentation to the file format of the released version.

Hm, yes, sort of. But in contrast to a provided new lyx with new doc-version, 
we do not provide a new python package together with lyx.

> The reason why I say this is similar to a blog that I read yesterday:
> "Is Python interpreted or compiled? Yes."
> https://nedbatchelder.com/blog/201803/is_python_interpreted_or_compiled_yes.
> html
> 
> When we install the python file we create the pyc files, and those files are
> specific to a given python version. If the code is read with another
> version we need to regenerate those files again.

I was not aware of this. If a package is created by cmake, then the installed 
does not contain any .pyc file. Why do we create .pyc in automake? I never 
suffered under execution times of python in lyx.

> With python 3 those files place in a directory called __pycache__. BTW one
> of the changes of python 3.7 (that is now at version beta) is to have
> reproducible builds for pyc files:
> https://docs.python.org/dev/whatsnew/3.7.html#hash-based-pycs
> 
> BTW the extreme case where the same python version is required for both
> build and runtime would be if one python module was linked with lyx c++
> code (say a common library that allows to read and interface directly with
> lyx data structures).

True. We do not require it, and so our python sources should be OK with 
respect to 2.7 and 3.3 version.

> The reason why I am being cautious is to have everyone understanding the
> implications of the move that I am proposing.
> 
> Thank you Kornel for this thoughtful email exchange. :-)

Thank you too.

Kornel



signature.asc
Description: This is a digitally signed message part.


Re: Python 3 as the default for 2.4

2018-03-30 Thread José Abílio Matos
On Friday, 30 March 2018 20.21.53 WEST Kornel Benko wrote:
> And we should distinguish usage of python at configure and build time, from
> the use at lyx-run-time.
> 
> Kornel

That is where I respectfully disagree. :-)

What you are suggesting is equivalent to release a lyx version with the 
documentation file 
format that is smaller than the current file format. Although it does work we 
never do that, 
before the release we always update the documentation to the file format of the 
released 
version.

The reason why I say this is similar to a blog that I read yesterday:
"Is Python interpreted or compiled? Yes."
https://nedbatchelder.com/blog/201803/is_python_interpreted_or_compiled_yes.html

When we install the python file we create the pyc files, and those files are 
specific to a given 
python version. If the code is read with another version we need to regenerate 
those files again.

With python 3 those files place in a directory called __pycache__. BTW one of 
the changes of 
python 3.7 (that is now at version beta) is to have reproducible builds for pyc 
files:
https://docs.python.org/dev/whatsnew/3.7.html#hash-based-pycs

BTW the extreme case where the same python version is required for both build 
and runtime 
would be if one python module was linked with lyx c++ code (say a common 
library that allows 
to read and interface directly with lyx data structures).

The reason why I am being cautious is to have everyone understanding the 
implications of the 
move that I am proposing.

Thank you Kornel for this thoughtful email exchange. :-)
-- 
José Abílio


Re: Python 3 as the default for 2.4

2018-03-30 Thread Kornel Benko
Am Freitag, 30. März 2018 21:19:43 CEST schrieb Kornel Benko :
> Am Freitag, 30. März 2018 20:07:38 CEST schrieb José Abílio Matos
> 
> :
> > On Friday, 30 March 2018 19.59.13 WEST Kornel Benko wrote:
> > > No, I think you are wrong.
> > > CmakeLists.txt:760
> > > starts with
> > > 
> > > find_package(PythonInterp 3.3 QUIET)
> > > 
> > > If python3 is found, it is used as ${LYX_PYTHON_EXECUTABLE} from then
> > > on.
> > 
> > I was referring to src/support/os.cpp function python:
> > string const python(bool reset)
> > {
> > 
> > // Check whether the first python in PATH is the right one.
> > static string command = python23("python -tt");
> > // FIXME THREAD
> > if (reset) {
> > 
> > command = python23("python -tt");
> > 
> > }
> > 
> > ...
> > 
> > This function always tests for python...
> > 
> > I admit that I can be wrong though. :-)
> 
> But that has nothing to do with cmake. My 2 cents.
> 

And we should distinguish usage of python at configure and build time, from the 
use at lyx-run-time.

Kornel



signature.asc
Description: This is a digitally signed message part.


Re: Python 3 as the default for 2.4

2018-03-30 Thread Kornel Benko
Am Freitag, 30. März 2018 20:07:38 CEST schrieb José Abílio Matos 
:
> On Friday, 30 March 2018 19.59.13 WEST Kornel Benko wrote:
> > No, I think you are wrong.
> > CmakeLists.txt:760
> > starts with
> > 
> > find_package(PythonInterp 3.3 QUIET)
> > 
> > If python3 is found, it is used as ${LYX_PYTHON_EXECUTABLE} from then on.
> 
> I was referring to src/support/os.cpp function python:
> string const python(bool reset)
> {
> // Check whether the first python in PATH is the right one.
> static string command = python23("python -tt");
> // FIXME THREAD
> if (reset) {
> command = python23("python -tt");
> }
> ...
> 
> This function always tests for python...
> 
> I admit that I can be wrong though. :-)

But that has nothing to do with cmake. My 2 cents.

Kornel



signature.asc
Description: This is a digitally signed message part.


Re: Python 3 as the default for 2.4

2018-03-30 Thread José Abílio Matos
On Friday, 30 March 2018 19.59.13 WEST Kornel Benko wrote:
> No, I think you are wrong.
> CmakeLists.txt:760
> starts with
> find_package(PythonInterp 3.3 QUIET)
> If python3 is found, it is used as ${LYX_PYTHON_EXECUTABLE} from then on.

I was referring to src/support/os.cpp function python:
string const python(bool reset)
{
// Check whether the first python in PATH is the right one.
static string command = python23("python -tt");
// FIXME THREAD
if (reset) {
command = python23("python -tt");
}
...

This function always tests for python...

I admit that I can be wrong though. :-)
-- 
José Abílio


Re: Python 3 as the default for 2.4

2018-03-30 Thread Kornel Benko
Am Freitag, 30. März 2018 19:38:28 CEST schrieb José Abílio Matos 
:
> On Tuesday, 27 March 2018 10.29.31 WEST Kornel Benko wrote:
> > On cmake build the default is already python3.
> 
> True but then, if I read the code correctly, lyx will pick the language
> called python that only on Arch (linux) is python 3, for all other cases
> (in linux and other OSs) python refers to python 2.

No, I think you are wrong.
CmakeLists.txt:760
starts with
find_package(PythonInterp 3.3 QUIET)
If python3 is found, it is used as ${LYX_PYTHON_EXECUTABLE} from then on.

> The issue was that we could assume that python was always available, it
> is by default on most (all) linux distribution as it is on Mac OS, for
> Windows the installer bundles it so it always worked. :-)

Kornel


signature.asc
Description: This is a digitally signed message part.


Re: Python 3 as the default for 2.4

2018-03-30 Thread José Abílio Matos
On Tuesday, 27 March 2018 10.29.31 WEST Kornel Benko wrote:
> On cmake build the default is already python3.

True but then, if I read the code correctly, lyx will pick the language called 
python that only on Arch (linux) is python 3, for all other cases (in linux 
and other OSs) python refers to python 2.

The issue was that we could assume that python was always available, it 
is by default on most (all) linux distribution as it is on Mac OS, for 
Windows the installer bundles it so it always worked. :-)

-- 
José Abílio


Re: Python 3 as the default for 2.4

2018-03-30 Thread José Abílio Matos
On Tuesday, 27 March 2018 10.45.10 WEST Jean-Marc Lasgouttes wrote:
> I am OK with that. Even Ubuntu 14.04 has python 3.4.
> 
> JMarc

FWIW the reasons are the following:

 * we require version 3.3 because we use the u"" prefix in several places, that 
was not 
supported in previous versions of python 3;

 * python 3.4 does not have (on purpose) any syntactic difference from python 
3.3, the 
development cycle was used to improve the tools for the conversion, and 
interoperability, 
between python 2 and python 3.
There is one new library that is interesting to use in our code `enum`.
https://docs.python.org/3/whatsnew/3.4.html

 * one of the features that introduced in python 3.5 that was not available in 
previous python 3 
version is the interpolation operator for bytes, as opposed to strings where it 
always worked: 
e.g. b"%d" % 5 would not work for python 3.0-3.4.
https://docs.python.org/3.5/whatsnew/3.5.html

Because of the last point I am not sure if actually now we only support python 
3.5+. During the 
2.3 development cycle I have used python exclusively but then I was using 
python 3.6 so I 
would not catch any problem with the previous versions.

So what I will do now is to force the use of python3, we can adapt cmake and 
autotools later if 
we decide to also support python 2.7.

The issue here is if we remove the support for python 2 in lyx 2.4 or the next 
stable release 
(2.5?). In my humble opinion we can remove it now since all the platforms that 
we care have 
python 3 available for a long time and in 1.5 years python 2 will cease to be 
supported even in 
terms of security releases.
-- 
José Abílio


Re: Python 3 as the default for 2.4

2018-03-27 Thread Jean-Marc Lasgouttes

Le 26/03/2018 à 23:31, José Abílio Matos a écrit :

Hi,

I intend to apply a patch that makes python3 the default for lyx 2.4.

The core of the change is to move all calls to python to use the python3 
name. That should work everywhere.


Eventually we should even ignore python 2 and go python 3, only, for 
2.4. In the time frame of 2.4 python 2.7 will be reach the the EOL stage 
with no more updates not even security.


I propose to use as the minimum version python 3.4 (that was initially 
released almost 4 years ago):


I am OK with that. Even Ubuntu 14.04 has python 3.4.

JMarc


Re: Python 3 as the default for 2.4

2018-03-27 Thread Kornel Benko
Am Montag, 26. März 2018 22:31:24 CEST schrieb José Abílio Matos 
:
> Hi,
>   I intend to apply a patch that makes python3 the default for lyx 2.4.
> The core of the change is to move all calls to python to use the python3
> name. That should work everywhere.

On cmake build the default is already python3.

> Eventually we should even ignore python 2 and go python 3, only, for 2.4. In
> the time frame of 2.4 python 2.7 will be reach the the EOL stage with no
> more updates not even security.
> 
> I propose to use as the minimum version python 3.4 (that was initially
> released almost 4 years ago):
> https://www.python.org/dev/peps/pep-0429/
> 
> What do others think?

Cmake build tries with version 3.3 first. 3.4 is OK IMHO.

Kornel



signature.asc
Description: This is a digitally signed message part.


Python 3 as the default for 2.4

2018-03-26 Thread José Abílio Matos
Hi,
I intend to apply a patch that makes python3 the default for lyx 2.4.
The core of the change is to move all calls to python to use the python3 name. 
That should work everywhere.

Eventually we should even ignore python 2 and go python 3, only, for 2.4. In 
the 
time frame of 2.4 python 2.7 will be reach the the EOL stage with no more 
updates not even security.

I propose to use as the minimum version python 3.4 (that was initially released 
almost 4 years ago): 
https://www.python.org/dev/peps/pep-0429/

What do others think?
-- 
José Abílio