How to package executables

Takuto ASAKURA tkt.asakura at gmail.com
Tue Jul 21 17:27:15 CEST 2020


Hi,

by roughly looking at the argument, I misunderstood that the author (Louis)
wants to serve the script not simply as a command line tool but also
as a python library (because I saw that the names "__init__" and "__main__"
were thought somewhat sources of the issue.) But it was not the case, and
now I got in this particular case, it can be regarded as "just a simple
single file command line tool". Then, it seems 100% reasonable to put the
single script file to the bin directory in TeX Live.

> At last, once everything works, I offer to write some documentation
> about how to package a python script for easy integration in texlive
> based on this thread (that you would review and publish on [2]). Are you
> interested (or is this just another burden for you)?

In my opinion, it would be nice to have such an extended instruction.
I personally also prefer, even for projects irrelevant to TeX, single
"<command>.py" for command line tool implemented in python. However, as far
as I know, the standard way of python packaging scheme is not like that,
but provide __init__.py, __main__.py, and so on. I guess this way would
be convenient if one also want to utilize the package as "a python library"
at the same time. However, this "python standard way" would not work well
in TeX Live, if I understand correctly. It would be nice if it is clearly
documented that "TeX Live prefers single file executable even for python."
and possibly with other useful advices.

Best,
Takuto

> On 2020/07/21, at 23:58, Louis <spalax at gresille.org> wrote:
> 
> Hi,
> sorry to answer to days later, but I am in holidays with my daughter :)
> which means I have even less time to hack than usual… :'(
> 
> First, to answer to Takuto as why I would want to put my python script
> in texlive: when I published it on CTAN, Manfred Lotz (of the CTAN team)
> mentioned that "[he] thought about how [my] package could reside in
> texlive" (before giving some ideas, then redirecting me to this mailing
> list). As someone else mentioned, TeX folks probably won't look for TeX
> tools in Pypi, so I thought this would be nice if they could install my
> program from texlive (although it is on CTAN, so tex people should be
> able to find it anyways). But you know texlive better than I do, and you
> are the people in charge, so I would totally understand if you decided
> that spix should not be in texlive for any reason (because it's written
> in python, because it's a pain to include in texlive, because of too
> many issues, because…).
> 
> Now, assuming that spix has its place into texlive…
> 
> As suggested, I merged __init__.py and __main__.py files into a single
> spix.py file (work is done in branch texlive [1] for those interested).
> It can even simply be renamed as "spix", which would work on GNU/Linux
> (and MacOS?), but maybe it would not work on Windows, as Windows
> wouldn't care about the shebang, so I don't know whether this is a good
> idea or not.
> 
> [1] https://framagit.org/spalax/spix/-/tree/texlive
> 
> I will write a man page.
> 
> Would a CTAN package with those files be OK?
> 
> spix/CHANGELOG.md
> spix/LICENSE.txt
> spix/README.md
> spix/spix.py (executable)
> spix/spix.pdf (documentation)
> spix/spix.1 (man page)
> 
> Or should I add subdirectories (spix/bin/spix.py ? spix/man/spix.1?
> other?). Then, once I uploaded it to CTAN, is there anything else I
> should do, or will you (the texlive team) handle everything?
> 
> At last, once everything works, I offer to write some documentation
> about how to package a python script for easy integration in texlive
> based on this thread (that you would review and publish on [2]). Are you
> interested (or is this just another burden for you)?
> 
> [2] https://tug.org/texlive/pkgcontrib.html#exec
> 
> Thanks for your work,
> Louis




More information about the tex-live mailing list.