Re: [Feature Request] python binding

2014-06-10 Thread Ross Reyes

Alex,  This did not work for me.

I can run the python script from the command line and it does produce a 
.png output.   So I know the

script is working.

But, in LyX 2.0.1 which I'm using, I get Error converting to loadable 
format.  I am trying to debug it.
Not sure at this point why it does not convert inside LyX.  I double 
checked the file format is defined and

also the converter is defined correctly.

I will try to turn on a log file to see if there are some other 
diagnostic messages.


Phil
On 6/2/2014 1:25 PM, Alex Vergara Gil wrote:
This might work!! Thanks for the suggestions, I will try it 
extensively and I will comments my experiences afterwards. It seems it 
also renders the graphic inside LyX itself! That's what I was talking 
about.


Regards
Alex

- Original Message - From: Rainer M Krug rai...@krugs.de
To: Alex Vergara Gil a...@cphr.edu.cu
Cc: Richard Heck rgh...@lyx.org; lyx-users Users 
lyx-users@lists.lyx.org; lyx-de...@lists.lyx.org

Sent: Monday, June 02, 2014 8:31 AM
Subject: Re: [Feature Request] python binding

I just add comments inline


Let's see if I understand:


-1. You define a *file type* in LyX under
 Preferences  File Handling  File Formats
for the file type .pygr in which Vector graphics format is ticked!

0. You define a converter under
 Preferences  File Handling  Converters
which calls a script which executed files with the extension .pygr and
generates, as you suggest below, an svg.


1. I wrote a python script that produces the graphic I want


Exactly - and you give it a specific extension .pygr for python
script which generates a graphic which you defined above.


2. I insert it in LyX somehow I don't know, perhaps defining a
converter from .py to svg, but this needs to be inside a module or
every python script in LyX will try to be converted into a svg!! So a
module is also needed


Use insert graphic and select *your .pygr* file as graphic - and Lyx
will do the rest of the conversion - i.e. use your converter to convert
the .pygr to an svg and other existing converters to generate the png
for the preview and the pdf / eps / ... for the final copmpilation of
the document.


3. LyX is the one who knows the correct size of the graphic so in
principle if I produce a svg should be enough but in this way I need
to produce a new svg every time the data change


Correct - if the input data changes, you have to generate the graph again
manually, or, if the Converter file cache is disabled, you just have
to close the document and open it again.

Hope this helps,

Rainer






Re: [Feature Request] python binding

2014-06-10 Thread Ross Reyes

Alex,  This did not work for me.

I can run the python script from the command line and it does produce a 
.png output.   So I know the

script is working.

But, in LyX 2.0.1 which I'm using, I get Error converting to loadable 
format.  I am trying to debug it.
Not sure at this point why it does not convert inside LyX.  I double 
checked the file format is defined and

also the converter is defined correctly.

I will try to turn on a log file to see if there are some other 
diagnostic messages.


Phil
On 6/2/2014 1:25 PM, Alex Vergara Gil wrote:
This might work!! Thanks for the suggestions, I will try it 
extensively and I will comments my experiences afterwards. It seems it 
also renders the graphic inside LyX itself! That's what I was talking 
about.


Regards
Alex

- Original Message - From: Rainer M Krug rai...@krugs.de
To: Alex Vergara Gil a...@cphr.edu.cu
Cc: Richard Heck rgh...@lyx.org; lyx-users Users 
lyx-users@lists.lyx.org; lyx-de...@lists.lyx.org

Sent: Monday, June 02, 2014 8:31 AM
Subject: Re: [Feature Request] python binding

I just add comments inline


Let's see if I understand:


-1. You define a *file type* in LyX under
 Preferences  File Handling  File Formats
for the file type .pygr in which Vector graphics format is ticked!

0. You define a converter under
 Preferences  File Handling  Converters
which calls a script which executed files with the extension .pygr and
generates, as you suggest below, an svg.


1. I wrote a python script that produces the graphic I want


Exactly - and you give it a specific extension .pygr for python
script which generates a graphic which you defined above.


2. I insert it in LyX somehow I don't know, perhaps defining a
converter from .py to svg, but this needs to be inside a module or
every python script in LyX will try to be converted into a svg!! So a
module is also needed


Use insert graphic and select *your .pygr* file as graphic - and Lyx
will do the rest of the conversion - i.e. use your converter to convert
the .pygr to an svg and other existing converters to generate the png
for the preview and the pdf / eps / ... for the final copmpilation of
the document.


3. LyX is the one who knows the correct size of the graphic so in
principle if I produce a svg should be enough but in this way I need
to produce a new svg every time the data change


Correct - if the input data changes, you have to generate the graph again
manually, or, if the Converter file cache is disabled, you just have
to close the document and open it again.

Hope this helps,

Rainer






Re: [Feature Request] python binding

2014-06-10 Thread Ross Reyes

Alex,  This did not work for me.

I can run the python script from the command line and it does produce a 
.png output.   So I know the

script is working.

But, in LyX 2.0.1 which I'm using, I get "Error converting to loadable 
format".  I am trying to debug it.
Not sure at this point why it does not convert inside LyX.  I double 
checked the file format is defined and

also the converter is defined correctly.

I will try to turn on a log file to see if there are some other 
diagnostic messages.


Phil
On 6/2/2014 1:25 PM, Alex Vergara Gil wrote:
This might work!! Thanks for the suggestions, I will try it 
extensively and I will comments my experiences afterwards. It seems it 
also renders the graphic inside LyX itself! That's what I was talking 
about.


Regards
Alex

- Original Message - From: "Rainer M Krug" <rai...@krugs.de>
To: "Alex Vergara Gil" <a...@cphr.edu.cu>
Cc: "Richard Heck" <rgh...@lyx.org>; "lyx-users Users" 
<lyx-users@lists.lyx.org>; <lyx-de...@lists.lyx.org>

Sent: Monday, June 02, 2014 8:31 AM
Subject: Re: [Feature Request] python binding

I just add comments inline


Let's see if I understand:


-1. You define a *file type* in LyX under
 Preferences > File Handling > File Formats
for the file type .pygr in which "Vector graphics format" is ticked!

0. You define a converter under
 Preferences > File Handling > Converters
which calls a script which executed files with the extension .pygr and
generates, as you suggest below, an svg.


1. I wrote a python script that produces the graphic I want


Exactly - and you give it a specific extension .pygr for "python
script which generates a graphic" which you defined above.


2. I insert it in LyX somehow I don't know, perhaps defining a
converter from .py to svg, but this needs to be inside a module or
every python script in LyX will try to be converted into a svg!! So a
module is also needed


Use insert graphic and select *your .pygr* file as graphic - and Lyx
will do the rest of the conversion - i.e. use your converter to convert
the .pygr to an svg and other existing converters to generate the png
for the preview and the pdf / eps / ... for the final copmpilation of
the document.


3. LyX is the one who knows the correct size of the graphic so in
principle if I produce a svg should be enough but in this way I need
to produce a new svg every time the data change


Correct - if the input data changes, you have to generate the graph again
manually, or, if the "Converter file cache" is disabled, you just have
to close the document and open it again.

Hope this helps,

Rainer






Re: [Feature Request] python binding

2014-06-02 Thread Alex Vergara Gil
From: Richard Heck rgh...@lyx.org
Sent: Thursday, May 29, 2014 5:05 PM
 I might be *completely* off, but couldn't you achieve exactly this via
 defining converters? I have for example a converter defined, which
 converts plantuml source fields into uml graphs, i.e. it defines the
 call to compile them and return the graphs which are then inserted in
 the document?
 
 Yes, that's more or less what I was suggesting.
 
 rh
 

Let's see if I understand:
1. I wrote a python script that produces the graphic I want
2. I insert it in LyX somehow I don't know, perhaps defining a converter from 
.py to svg, but this needs to be inside a module or every python script in LyX 
will try to be converted into a svg!! So a module is also needed
3. LyX is the one who knows the correct size of the graphic so in principle if 
I produce a svg should be enough but in this way I need to produce a new svg 
every time the data change

Take this simple script as example

import numpy as np
from numpy.random import randn
import matplotlib as mpl
import matplotlib.pyplot as plt
np.random.seed(9221999)
data = randn(75)
plt.hist(data)

which produce a graphic like this in spyder



So basically I save this graphic to a svg and then I load it into LyX, but why 
not letting LyX doing this automatically if it already handles with python?? 
This is my question.

Regards

Alex

Re: [Feature Request] python binding

2014-06-02 Thread Rainer M Krug
Alex Vergara Gil a...@cphr.edu.cu writes:

 From: Richard Heck rgh...@lyx.org
 Sent: Thursday, May 29, 2014 5:05 PM
 I might be *completely* off, but couldn't you achieve exactly this via
 defining converters? I have for example a converter defined, which
 converts plantuml source fields into uml graphs, i.e. it defines the
 call to compile them and return the graphs which are then inserted in
 the document?
 
 Yes, that's more or less what I was suggesting.
 
 rh
 


