On 11.05.05, Jose' Matos wrote:
> On Wednesday 11 May 2005 11:12, G. Milde wrote:
> > Jos�, what do you think about a generic "LyX" python package including
> > ly2lyx (and friends), lyxclient (and friends) and maybe more (e.g.
> > lyxchat)?
> I couldn't be happier... ;-)
Fine
> > (This would need some more thoughts about the right place of
> > the files and incorporating with the python path.)
>
> That was also my thought. :-)
> One idea would be to transform LyX into a package instead of it being a
> module.
Actually, I already converted my pyclient script into a LyX package (with
LyX/pyserver.py, LyX/pyclient.py, LyX/lfuns.py, ...). (As I need to finish
testing, it is still unpublished.)
I currently have it in my PYTHONPATH, and the wrapper-scripts (like
lyx-remote) in ~/.lyx/scripts/.
This way I can
* call import the modules from the wrapper script with e.g.
from LyX import lyxserver
* browse the documentation with pydoc
However, I can imagine problems with not knowing the PYTHONPATH or the
desire of LyX developers to keep lyx-related files under LYXDIR
(/usr/share/lyx on my Debian).
So, instead of a package directory "LyX" directly in the PYTHONPATH, I
suggest "$LYXDIR/pyLyX".
The package name would then be called "pyLyX" (PYthon package for LYX),
this is still short enough and more informative. (someone seeing
"usr/share/lyx/LyX" would not be able to tell that this is a Python
package.)
A symlink or a path configuration (*.pth) file would than add
LYXDIR/pyLyX to the PYTHONPATH. (Additionaly Python wrapper scripts in
"LYXDIR/scripts" could modify sys.path to include LYXDIR/pyLyX in any
case.)
If you then move LYXDIR/lyx2lyx/ to LYXDIR/pyLyX/lyx2lyx, it becomes
a part of the pyLyX package. Now moving LYXDIR/lyx2lyx/lyx2lyx to
LYXDIR/scripts/lyx2lyx would make the lyx2lyx wrapper easily available
again. Of course this moves would need changes in the import statements...
G�nter
--
G.Milde web.de