I'm preparing to publish my first package, and am not sure about the best way to proceed. I understand the standard CTAN publishing approach, but I'm dealing with a somewhat atypical case since my package involves Python scripts and (for Windows) batch files. I'm not sure what special treatment these may require.
Background
My package allows Python code to be typeset within a document and/or saved to an external file from which it is executed (and then the output can be pulled back into LaTeX). Basically, a combination of most features of python.sty
, SageTeX
, and minted
, with a lot of emphasis on speed (everything is hashed, only run when changed, and run in parallel) and usability (all Python errors can be reported in the LaTeX editor, with correct line numbers).
Getting this to work involves running latex file.tex
, pythontex.bat file
(or pythontex.py file
, depending on operating system; the .bat
basically just calls the .py
), and then latex file.tex
. The problem is that the package needs to be installed such that pythontex.bat
(or pythontex.py
) can be run without specifying the full path (that is, be somewhere that is in the system path). They need to behave as if they were binaries in TeX Live's bin/
folder. This is necessary so that they can easily be invoked by a LaTeX editor or from the command line.
There is one additional complication. The package requires two additional Python files, pythontex_utils.py
and pythontex_types.py
. These need to be able to be imported by any Python script. That means that either they need to be installed as a Python package (so Python can automatically find them), or I need a way to automatically determine the full path to their location (so they can be imported using the path).
Possible approaches
SageTeX
bundles all the Sage/Python stuff within Sage. It is up to the user to make the.sty
file accessible. I could take a similar approach: put my code in a Python package, and hopefully come up with some kind of automatic installer for the.sty
file. That would make it easier to deal with the Python side of things (version 2.x versus 3.x, etc.), but would also mean that the package isn't on CTAN.- I could put everything on CTAN except for the Python stuff that must be importable, and publish that separately as a Python package. The main disadvantage would be that users would have to install two things.
- I could put everything on CTAN, if there are satisfactory ways of dealing with all of my questions. That approach is preferable.
Summary
- I would like a way to install a
.py
or.bat
file as part of a package installation, so that it can be launched just as if it were an executable in TeX Live'sbin/
folder (since that folder is added to the system path). - This may be a restatement of the first point, but any elucidation of how TeX Live handles scripts would be very useful. For example,
sty2dtx
is a Perl script, but at least in the Windows installation of TeX Live, there is also asty2dtx.exe
underbin/
, which launches the Perl script. It would be nice to know if these binaries are coming from package authors or TeX Live. I suspect TeX Live (at least forsty2dtx
, there is no.exe
on CTAN). - Unless I also publish a separate Python package, I need a way to get the full path to where a LaTeX package is installed, based just on knowing the package name, so my programs can find the Python files that must be imported.
SympyTeX
: elec.otago.ac.nz/w/index.php/SympyTeX, which integrates sympy and LaTeX but can also be used for plain python.