I just add comments inline

 Let's see if I understand:

-1. You define a *file type* in LyX under 
  Preferences  File Handling  File Formats
for the file type .pygr in which Vector graphics format is ticked!

0. You define a converter under
  Preferences  File Handling  Converters
which calls a script which executed files with the extension .pygr and
generates, as you suggest below, an svg.

 1. I wrote a python script that produces the graphic I want

Exactly - and you give it a specific extension .pygr for python
script which generates a graphic which you defined above.

 2. I insert it in LyX somehow I don't know, perhaps defining a
 converter from .py to svg, but this needs to be inside a module or
 every python script in LyX will try to be converted into a svg!! So a
 module is also needed

Use insert graphic and select *your .pygr* file as graphic - and Lyx
will do the rest of the conversion - i.e. use your converter to convert
the .pygr to an svg and other existing converters to generate the png
for the preview and the pdf / eps / ... for the final copmpilation of
the document.

 3. LyX is the one who knows the correct size of the graphic so in
 principle if I produce a svg should be enough but in this way I need
 to produce a new svg every time the data change

Correct - if the input data changes, you have to generate the graph again
manually, or, if the Converter file cache is disabled, you just have
to close the document and open it again. 

Hope this helps,

Rainer


 Take this simple script as example

 import numpy as np
 from numpy.random import randn
 import matplotlib as mpl
 import matplotlib.pyplot as plt
 np.random.seed(9221999)
 data = randn(75)
 plt.hist(data)

 which produce a graphic like this in spyder



 So basically I save this graphic to a svg and then I load it into LyX,
 but why not letting LyX doing this automatically if it already handles
 with python?? This is my question.

 Regards

 Alex

-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, 
UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :   +33 - (0)9 53 10 27 44
Cell:   +33 - (0)6 85 62 59 98
Fax :   +33 - (0)9 58 10 27 44

Fax (D):+49 - (0)3 21 21 25 22 44

email:  rai...@krugs.de

Skype:  RMkrug

PGP: 0x0F52F982


pgp86MxwTSdD2.pgp
Description: PGP signature


Re: [Feature Request] python binding

2014-06-02 Thread Alex Vergara Gil
This might work!! Thanks for the suggestions, I will try it extensively and 
I will comments my experiences afterwards. It seems it also renders the 
graphic inside LyX itself! That's what I was talking about.


Regards
Alex

- Original Message - 
From: Rainer M Krug rai...@krugs.de

To: Alex Vergara Gil a...@cphr.edu.cu
Cc: Richard Heck rgh...@lyx.org; lyx-users Users 
lyx-users@lists.lyx.org; lyx-de...@lists.lyx.org

Sent: Monday, June 02, 2014 8:31 AM
Subject: Re: [Feature Request] python binding

I just add comments inline


Let's see if I understand:


-1. You define a *file type* in LyX under
 Preferences  File Handling  File Formats
for the file type .pygr in which Vector graphics format is ticked!

0. You define a converter under
 Preferences  File Handling  Converters
which calls a script which executed files with the extension .pygr and
generates, as you suggest below, an svg.


1. I wrote a python script that produces the graphic I want


Exactly - and you give it a specific extension .pygr for python
script which generates a graphic which you defined above.


2. I insert it in LyX somehow I don't know, perhaps defining a
converter from .py to svg, but this needs to be inside a module or
every python script in LyX will try to be converted into a svg!! So a
module is also needed


Use insert graphic and select *your .pygr* file as graphic - and Lyx
will do the rest of the conversion - i.e. use your converter to convert
the .pygr to an svg and other existing converters to generate the png
for the preview and the pdf / eps / ... for the final copmpilation of
the document.


3. LyX is the one who knows the correct size of the graphic so in
principle if I produce a svg should be enough but in this way I need
to produce a new svg every time the data change


Correct - if the input data changes, you have to generate the graph again
manually, or, if the Converter file cache is disabled, you just have
to close the document and open it again.

Hope this helps,

Rainer



Re: [Feature Request] python binding

2014-06-02 Thread Alex Vergara Gil
From: Richard Heck rgh...@lyx.org
Sent: Thursday, May 29, 2014 5:05 PM
 I might be *completely* off, but couldn't you achieve exactly this via
 defining converters? I have for example a converter defined, which
 converts plantuml source fields into uml graphs, i.e. it defines the
 call to compile them and return the graphs which are then inserted in
 the document?
 
 Yes, that's more or less what I was suggesting.
 
 rh
 

Let's see if I understand:
1. I wrote a python script that produces the graphic I want
2. I insert it in LyX somehow I don't know, perhaps defining a converter from 
.py to svg, but this needs to be inside a module or every python script in LyX 
will try to be converted into a svg!! So a module is also needed
3. LyX is the one who knows the correct size of the graphic so in principle if 
I produce a svg should be enough but in this way I need to produce a new svg 
every time the data change

Take this simple script as example

import numpy as np
from numpy.random import randn
import matplotlib as mpl
import matplotlib.pyplot as plt
np.random.seed(9221999)
data = randn(75)
plt.hist(data)

which produce a graphic like this in spyder



So basically I save this graphic to a svg and then I load it into LyX, but why 
not letting LyX doing this automatically if it already handles with python?? 
This is my question.

Regards

Alex

Re: [Feature Request] python binding

2014-06-02 Thread Rainer M Krug
Alex Vergara Gil a...@cphr.edu.cu writes:

 From: Richard Heck rgh...@lyx.org
 Sent: Thursday, May 29, 2014 5:05 PM
 I might be *completely* off, but couldn't you achieve exactly this via
 defining converters? I have for example a converter defined, which
 converts plantuml source fields into uml graphs, i.e. it defines the
 call to compile them and return the graphs which are then inserted in
 the document?
 
 Yes, that's more or less what I was suggesting.
 
 rh
 


I just add comments inline

 Let's see if I understand:

-1. You define a *file type* in LyX under 
  Preferences  File Handling  File Formats
for the file type .pygr in which Vector graphics format is ticked!

0. You define a converter under
  Preferences  File Handling  Converters
which calls a script which executed files with the extension .pygr and
generates, as you suggest below, an svg.

 1. I wrote a python script that produces the graphic I want

Exactly - and you give it a specific extension .pygr for python
script which generates a graphic which you defined above.

 2. I insert it in LyX somehow I don't know, perhaps defining a
 converter from .py to svg, but this needs to be inside a module or
 every python script in LyX will try to be converted into a svg!! So a
 module is also needed

Use insert graphic and select *your .pygr* file as graphic - and Lyx
will do the rest of the conversion - i.e. use your converter to convert
the .pygr to an svg and other existing converters to generate the png
for the preview and the pdf / eps / ... for the final copmpilation of
the document.

 3. LyX is the one who knows the correct size of the graphic so in
 principle if I produce a svg should be enough but in this way I need
 to produce a new svg every time the data change

Correct - if the input data changes, you have to generate the graph again
manually, or, if the Converter file cache is disabled, you just have
to close the document and open it again. 

Hope this helps,

Rainer


 Take this simple script as example

 import numpy as np
 from numpy.random import randn
 import matplotlib as mpl
 import matplotlib.pyplot as plt
 np.random.seed(9221999)
 data = randn(75)
 plt.hist(data)

 which produce a graphic like this in spyder



 So basically I save this graphic to a svg and then I load it into LyX,
 but why not letting LyX doing this automatically if it already handles
 with python?? This is my question.

 Regards

 Alex

-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, 
UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :   +33 - (0)9 53 10 27 44
Cell:   +33 - (0)6 85 62 59 98
Fax :   +33 - (0)9 58 10 27 44

Fax (D):+49 - (0)3 21 21 25 22 44

email:  rai...@krugs.de

Skype:  RMkrug

PGP: 0x0F52F982


pgp86MxwTSdD2.pgp
Description: PGP signature


Re: [Feature Request] python binding

2014-06-02 Thread Alex Vergara Gil
This might work!! Thanks for the suggestions, I will try it extensively and 
I will comments my experiences afterwards. It seems it also renders the 
graphic inside LyX itself! That's what I was talking about.


Regards
Alex

- Original Message - 
From: Rainer M Krug rai...@krugs.de

To: Alex Vergara Gil a...@cphr.edu.cu
Cc: Richard Heck rgh...@lyx.org; lyx-users Users 
lyx-users@lists.lyx.org; lyx-de...@lists.lyx.org

Sent: Monday, June 02, 2014 8:31 AM
Subject: Re: [Feature Request] python binding

I just add comments inline


Let's see if I understand:


-1. You define a *file type* in LyX under
 Preferences  File Handling  File Formats
for the file type .pygr in which Vector graphics format is ticked!

0. You define a converter under
 Preferences  File Handling  Converters
which calls a script which executed files with the extension .pygr and
generates, as you suggest below, an svg.


1. I wrote a python script that produces the graphic I want


Exactly - and you give it a specific extension .pygr for python
script which generates a graphic which you defined above.


2. I insert it in LyX somehow I don't know, perhaps defining a
converter from .py to svg, but this needs to be inside a module or
every python script in LyX will try to be converted into a svg!! So a
module is also needed


Use insert graphic and select *your .pygr* file as graphic - and Lyx
will do the rest of the conversion - i.e. use your converter to convert
the .pygr to an svg and other existing converters to generate the png
for the preview and the pdf / eps / ... for the final copmpilation of
the document.


3. LyX is the one who knows the correct size of the graphic so in
principle if I produce a svg should be enough but in this way I need
to produce a new svg every time the data change


Correct - if the input data changes, you have to generate the graph again
manually, or, if the Converter file cache is disabled, you just have
to close the document and open it again.

Hope this helps,

Rainer



Re: [Feature Request] python binding

2014-06-02 Thread Alex Vergara Gil
From: "Richard Heck" 
Sent: Thursday, May 29, 2014 5:05 PM
>> I might be *completely* off, but couldn't you achieve exactly this via
>> defining converters? I have for example a converter defined, which
>> "converts" plantuml source fields into uml graphs, i.e. it defines the
>> call to compile them and return the graphs which are then inserted in
>> the document?
> 
> Yes, that's more or less what I was suggesting.
> 
> rh
> 

Let's see if I understand:
1. I wrote a python script that produces the graphic I want
2. I insert it in LyX somehow I don't know, perhaps defining a converter from 
.py to svg, but this needs to be inside a module or every python script in LyX 
will try to be converted into a svg!! So a module is also needed
3. LyX is the one who knows the correct size of the graphic so in principle if 
I produce a svg should be enough but in this way I need to produce a new svg 
every time the data change

Take this simple script as example

import numpy as np
from numpy.random import randn
import matplotlib as mpl
import matplotlib.pyplot as plt
np.random.seed(9221999)
data = randn(75)
plt.hist(data)

which produce a graphic like this in spyder



So basically I save this graphic to a svg and then I load it into LyX, but why 
not letting LyX doing this automatically if it already handles with python?? 
This is my question.

Regards

Alex

Re: [Feature Request] python binding

2014-06-02 Thread Rainer M Krug
"Alex Vergara Gil"  writes:

> From: "Richard Heck" 
> Sent: Thursday, May 29, 2014 5:05 PM
>>> I might be *completely* off, but couldn't you achieve exactly this via
>>> defining converters? I have for example a converter defined, which
>>> "converts" plantuml source fields into uml graphs, i.e. it defines the
>>> call to compile them and return the graphs which are then inserted in
>>> the document?
>> 
>> Yes, that's more or less what I was suggesting.
>> 
>> rh
>> 
>

I just add comments inline

> Let's see if I understand:

-1. You define a *file type* in LyX under 
  Preferences > File Handling > File Formats
for the file type .pygr in which "Vector graphics format" is ticked!

0. You define a converter under
  Preferences > File Handling > Converters
which calls a script which executed files with the extension .pygr and
generates, as you suggest below, an svg.

> 1. I wrote a python script that produces the graphic I want

Exactly - and you give it a specific extension .pygr for "python
script which generates a graphic" which you defined above.

> 2. I insert it in LyX somehow I don't know, perhaps defining a
> converter from .py to svg, but this needs to be inside a module or
> every python script in LyX will try to be converted into a svg!! So a
> module is also needed

Use insert graphic and select *your .pygr* file as graphic - and Lyx
will do the rest of the conversion - i.e. use your converter to convert
the .pygr to an svg and other existing converters to generate the png
for the preview and the pdf / eps / ... for the final copmpilation of
the document.

> 3. LyX is the one who knows the correct size of the graphic so in
> principle if I produce a svg should be enough but in this way I need
> to produce a new svg every time the data change

Correct - if the input data changes, you have to generate the graph again
manually, or, if the "Converter file cache" is disabled, you just have
to close the document and open it again. 

Hope this helps,

Rainer

>
> Take this simple script as example
>
> import numpy as np
> from numpy.random import randn
> import matplotlib as mpl
> import matplotlib.pyplot as plt
> np.random.seed(9221999)
> data = randn(75)
> plt.hist(data)
>
> which produce a graphic like this in spyder
>
>
>
> So basically I save this graphic to a svg and then I load it into LyX,
> but why not letting LyX doing this automatically if it already handles
> with python?? This is my question.
>
> Regards
>
> Alex

-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, 
UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :   +33 - (0)9 53 10 27 44
Cell:   +33 - (0)6 85 62 59 98
Fax :   +33 - (0)9 58 10 27 44

Fax (D):+49 - (0)3 21 21 25 22 44

email:  rai...@krugs.de

Skype:  RMkrug

PGP: 0x0F52F982


pgp86MxwTSdD2.pgp
Description: PGP signature


Re: [Feature Request] python binding

2014-06-02 Thread Alex Vergara Gil
This might work!! Thanks for the suggestions, I will try it extensively and 
I will comments my experiences afterwards. It seems it also renders the 
graphic inside LyX itself! That's what I was talking about.


Regards
Alex

- Original Message - 
From: "Rainer M Krug" <rai...@krugs.de>

To: "Alex Vergara Gil" <a...@cphr.edu.cu>
Cc: "Richard Heck" <rgh...@lyx.org>; "lyx-users Users" 
<lyx-users@lists.lyx.org>; <lyx-de...@lists.lyx.org>

Sent: Monday, June 02, 2014 8:31 AM
Subject: Re: [Feature Request] python binding

I just add comments inline


Let's see if I understand:


-1. You define a *file type* in LyX under
 Preferences > File Handling > File Formats
for the file type .pygr in which "Vector graphics format" is ticked!

0. You define a converter under
 Preferences > File Handling > Converters
which calls a script which executed files with the extension .pygr and
generates, as you suggest below, an svg.


1. I wrote a python script that produces the graphic I want


Exactly - and you give it a specific extension .pygr for "python
script which generates a graphic" which you defined above.


2. I insert it in LyX somehow I don't know, perhaps defining a
converter from .py to svg, but this needs to be inside a module or
every python script in LyX will try to be converted into a svg!! So a
module is also needed


Use insert graphic and select *your .pygr* file as graphic - and Lyx
will do the rest of the conversion - i.e. use your converter to convert
the .pygr to an svg and other existing converters to generate the png
for the preview and the pdf / eps / ... for the final copmpilation of
the document.


3. LyX is the one who knows the correct size of the graphic so in
principle if I produce a svg should be enough but in this way I need
to produce a new svg every time the data change


Correct - if the input data changes, you have to generate the graph again
manually, or, if the "Converter file cache" is disabled, you just have
to close the document and open it again.

Hope this helps,

Rainer



[Feature Request] python binding

2014-05-29 Thread Alex Vergara Gil
Hello Lyxers

I wonder why LyX is not available to process little pieces of python code 
within its own framework, like ipython notebook for instance??
This feature allows us to have beautiful graphics such the one produced by 
matplotlib package. I know there already exists a similar binding for R through 
knitr module, so why not a binding for python too??

Is there a way, like modules or whatever, to achieve the same functionality or 
at least some basic functionality of ipython notebook within LyX??

Regards
Alex Vergara
MSc Nuclear Physics
SSDL, CPHR, Havana, Cuba

[Feature Request] quality ePub export: Was [Feature Request] python binding

2014-05-29 Thread Steve Litt
On Thu, 29 May 2014 14:36:29 -0500
Alex Vergara Gil a...@cphr.edu.cu wrote:

 Hello Lyxers
 
 I wonder why LyX is not available to process little pieces of python
 code within its own framework, like ipython notebook for instance??
 This feature allows us to have beautiful graphics such the one
 produced by matplotlib package. I know there already exists a similar
 binding for R through knitr module, so why not a binding for python
 too??
 
 Is there a way, like modules or whatever, to achieve the same
 functionality or at least some basic functionality of ipython
 notebook within LyX??

Oh, if we're going consider requests for difficult additions to handle a
small subset of needs like beautiful graphics, how about filling the
GAPING HOLE that there's no practical way to export to ePub, without
massive human intervention and end-user programming? None of LyX's HTML
and xHtml exports are remotely suitable for flowing-text eBook
production, especially because different people have different ideas of
how eBooks should be built.

Personally, I think the easiest way forward on this is to take the
current half XML half something else native format, and make it well
formed XML. No doing favors of renaming graphics files with arbitrary
numbers, no doing favors of making obvious hierarchy into div, just
make the native format XML and let anyone with Python and lxml.etree
have his way with the native LyX file.

I know that two years ago I railed against XML native format, but
parsers have gotten better, and right now we have the human
unreadability of XML, combined with the unparsability of a more TeX
like language. Well formed XML can only be an improvement.

If well formed XML native format is not practical in the near future,
perhaps somebody could make a program that exports the current native
format into well-formed XML, once again without renumbering, throwing
away structure, etc. Basically, just pass the environments through: No
need to map Part to h1, once it's XML, we can trivially do that
ourselves, the way we want to. Given that most eBooks don't do a lot of
bibliography stuff, you could even have an initial version that has
hooks for the bibliography stuff but doesn't actually do it. Put in the
bibliographies next time. If it's not perfect with math, that's fine: I
can't think of anything more frustrating than trying to read a math
book on a small device.

Because of LyX's inability to author flowing text eBooks in any
reasonable way, I haven't used LyX in 9 months: I'm authoring with
Bluefish now. Slow, difficult, crashy, but at least my source document
can produce both print, PDF and ePub.

Maybe it's just me, but if there's one feature LyX should really have
in 2014, I think that one feature is a reasonable export mechanism to
something that can be turned into ePub, without undoing all the BS the
current LyX (x)Html converters throw into the export.

Mark my words: Within two years, beautiful graphics won't matter one
bit if the document can't be read on a small device.

Thanks,

SteveT

Steve Litt*  http://www.troubleshooters.com/
Troubleshooting Training  *  Human Performance


[Feature Request] python binding

2014-05-29 Thread Alex Vergara Gil

From: Steve Litt sl...@troubleshooters.com
Sent: Thursday, May 29, 2014 2:35 PM

On Thu, 29 May 2014 14:36:29 -0500
Alex Vergara Gil a...@cphr.edu.cu wrote:


Hello Lyxers

I wonder why LyX is not available to process little pieces of python
code within its own framework, like ipython notebook for instance??
This feature allows us to have beautiful graphics such the one
produced by matplotlib package. I know there already exists a similar
binding for R through knitr module, so why not a binding for python
too??

Is there a way, like modules or whatever, to achieve the same
functionality or at least some basic functionality of ipython
notebook within LyX??


Oh, if we're going consider requests for difficult additions to handle a
small subset of needs like beautiful graphics, how about filling the
GAPING HOLE that there's no practical way to export to ePub, without
massive human intervention and end-user programming? None of LyX's HTML
and xHtml exports are remotely suitable for flowing-text eBook
production, especially because different people have different ideas of
how eBooks should be built.


I don´t think this is a dificult addition since there is already a module 
that does something similar for what I've asked, knitr module does this but 
accepting R commands instead of python ones, so maybe the knitr author can 
put some light to this discussion. Again there should be no need to touch 
the code, just build a module similar to knitr that can be named knitpy


This is my original motivation


(...)
SteveT


Regards
Alex 



Re: [Feature Request] python binding

2014-05-29 Thread Richard Heck

On 05/29/2014 03:36 PM, Alex Vergara Gil wrote:

Hello Lyxers
I wonder why LyX is not available to process little pieces of python 
code within its own framework, like ipython notebook for instance??


This feature allows us to have beautiful graphics such the one 
produced by matplotlib package. I know there already exists a similar 
binding for R through knitr module, so why not a binding for python too??
Is there a way, like modules or whatever, to achieve the same 
functionality or at least some basic functionality of ipython notebook 
within LyX??


Can you be more precise about what you want to do? I've never heard of 
ipython notebook.


Sweave works by our having an output format (sweave) for such 
documentsand then our declaring Rscript as a sweave -- LaTeX converter, 
so PDF export (say) goes via Rscript and pdflatex. There's a special 
script in lib/scripts/ that sets up some things for LyXfirst, or so it 
claims. It would be reasonably easy to do the same sort of thing for 
Python, if you wanted to do so. You'd just need to set up an appropriate 
format and then declare an appropriate script as a whatever - latex 
converter. Then LyX will run the script and do as you wish with the 
embedded python code.


Of course, as we've discussed on the list with respect to R, there are 
large security issues here, too.


Richard



Re: [Feature Request] python binding

2014-05-29 Thread Alex Vergara Gil

  From: Richard Heck 
  Sent: Thursday, May 29, 2014 3:26 PM


  On 05/29/2014 03:36 PM, Alex Vergara Gil wrote:

Hello Lyxers

I wonder why LyX is not available to process little pieces of python code 
within its own framework, like ipython notebook for instance??


This feature allows us to have beautiful graphics such the one produced by 
matplotlib package. I know there already exists a similar binding for R through 
knitr module, so why not a binding for python too??

Is there a way, like modules or whatever, to achieve the same functionality 
or at least some basic functionality of ipython notebook within LyX??
  Can you be more precise about what you want to do? I've never heard of 
ipython notebook.
sudo aptitude install ipython-notebook
ipython notebook

and there you can write even thesis in a web environment with python commands 
being executed inlined, exporting to pdf and latex too, it is a wonder of our 
times, so why not letting LyX do this miracle too??

  Sweave works by our having an output format (sweave) for such documents and 
then our declaring Rscript as a sweave -- LaTeX converter, so PDF export (say) 
goes via Rscript and pdflatex. There's a special script in lib/scripts/ that 
sets up some things for LyX first, or so it claims. It would be reasonably 
easy to do the same sort of thing for Python, if you wanted to do so. You'd 
just need to set up an appropriate format and then declare an appropriate 
script as a whatever - latex converter. Then LyX will run the script and do as 
you wish with the embedded python code.

  Of course, as we've discussed on the list with respect to R, there are large 
security issues here, too.

  Richard
you obviously miss the point here, or I was not very clear! it is not a 
different format, is a facility to have python scripts running within LyX 
framework, you have to see ipython notebook to understand what I mean, you will 
be surprised!!
Basically to build graphs, for instance (and only a piece of what can be done), 
you add the (let's call it) knitpy module and then place a knitpy insert, 
write some python code that produces a matplotlib graphic and then when lyx 
compiles the document, instead of the code it is shown the graph, it also can 
be done in the lyx editing window, but thats a more dificult request.

Regards
Alex

Re: [Feature Request] python binding

2014-05-29 Thread Rainer M Krug
Alex Vergara Gil a...@cphr.edu.cu writes:

   From: Richard Heck 
   Sent: Thursday, May 29, 2014 3:26 PM


   On 05/29/2014 03:36 PM, Alex Vergara Gil wrote:

 Hello Lyxers

 I wonder why LyX is not available to process little pieces of
 python code within its own framework, like ipython notebook for
 instance??


 This feature allows us to have beautiful graphics such the one
 produced by matplotlib package. I know there already exists a
 similar binding for R through knitr module, so why not a binding
 for python too??

 Is there a way, like modules or whatever, to achieve the same
 functionality or at least some basic functionality of ipython notebook
 within LyX??  Can you be more precise about what you want to do? I've
 never heard of ipython notebook.  sudo aptitude install
 ipython-notebook ipython notebook

 and there you can write even thesis in a web environment with python
 commands being executed inlined, exporting to pdf and latex too, it is
 a wonder of our times, so why not letting LyX do this miracle too??

   Sweave works by our having an output format (sweave) for such
   documents and then our declaring Rscript as a sweave -- LaTeX
   converter, so PDF export (say) goes via Rscript and
   pdflatex. There's a special script in lib/scripts/ that sets up
   some things for LyX first, or so it claims. It would be reasonably
   easy to do the same sort of thing for Python, if you wanted to do
   so. You'd just need to set up an appropriate format and then declare
   an appropriate script as a whatever - latex converter. Then LyX
   will run the script and do as you wish with the embedded python
   code.

   Of course, as we've discussed on the list with respect to R, there are 
 large security issues here, too.

   Richard you obviously miss the point here, or I was not very clear!
 it is not a different format, is a facility to have python scripts
 running within LyX framework, you have to see ipython notebook to
 understand what I mean, you will be surprised!!  Basically to build
 graphs, for instance (and only a piece of what can be done), you add
 the (let's call it) knitpy module and then place a knitpy insert,
 write some python code that produces a matplotlib graphic and then
 when lyx compiles the document, instead of the code it is shown the
 graph, it also can be done in the lyx editing window, but thats a more
 dificult request.

I might be *completely* off, but couldn't you achieve exactly this via
defining converters? I have for example a converter defined, which
converts plantuml source fields into uml graphs, i.e. it defines the
call to compile them and return the graphs which are then inserted in
the document?

I have never used python, but I guess a similar approach should be
possible here as well?

Cheers,

Rainer



 Regards
 Alex

-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, 
UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :   +33 - (0)9 53 10 27 44
Cell:   +33 - (0)6 85 62 59 98
Fax :   +33 - (0)9 58 10 27 44

Fax (D):+49 - (0)3 21 21 25 22 44

email:  rai...@krugs.de

Skype:  RMkrug

PGP: 0x0F52F982


pgpNzrUAU7G2A.pgp
Description: PGP signature


Re: [Feature Request] python binding

2014-05-29 Thread Richard Heck

On 05/29/2014 04:57 PM, Rainer M Krug wrote:

Alex Vergara Gil a...@cphr.edu.cu writes:

   Richard you obviously miss the point here, or I was not very clear!
it is not a different format, is a facility to have python scripts
running within LyX framework, you have to see ipython notebook to
understand what I mean, you will be surprised!!  Basically to build
graphs, for instance (and only a piece of what can be done), you add
the (let's call it) knitpy module and then place a knitpy insert,
write some python code that produces a matplotlib graphic and then
when lyx compiles the document, instead of the code it is shown the
graph, it also can be done in the lyx editing window, but thats a more
dificult request.
I might be *completely* off, but couldn't you achieve exactly this via
defining converters? I have for example a converter defined, which
converts plantuml source fields into uml graphs, i.e. it defines the
call to compile them and return the graphs which are then inserted in
the document?


Yes, that's more or less what I was suggesting.

rh



Re: [Feature Request] python binding

2014-05-29 Thread Richard Heck

On 05/29/2014 05:34 PM, Alex Vergara Gil wrote:


*From:* Richard Heck mailto:rgh...@lyx.org
*Sent:* Thursday, May 29, 2014 3:26 PM

On 05/29/2014 03:36 PM, Alex Vergara Gil wrote:

Hello Lyxers
I wonder why LyX is not available to process little pieces of
python code within its own framework, like ipython notebook for
instance??

This feature allows us to have beautiful graphics such the one
produced by matplotlib package. I know there already exists a
similar binding for R through knitr module, so why not a binding
for python too??
Is there a way, like modules or whatever, to achieve the same
functionality or at least some basic functionality of ipython
notebook within LyX??

Can you be more precise about what you want to do? I've never
heard of ipython notebook.

sudo aptitude install ipython-notebook
ipython notebook

and there you can write even thesis in a web environment with python 
commands being executed inlined, exporting to pdf and latex too, it is 
a wonder of our times, so why not letting LyX do this miracle too??


Sweave works by our having an output format (sweave) for such
documentsand then our declaring Rscript as a sweave -- LaTeX
converter, so PDF export (say) goes via Rscript and pdflatex.
There's a special script in lib/scripts/ that sets up some things
for LyXfirst, or so it claims. It would be reasonably easy to do
the same sort of thing for Python, if you wanted to do so. You'd
just need to set up an appropriate format and then declare an
appropriate script as a whatever - latex converter. Then LyX will
run the script and do as you wish with the embedded python code.

Of course, as we've discussed on the list with respect to R, there
are large security issues here, too.

Richard

you obviously miss the point here, or I was not very clear! it is not 
a different format, is a facility to have python scripts running 
within LyX framework, you have to see ipython notebook to understand 
what I mean, you will be surprised!!
Basically to build graphs, for instance (and only a piece of what can 
be done), you add the (let's call it) knitpy module and then place a 
knitpy insert, write some python code that produces a matplotlib 
graphic and then when lyx compiles the document, instead of the code 
it is shown the graph, it also can be done in the lyx editing window, 
but thats a more dificult request.


No, that's exactly what I had in mind: Python code inthe document that 
gets executed at compile timeto create graphsor tables---or delete all 
your files. ;-) Formats are a LyX-internal method for keeping track of 
such thingsas what stage of compilation a document is at. The file 
format wouldn't really be different.


Richard



Re: [Feature Request] python binding

2014-05-29 Thread Scott Kostyshak
On Thu, May 29, 2014 at 3:36 PM, Alex Vergara Gil a...@cphr.edu.cu wrote:
 Hello Lyxers

 I wonder why LyX is not available to process little pieces of python code
 within its own framework, like ipython notebook for instance??
 This feature allows us to have beautiful graphics such the one produced by
 matplotlib package. I know there already exists a similar binding for R
 through knitr module, so why not a binding for python too??

 Is there a way, like modules or whatever, to achieve the same functionality
 or at least some basic functionality of ipython notebook within LyX??

Hi Alex,

Have you tried using knitr for python? Attached is a simple example
and the output created. For more info, see
http://yihui.name/knitr/demo/engines/ . graphics and everything else
should also work, although you might need to add custom hooks (not as
hard as it sounds).

This might not be ideal because you have to have R installed (knitr is
still itself written in R). But I would be curious in your thoughts.

Scott


python_knitr.21.lyx
Description: application/lyx


python_knitr.21.pdf
Description: Adobe PDF document


[Feature Request] python binding

2014-05-29 Thread Alex Vergara Gil
Hello Lyxers

I wonder why LyX is not available to process little pieces of python code 
within its own framework, like ipython notebook for instance??
This feature allows us to have beautiful graphics such the one produced by 
matplotlib package. I know there already exists a similar binding for R through 
knitr module, so why not a binding for python too??

Is there a way, like modules or whatever, to achieve the same functionality or 
at least some basic functionality of ipython notebook within LyX??

Regards
Alex Vergara
MSc Nuclear Physics
SSDL, CPHR, Havana, Cuba

[Feature Request] quality ePub export: Was [Feature Request] python binding

2014-05-29 Thread Steve Litt
On Thu, 29 May 2014 14:36:29 -0500
Alex Vergara Gil a...@cphr.edu.cu wrote:

 Hello Lyxers
 
 I wonder why LyX is not available to process little pieces of python
 code within its own framework, like ipython notebook for instance??
 This feature allows us to have beautiful graphics such the one
 produced by matplotlib package. I know there already exists a similar
 binding for R through knitr module, so why not a binding for python
 too??
 
 Is there a way, like modules or whatever, to achieve the same
 functionality or at least some basic functionality of ipython
 notebook within LyX??

Oh, if we're going consider requests for difficult additions to handle a
small subset of needs like beautiful graphics, how about filling the
GAPING HOLE that there's no practical way to export to ePub, without
massive human intervention and end-user programming? None of LyX's HTML
and xHtml exports are remotely suitable for flowing-text eBook
production, especially because different people have different ideas of
how eBooks should be built.

Personally, I think the easiest way forward on this is to take the
current half XML half something else native format, and make it well
formed XML. No doing favors of renaming graphics files with arbitrary
numbers, no doing favors of making obvious hierarchy into div, just
make the native format XML and let anyone with Python and lxml.etree
have his way with the native LyX file.

I know that two years ago I railed against XML native format, but
parsers have gotten better, and right now we have the human
unreadability of XML, combined with the unparsability of a more TeX
like language. Well formed XML can only be an improvement.

If well formed XML native format is not practical in the near future,
perhaps somebody could make a program that exports the current native
format into well-formed XML, once again without renumbering, throwing
away structure, etc. Basically, just pass the environments through: No
need to map Part to h1, once it's XML, we can trivially do that
ourselves, the way we want to. Given that most eBooks don't do a lot of
bibliography stuff, you could even have an initial version that has
hooks for the bibliography stuff but doesn't actually do it. Put in the
bibliographies next time. If it's not perfect with math, that's fine: I
can't think of anything more frustrating than trying to read a math
book on a small device.

Because of LyX's inability to author flowing text eBooks in any
reasonable way, I haven't used LyX in 9 months: I'm authoring with
Bluefish now. Slow, difficult, crashy, but at least my source document
can produce both print, PDF and ePub.

Maybe it's just me, but if there's one feature LyX should really have
in 2014, I think that one feature is a reasonable export mechanism to
something that can be turned into ePub, without undoing all the BS the
current LyX (x)Html converters throw into the export.

Mark my words: Within two years, beautiful graphics won't matter one
bit if the document can't be read on a small device.

Thanks,

SteveT

Steve Litt*  http://www.troubleshooters.com/
Troubleshooting Training  *  Human Performance


[Feature Request] python binding

2014-05-29 Thread Alex Vergara Gil

From: Steve Litt sl...@troubleshooters.com
Sent: Thursday, May 29, 2014 2:35 PM

On Thu, 29 May 2014 14:36:29 -0500
Alex Vergara Gil a...@cphr.edu.cu wrote:


Hello Lyxers

I wonder why LyX is not available to process little pieces of python
code within its own framework, like ipython notebook for instance??
This feature allows us to have beautiful graphics such the one
produced by matplotlib package. I know there already exists a similar
binding for R through knitr module, so why not a binding for python
too??

Is there a way, like modules or whatever, to achieve the same
functionality or at least some basic functionality of ipython
notebook within LyX??


Oh, if we're going consider requests for difficult additions to handle a
small subset of needs like beautiful graphics, how about filling the
GAPING HOLE that there's no practical way to export to ePub, without
massive human intervention and end-user programming? None of LyX's HTML
and xHtml exports are remotely suitable for flowing-text eBook
production, especially because different people have different ideas of
how eBooks should be built.


I don´t think this is a dificult addition since there is already a module 
that does something similar for what I've asked, knitr module does this but 
accepting R commands instead of python ones, so maybe the knitr author can 
put some light to this discussion. Again there should be no need to touch 
the code, just build a module similar to knitr that can be named knitpy


This is my original motivation


(...)
SteveT


Regards
Alex 



Re: [Feature Request] python binding

2014-05-29 Thread Richard Heck

On 05/29/2014 03:36 PM, Alex Vergara Gil wrote:

Hello Lyxers
I wonder why LyX is not available to process little pieces of python 
code within its own framework, like ipython notebook for instance??


This feature allows us to have beautiful graphics such the one 
produced by matplotlib package. I know there already exists a similar 
binding for R through knitr module, so why not a binding for python too??
Is there a way, like modules or whatever, to achieve the same 
functionality or at least some basic functionality of ipython notebook 
within LyX??


Can you be more precise about what you want to do? I've never heard of 
ipython notebook.


Sweave works by our having an output format (sweave) for such 
documentsand then our declaring Rscript as a sweave -- LaTeX converter, 
so PDF export (say) goes via Rscript and pdflatex. There's a special 
script in lib/scripts/ that sets up some things for LyXfirst, or so it 
claims. It would be reasonably easy to do the same sort of thing for 
Python, if you wanted to do so. You'd just need to set up an appropriate 
format and then declare an appropriate script as a whatever - latex 
converter. Then LyX will run the script and do as you wish with the 
embedded python code.


Of course, as we've discussed on the list with respect to R, there are 
large security issues here, too.


Richard



Re: [Feature Request] python binding

2014-05-29 Thread Alex Vergara Gil

  From: Richard Heck 
  Sent: Thursday, May 29, 2014 3:26 PM


  On 05/29/2014 03:36 PM, Alex Vergara Gil wrote:

Hello Lyxers

I wonder why LyX is not available to process little pieces of python code 
within its own framework, like ipython notebook for instance??


This feature allows us to have beautiful graphics such the one produced by 
matplotlib package. I know there already exists a similar binding for R through 
knitr module, so why not a binding for python too??

Is there a way, like modules or whatever, to achieve the same functionality 
or at least some basic functionality of ipython notebook within LyX??
  Can you be more precise about what you want to do? I've never heard of 
ipython notebook.
sudo aptitude install ipython-notebook
ipython notebook

and there you can write even thesis in a web environment with python commands 
being executed inlined, exporting to pdf and latex too, it is a wonder of our 
times, so why not letting LyX do this miracle too??

  Sweave works by our having an output format (sweave) for such documents and 
then our declaring Rscript as a sweave -- LaTeX converter, so PDF export (say) 
goes via Rscript and pdflatex. There's a special script in lib/scripts/ that 
sets up some things for LyX first, or so it claims. It would be reasonably 
easy to do the same sort of thing for Python, if you wanted to do so. You'd 
just need to set up an appropriate format and then declare an appropriate 
script as a whatever - latex converter. Then LyX will run the script and do as 
you wish with the embedded python code.

  Of course, as we've discussed on the list with respect to R, there are large 
security issues here, too.

  Richard
you obviously miss the point here, or I was not very clear! it is not a 
different format, is a facility to have python scripts running within LyX 
framework, you have to see ipython notebook to understand what I mean, you will 
be surprised!!
Basically to build graphs, for instance (and only a piece of what can be done), 
you add the (let's call it) knitpy module and then place a knitpy insert, 
write some python code that produces a matplotlib graphic and then when lyx 
compiles the document, instead of the code it is shown the graph, it also can 
be done in the lyx editing window, but thats a more dificult request.

Regards
Alex

Re: [Feature Request] python binding

2014-05-29 Thread Rainer M Krug
Alex Vergara Gil a...@cphr.edu.cu writes:

   From: Richard Heck 
   Sent: Thursday, May 29, 2014 3:26 PM


   On 05/29/2014 03:36 PM, Alex Vergara Gil wrote:

 Hello Lyxers

 I wonder why LyX is not available to process little pieces of
 python code within its own framework, like ipython notebook for
 instance??


 This feature allows us to have beautiful graphics such the one
 produced by matplotlib package. I know there already exists a
 similar binding for R through knitr module, so why not a binding
 for python too??

 Is there a way, like modules or whatever, to achieve the same
 functionality or at least some basic functionality of ipython notebook
 within LyX??  Can you be more precise about what you want to do? I've
 never heard of ipython notebook.  sudo aptitude install
 ipython-notebook ipython notebook

 and there you can write even thesis in a web environment with python
 commands being executed inlined, exporting to pdf and latex too, it is
 a wonder of our times, so why not letting LyX do this miracle too??

   Sweave works by our having an output format (sweave) for such
   documents and then our declaring Rscript as a sweave -- LaTeX
   converter, so PDF export (say) goes via Rscript and
   pdflatex. There's a special script in lib/scripts/ that sets up
   some things for LyX first, or so it claims. It would be reasonably
   easy to do the same sort of thing for Python, if you wanted to do
   so. You'd just need to set up an appropriate format and then declare
   an appropriate script as a whatever - latex converter. Then LyX
   will run the script and do as you wish with the embedded python
   code.

   Of course, as we've discussed on the list with respect to R, there are 
 large security issues here, too.

   Richard you obviously miss the point here, or I was not very clear!
 it is not a different format, is a facility to have python scripts
 running within LyX framework, you have to see ipython notebook to
 understand what I mean, you will be surprised!!  Basically to build
 graphs, for instance (and only a piece of what can be done), you add
 the (let's call it) knitpy module and then place a knitpy insert,
 write some python code that produces a matplotlib graphic and then
 when lyx compiles the document, instead of the code it is shown the
 graph, it also can be done in the lyx editing window, but thats a more
 dificult request.

I might be *completely* off, but couldn't you achieve exactly this via
defining converters? I have for example a converter defined, which
converts plantuml source fields into uml graphs, i.e. it defines the
call to compile them and return the graphs which are then inserted in
the document?

I have never used python, but I guess a similar approach should be
possible here as well?

Cheers,

Rainer



 Regards
 Alex

-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, 
UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :   +33 - (0)9 53 10 27 44
Cell:   +33 - (0)6 85 62 59 98
Fax :   +33 - (0)9 58 10 27 44

Fax (D):+49 - (0)3 21 21 25 22 44

email:  rai...@krugs.de

Skype:  RMkrug

PGP: 0x0F52F982


pgpNzrUAU7G2A.pgp
Description: PGP signature


Re: [Feature Request] python binding

2014-05-29 Thread Richard Heck

On 05/29/2014 04:57 PM, Rainer M Krug wrote:

Alex Vergara Gil a...@cphr.edu.cu writes:

   Richard you obviously miss the point here, or I was not very clear!
it is not a different format, is a facility to have python scripts
running within LyX framework, you have to see ipython notebook to
understand what I mean, you will be surprised!!  Basically to build
graphs, for instance (and only a piece of what can be done), you add
the (let's call it) knitpy module and then place a knitpy insert,
write some python code that produces a matplotlib graphic and then
when lyx compiles the document, instead of the code it is shown the
graph, it also can be done in the lyx editing window, but thats a more
dificult request.
I might be *completely* off, but couldn't you achieve exactly this via
defining converters? I have for example a converter defined, which
converts plantuml source fields into uml graphs, i.e. it defines the
call to compile them and return the graphs which are then inserted in
the document?


Yes, that's more or less what I was suggesting.

rh



Re: [Feature Request] python binding

2014-05-29 Thread Richard Heck

On 05/29/2014 05:34 PM, Alex Vergara Gil wrote:


*From:* Richard Heck mailto:rgh...@lyx.org
*Sent:* Thursday, May 29, 2014 3:26 PM

On 05/29/2014 03:36 PM, Alex Vergara Gil wrote:

Hello Lyxers
I wonder why LyX is not available to process little pieces of
python code within its own framework, like ipython notebook for
instance??

This feature allows us to have beautiful graphics such the one
produced by matplotlib package. I know there already exists a
similar binding for R through knitr module, so why not a binding
for python too??
Is there a way, like modules or whatever, to achieve the same
functionality or at least some basic functionality of ipython
notebook within LyX??

Can you be more precise about what you want to do? I've never
heard of ipython notebook.

sudo aptitude install ipython-notebook
ipython notebook

and there you can write even thesis in a web environment with python 
commands being executed inlined, exporting to pdf and latex too, it is 
a wonder of our times, so why not letting LyX do this miracle too??


Sweave works by our having an output format (sweave) for such
documentsand then our declaring Rscript as a sweave -- LaTeX
converter, so PDF export (say) goes via Rscript and pdflatex.
There's a special script in lib/scripts/ that sets up some things
for LyXfirst, or so it claims. It would be reasonably easy to do
the same sort of thing for Python, if you wanted to do so. You'd
just need to set up an appropriate format and then declare an
appropriate script as a whatever - latex converter. Then LyX will
run the script and do as you wish with the embedded python code.

Of course, as we've discussed on the list with respect to R, there
are large security issues here, too.

Richard

you obviously miss the point here, or I was not very clear! it is not 
a different format, is a facility to have python scripts running 
within LyX framework, you have to see ipython notebook to understand 
what I mean, you will be surprised!!
Basically to build graphs, for instance (and only a piece of what can 
be done), you add the (let's call it) knitpy module and then place a 
knitpy insert, write some python code that produces a matplotlib 
graphic and then when lyx compiles the document, instead of the code 
it is shown the graph, it also can be done in the lyx editing window, 
but thats a more dificult request.


No, that's exactly what I had in mind: Python code inthe document that 
gets executed at compile timeto create graphsor tables---or delete all 
your files. ;-) Formats are a LyX-internal method for keeping track of 
such thingsas what stage of compilation a document is at. The file 
format wouldn't really be different.


Richard



Re: [Feature Request] python binding

2014-05-29 Thread Scott Kostyshak
On Thu, May 29, 2014 at 3:36 PM, Alex Vergara Gil a...@cphr.edu.cu wrote:
 Hello Lyxers

 I wonder why LyX is not available to process little pieces of python code
 within its own framework, like ipython notebook for instance??
 This feature allows us to have beautiful graphics such the one produced by
 matplotlib package. I know there already exists a similar binding for R
 through knitr module, so why not a binding for python too??

 Is there a way, like modules or whatever, to achieve the same functionality
 or at least some basic functionality of ipython notebook within LyX??

Hi Alex,

Have you tried using knitr for python? Attached is a simple example
and the output created. For more info, see
http://yihui.name/knitr/demo/engines/ . graphics and everything else
should also work, although you might need to add custom hooks (not as
hard as it sounds).

This might not be ideal because you have to have R installed (knitr is
still itself written in R). But I would be curious in your thoughts.

Scott


python_knitr.21.lyx
Description: application/lyx


python_knitr.21.pdf
Description: Adobe PDF document


[Feature Request] python binding

2014-05-29 Thread Alex Vergara Gil
Hello Lyxers

I wonder why LyX is not available to process little pieces of python code 
within its own framework, like ipython notebook for instance??
This feature allows us to have beautiful graphics such the one produced by 
matplotlib package. I know there already exists a similar binding for R through 
knitr module, so why not a binding for python too??

Is there a way, like modules or whatever, to achieve the same functionality or 
at least some basic functionality of ipython notebook within LyX??

Regards
Alex Vergara
MSc Nuclear Physics
SSDL, CPHR, Havana, Cuba

[Feature Request] quality ePub export: Was [Feature Request] python binding

2014-05-29 Thread Steve Litt
On Thu, 29 May 2014 14:36:29 -0500
"Alex Vergara Gil"  wrote:

> Hello Lyxers
> 
> I wonder why LyX is not available to process little pieces of python
> code within its own framework, like ipython notebook for instance??
> This feature allows us to have beautiful graphics such the one
> produced by matplotlib package. I know there already exists a similar
> binding for R through knitr module, so why not a binding for python
> too??
> 
> Is there a way, like modules or whatever, to achieve the same
> functionality or at least some basic functionality of ipython
> notebook within LyX??

Oh, if we're going consider requests for difficult additions to handle a
small subset of needs like beautiful graphics, how about filling the
GAPING HOLE that there's no practical way to export to ePub, without
massive human intervention and end-user programming? None of LyX's HTML
and xHtml exports are remotely suitable for flowing-text eBook
production, especially because different people have different ideas of
how eBooks should be built.

Personally, I think the easiest way forward on this is to take the
current half XML half something else native format, and make it well
formed XML. No doing favors of renaming graphics files with arbitrary
numbers, no doing favors of making obvious hierarchy into , just
make the native format XML and let anyone with Python and lxml.etree
have his way with the native LyX file.

I know that two years ago I railed against XML native format, but
parsers have gotten better, and right now we have the human
unreadability of XML, combined with the unparsability of a more TeX
like language. Well formed XML can only be an improvement.

If well formed XML native format is not practical in the near future,
perhaps somebody could make a program that exports the current native
format into well-formed XML, once again without renumbering, throwing
away structure, etc. Basically, just pass the environments through: No
need to map Part to , once it's XML, we can trivially do that
ourselves, the way we want to. Given that most eBooks don't do a lot of
bibliography stuff, you could even have an initial version that has
hooks for the bibliography stuff but doesn't actually do it. Put in the
bibliographies next time. If it's not perfect with math, that's fine: I
can't think of anything more frustrating than trying to read a math
book on a small device.

Because of LyX's inability to author flowing text eBooks in any
reasonable way, I haven't used LyX in 9 months: I'm authoring with
Bluefish now. Slow, difficult, crashy, but at least my source document
can produce both print, PDF and ePub.

Maybe it's just me, but if there's one feature LyX should really have
in 2014, I think that one feature is a reasonable export mechanism to
something that can be turned into ePub, without undoing all the BS the
current LyX (x)Html converters throw into the export.

Mark my words: Within two years, beautiful graphics won't matter one
bit if the document can't be read on a small device.

Thanks,

SteveT

Steve Litt*  http://www.troubleshooters.com/
Troubleshooting Training  *  Human Performance


[Feature Request] python binding

2014-05-29 Thread Alex Vergara Gil

From: "Steve Litt" 
Sent: Thursday, May 29, 2014 2:35 PM

On Thu, 29 May 2014 14:36:29 -0500
"Alex Vergara Gil"  wrote:


Hello Lyxers

I wonder why LyX is not available to process little pieces of python
code within its own framework, like ipython notebook for instance??
This feature allows us to have beautiful graphics such the one
produced by matplotlib package. I know there already exists a similar
binding for R through knitr module, so why not a binding for python
too??

Is there a way, like modules or whatever, to achieve the same
functionality or at least some basic functionality of ipython
notebook within LyX??


Oh, if we're going consider requests for difficult additions to handle a
small subset of needs like beautiful graphics, how about filling the
GAPING HOLE that there's no practical way to export to ePub, without
massive human intervention and end-user programming? None of LyX's HTML
and xHtml exports are remotely suitable for flowing-text eBook
production, especially because different people have different ideas of
how eBooks should be built.


I don´t think this is a "dificult addition" since there is already a module 
that does something similar for what I've asked, knitr module does this but 
accepting R commands instead of python ones, so maybe the knitr author can 
put some light to this discussion. Again there should be no need to touch 
the code, just build a module similar to knitr that can be named "knitpy"


This is my original motivation


(...)
SteveT


Regards
Alex 



Re: [Feature Request] python binding

2014-05-29 Thread Richard Heck

On 05/29/2014 03:36 PM, Alex Vergara Gil wrote:

Hello Lyxers
I wonder why LyX is not available to process little pieces of python 
code within its own framework, like ipython notebook for instance??


This feature allows us to have beautiful graphics such the one 
produced by matplotlib package. I know there already exists a similar 
binding for R through knitr module, so why not a binding for python too??
Is there a way, like modules or whatever, to achieve the same 
functionality or at least some basic functionality of ipython notebook 
within LyX??


Can you be more precise about what you want to do? I've never heard of 
ipython notebook.


Sweave works by our having an output format (sweave) for such 
documentsand then our declaring Rscript as a sweave --> LaTeX converter, 
so PDF export (say) goes via Rscript and pdflatex. There's a special 
script in lib/scripts/ that "sets up some things for LyX"first, or so it 
claims. It would be reasonably easy to do the same sort of thing for 
Python, if you wanted to do so. You'd just need to set up an appropriate 
format and then declare an appropriate script as a whatever -> latex 
converter. Then LyX will run the script and do as you wish with the 
embedded python code.


Of course, as we've discussed on the list with respect to R, there are 
large security issues here, too.


Richard



Re: [Feature Request] python binding

2014-05-29 Thread Alex Vergara Gil

  From: Richard Heck 
  Sent: Thursday, May 29, 2014 3:26 PM


  On 05/29/2014 03:36 PM, Alex Vergara Gil wrote:

Hello Lyxers

I wonder why LyX is not available to process little pieces of python code 
within its own framework, like ipython notebook for instance??


This feature allows us to have beautiful graphics such the one produced by 
matplotlib package. I know there already exists a similar binding for R through 
knitr module, so why not a binding for python too??

Is there a way, like modules or whatever, to achieve the same functionality 
or at least some basic functionality of ipython notebook within LyX??
  Can you be more precise about what you want to do? I've never heard of 
ipython notebook.
sudo aptitude install ipython-notebook
ipython notebook

and there you can write even thesis in a web environment with python commands 
being executed inlined, exporting to pdf and latex too, it is a wonder of our 
times, so why not letting LyX do this miracle too??

  Sweave works by our having an output format (sweave) for such documents and 
then our declaring Rscript as a sweave --> LaTeX converter, so PDF export (say) 
goes via Rscript and pdflatex. There's a special script in lib/scripts/ that 
"sets up some things for LyX" first, or so it claims. It would be reasonably 
easy to do the same sort of thing for Python, if you wanted to do so. You'd 
just need to set up an appropriate format and then declare an appropriate 
script as a whatever -> latex converter. Then LyX will run the script and do as 
you wish with the embedded python code.

  Of course, as we've discussed on the list with respect to R, there are large 
security issues here, too.

  Richard
you obviously miss the point here, or I was not very clear! it is not a 
different format, is a facility to have python scripts running within LyX 
framework, you have to see ipython notebook to understand what I mean, you will 
be surprised!!
Basically to build graphs, for instance (and only a piece of what can be done), 
you add the (let's call it) "knitpy" module and then place a knitpy insert, 
write some python code that produces a matplotlib graphic and then when lyx 
compiles the document, instead of the code it is shown the graph, it also can 
be done in the lyx editing window, but thats a more dificult request.

Regards
Alex

Re: [Feature Request] python binding

2014-05-29 Thread Rainer M Krug
"Alex Vergara Gil"  writes:

>   From: Richard Heck 
>   Sent: Thursday, May 29, 2014 3:26 PM
>
>
>   On 05/29/2014 03:36 PM, Alex Vergara Gil wrote:
>
> Hello Lyxers
>
> I wonder why LyX is not available to process little pieces of
> python code within its own framework, like ipython notebook for
> instance??
>
>
> This feature allows us to have beautiful graphics such the one
> produced by matplotlib package. I know there already exists a
> similar binding for R through knitr module, so why not a binding
> for python too??
>
> Is there a way, like modules or whatever, to achieve the same
> functionality or at least some basic functionality of ipython notebook
> within LyX??  Can you be more precise about what you want to do? I've
> never heard of ipython notebook.  sudo aptitude install
> ipython-notebook ipython notebook
>
> and there you can write even thesis in a web environment with python
> commands being executed inlined, exporting to pdf and latex too, it is
> a wonder of our times, so why not letting LyX do this miracle too??
>
>   Sweave works by our having an output format (sweave) for such
>   documents and then our declaring Rscript as a sweave --> LaTeX
>   converter, so PDF export (say) goes via Rscript and
>   pdflatex. There's a special script in lib/scripts/ that "sets up
>   some things for LyX" first, or so it claims. It would be reasonably
>   easy to do the same sort of thing for Python, if you wanted to do
>   so. You'd just need to set up an appropriate format and then declare
>   an appropriate script as a whatever -> latex converter. Then LyX
>   will run the script and do as you wish with the embedded python
>   code.
>
>   Of course, as we've discussed on the list with respect to R, there are 
> large security issues here, too.
>
>   Richard you obviously miss the point here, or I was not very clear!
> it is not a different format, is a facility to have python scripts
> running within LyX framework, you have to see ipython notebook to
> understand what I mean, you will be surprised!!  Basically to build
> graphs, for instance (and only a piece of what can be done), you add
> the (let's call it) "knitpy" module and then place a knitpy insert,
> write some python code that produces a matplotlib graphic and then
> when lyx compiles the document, instead of the code it is shown the
> graph, it also can be done in the lyx editing window, but thats a more
> dificult request.

I might be *completely* off, but couldn't you achieve exactly this via
defining converters? I have for example a converter defined, which
"converts" plantuml source fields into uml graphs, i.e. it defines the
call to compile them and return the graphs which are then inserted in
the document?

I have never used python, but I guess a similar approach should be
possible here as well?

Cheers,

Rainer


>
> Regards
> Alex

-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, 
UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :   +33 - (0)9 53 10 27 44
Cell:   +33 - (0)6 85 62 59 98
Fax :   +33 - (0)9 58 10 27 44

Fax (D):+49 - (0)3 21 21 25 22 44

email:  rai...@krugs.de

Skype:  RMkrug

PGP: 0x0F52F982


pgpNzrUAU7G2A.pgp
Description: PGP signature


Re: [Feature Request] python binding

2014-05-29 Thread Richard Heck

On 05/29/2014 04:57 PM, Rainer M Krug wrote:

"Alex Vergara Gil"  writes:

   Richard you obviously miss the point here, or I was not very clear!
it is not a different format, is a facility to have python scripts
running within LyX framework, you have to see ipython notebook to
understand what I mean, you will be surprised!!  Basically to build
graphs, for instance (and only a piece of what can be done), you add
the (let's call it) "knitpy" module and then place a knitpy insert,
write some python code that produces a matplotlib graphic and then
when lyx compiles the document, instead of the code it is shown the
graph, it also can be done in the lyx editing window, but thats a more
dificult request.
I might be *completely* off, but couldn't you achieve exactly this via
defining converters? I have for example a converter defined, which
"converts" plantuml source fields into uml graphs, i.e. it defines the
call to compile them and return the graphs which are then inserted in
the document?


Yes, that's more or less what I was suggesting.

rh



Re: [Feature Request] python binding

2014-05-29 Thread Richard Heck

On 05/29/2014 05:34 PM, Alex Vergara Gil wrote:


*From:* Richard Heck 
*Sent:* Thursday, May 29, 2014 3:26 PM

On 05/29/2014 03:36 PM, Alex Vergara Gil wrote:

Hello Lyxers
I wonder why LyX is not available to process little pieces of
python code within its own framework, like ipython notebook for
instance??

This feature allows us to have beautiful graphics such the one
produced by matplotlib package. I know there already exists a
similar binding for R through knitr module, so why not a binding
for python too??
Is there a way, like modules or whatever, to achieve the same
functionality or at least some basic functionality of ipython
notebook within LyX??

Can you be more precise about what you want to do? I've never
heard of ipython notebook.

sudo aptitude install ipython-notebook
ipython notebook

and there you can write even thesis in a web environment with python 
commands being executed inlined, exporting to pdf and latex too, it is 
a wonder of our times, so why not letting LyX do this miracle too??


Sweave works by our having an output format (sweave) for such
documentsand then our declaring Rscript as a sweave --> LaTeX
converter, so PDF export (say) goes via Rscript and pdflatex.
There's a special script in lib/scripts/ that "sets up some things
for LyX"first, or so it claims. It would be reasonably easy to do
the same sort of thing for Python, if you wanted to do so. You'd
just need to set up an appropriate format and then declare an
appropriate script as a whatever -> latex converter. Then LyX will
run the script and do as you wish with the embedded python code.

Of course, as we've discussed on the list with respect to R, there
are large security issues here, too.

Richard

you obviously miss the point here, or I was not very clear! it is not 
a different format, is a facility to have python scripts running 
within LyX framework, you have to see ipython notebook to understand 
what I mean, you will be surprised!!
Basically to build graphs, for instance (and only a piece of what can 
be done), you add the (let's call it) "knitpy" module and then place a 
knitpy insert, write some python code that produces a matplotlib 
graphic and then when lyx compiles the document, instead of the code 
it is shown the graph, it also can be done in the lyx editing window, 
but thats a more dificult request.


No, that's exactly what I had in mind: Python code inthe document that 
gets executed at compile timeto create graphsor tables---or delete all 
your files. ;-) Formats are a LyX-internal method for keeping track of 
such thingsas what stage of compilation a document is at. The file 
format wouldn't really be different.


Richard



Re: [Feature Request] python binding

2014-05-29 Thread Scott Kostyshak
On Thu, May 29, 2014 at 3:36 PM, Alex Vergara Gil  wrote:
> Hello Lyxers
>
> I wonder why LyX is not available to process little pieces of python code
> within its own framework, like ipython notebook for instance??
> This feature allows us to have beautiful graphics such the one produced by
> matplotlib package. I know there already exists a similar binding for R
> through knitr module, so why not a binding for python too??
>
> Is there a way, like modules or whatever, to achieve the same functionality
> or at least some basic functionality of ipython notebook within LyX??

Hi Alex,

Have you tried using knitr for python? Attached is a simple example
and the output created. For more info, see
http://yihui.name/knitr/demo/engines/ . graphics and everything else
should also work, although you might need to add custom hooks (not as
hard as it sounds).

This might not be ideal because you have to have R installed (knitr is
still itself written in R). But I would be curious in your thoughts.

Scott


python_knitr.21.lyx
Description: application/lyx


python_knitr.21.pdf
Description: Adobe PDF document