texlive[76135] Master/texmf-dist: pythonimmediate (24aug25)

commits+karl at tug.org commits+karl at tug.org
Sun Aug 24 22:50:37 CEST 2025


Revision: 76135
          https://tug.org/svn/texlive?view=revision&revision=76135
Author:   karl
Date:     2025-08-24 22:50:37 +0200 (Sun, 24 Aug 2025)
Log Message:
-----------
pythonimmediate (24aug25)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/pythonimmediate/README
    trunk/Master/texmf-dist/doc/latex/pythonimmediate/pythonimmediate.pdf
    trunk/Master/texmf-dist/doc/latex/pythonimmediate/pythonimmediate.tex
    trunk/Master/texmf-dist/tex/latex/pythonimmediate/pythonimmediate.sty

Modified: trunk/Master/texmf-dist/doc/latex/pythonimmediate/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/pythonimmediate/README	2025-08-24 20:49:57 UTC (rev 76134)
+++ trunk/Master/texmf-dist/doc/latex/pythonimmediate/README	2025-08-24 20:50:37 UTC (rev 76135)
@@ -7,7 +7,7 @@
 
 ========
 
-Copyright 2022-2024 user202729
+Copyright 2022-2025 user202729
 
 This work  may be  distributed and/or  modified under  the conditions  of the
 LaTeX Project Public License (LPPL),  either version 1.3c  of this license or

Modified: trunk/Master/texmf-dist/doc/latex/pythonimmediate/pythonimmediate.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/pythonimmediate/pythonimmediate.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/pythonimmediate/pythonimmediate.tex	2025-08-24 20:49:57 UTC (rev 76134)
+++ trunk/Master/texmf-dist/doc/latex/pythonimmediate/pythonimmediate.tex	2025-08-24 20:50:37 UTC (rev 76135)
@@ -1,4 +1,4 @@
-\ProvidesFile{pythonimmediate.tex}[2024/01/18 0.5.0 Library to run Python code]
+\ProvidesFile{pythonimmediate.tex}[2025/08/24 0.6.0 Library to run Python code]
 \RequirePackage{fvextra}
 \documentclass{l3doc}
 \usepackage{tikz}
@@ -55,7 +55,7 @@
 installation instruction can be found at \url{https://pypi.org/project/pythonimmediate-tex/}.
 
 Note that not all \TeX\ package versions are compatible with all Python package versions.
-This \TeX\ package is compatible with Python package version |0.6.0|.
+This \TeX\ package is compatible with Python package version |0.7.2|.
 
 Remember to enable unrestricted\footnote{
 	There's little point in supporting restricted mode, since it's possible to execute arbitrary shell commands in Python anyway.
@@ -77,9 +77,9 @@
 		\begin{itemize}
 			\item \file{pythonimmediate.sty}
 			\item \file{pythonimmediate_helper.lua}
-			\item \file{pythonimmediate-tex-0.6.0.zip}
+			\item \file{pythonimmediate_tex-0.7.2.zip}
 		\end{itemize}
-		The |0.6.0| part should be replaced with the desired version
+		The |0.7.2| part should be replaced with the desired version
 		of the Python package.
 
 		The |.sty| files can be downloaded from CTAN at 
@@ -97,12 +97,12 @@
 		\end{itemize}
 		Also place in the root folder of Overleaf.
 
-	\item Write the following in the preamble:
+	\item Write the following in the preamble (be careful of stray characters if you copy and paste from PDF):
 \begin{verbatim}
 \usepackage[abspath]{currfile}
-\usepackage[python-executable={PYTHONPATH=pythonimmediate-tex-0.6.0.zip/pythonimmediate-tex-0.6.0/ python3},args={--mode=unnamed-pipe}]{pythonimmediate}
+\usepackage[python-executable={PYTHONPATH=pythonimmediate_tex-0.7.2.zip/pythonimmediate_tex-0.7.2/ python3},args={--mode=unnamed-pipe}]{pythonimmediate}
 \end{verbatim}
-As above, replace both occurrences of |0.6.0| with the downloaded version specified in the zip file above.
+As above, replace both occurrences of |0.7.2| with the downloaded version specified in the zip file above.
 
 Refer to \cref{troubleshoot-source-file-not-found} for explanation of the |abspath| option.
 \end{itemize}

Modified: trunk/Master/texmf-dist/tex/latex/pythonimmediate/pythonimmediate.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/pythonimmediate/pythonimmediate.sty	2025-08-24 20:49:57 UTC (rev 76134)
+++ trunk/Master/texmf-dist/tex/latex/pythonimmediate/pythonimmediate.sty	2025-08-24 20:50:37 UTC (rev 76135)
@@ -1,5 +1,5 @@
 % File: pythonimmediate.sty
-% Copyright 2022-2024 user202729
+% Copyright 2022-2025 user202729
 %
 % This work  may be  distributed and/or  modified under  the conditions  of the
 % LaTeX Project Public License (LPPL),  either version 1.3c  of this license or
@@ -12,7 +12,7 @@
 % 
 % The Current Maintainer of this work is user202729.
 
-\ProvidesExplPackage{pythonimmediate}{2024/01/18}{0.5.0}{Library to run Python code}
+\ProvidesExplPackage{pythonimmediate}{2025/08/24}{0.6.0}{Library to run Python code}
 
 \RequirePackage{saveenv}
 \PassOptionsToPackage{abspath}{currfile}  % try to enable abspath if possible (i.e. if package isn't loaded) but otherwise don't give option-clash error
@@ -37,6 +37,7 @@
 		\begingroup
 			\escapechar=-1~
 			\cC{set at display@protect}
+			\let  \cC{]} \relax
 			\let  \cA\~  \relax
 	}
 }
@@ -64,7 +65,9 @@
 
 \msg_new:nnn {pythonimmediate} {shell-fail} {Please~enable~unrestricted~shell~escape!}
 \msg_new:nnn {pythonimmediate} {process-start-error} {Cannot~start~Python~process!~
-	Make~sure~package~options~are~correct~and~the~Python~package~is~installed.}
+	Make~sure~package~options~are~correct~and~the~Python~package~is~installed.~
+	If~PYTHONPATH~is~used~to~specify~a~zip~file,~make~sure~the~name~is~correct,~
+	in~particular~whether~a~dash~or~an~underscore~should~be~used.}
 \msg_new:nnn {pythonimmediate} {internal-error} {Internal~error!}
 
 \sys_if_shell_unrestricted:F {
@@ -78,7 +81,7 @@
 
 \bool_if:NTF \_pythonimmediate_child_process {
 	% make read file read from stdin
-	% note that \ior_str_get:NN cannot be used here as it checks for \ifeof which breaks with terminal for some reason
+	% note that \ior_str_get:NN or \ior_get:NN cannot be used here as it checks for \ifeof which breaks with terminal for some reason
 	\int_const:Nn \_pythonimmediate_read_file {-1}
 } {
 	\newread \_pythonimmediate_read_file
@@ -95,8 +98,15 @@
 	}
 }
 
+% ======== copy of ior_get but does not check for file end ========
+\cs_new_protected:Npn \_pythonimmediate_get:N #1 {
+	\use_ii_i:on {\the\endlinechar\relax} {
+		\endlinechar=-1~
+		\read \_pythonimmediate_read_file to #1
+		\endlinechar=
+	}
+}
 
-
 % ======== setup write file ========
 \cs_new_protected:Npn \_pythonimmediate_send_content:e #1 {
 	\immediate\write \_pythonimmediate_write_file { #1 }
@@ -109,16 +119,31 @@
 	\cs_gset_protected:Npn \_pythonimmediate_send_content:e ##1 {}
 }
 
-\bool_if:NTF \_pythonimmediate_child_process {
-	\newwrite \_pythonimmediate_write_file
-	\sys_if_engine_luatex:TF {
-		% use Lua to write to stderr
+\sys_if_engine_luatex:TF {
+	% use Lua to write to stderr
+	\cs_new_protected:Npn \_pythonimmediate_open_write_child_process: {
 		\directlua{ (require "pythonimmediate_helper")() }
-	} {
+	}
+} {
+	\cs_new_protected:Npn \_pythonimmediate_open_write_child_process: {
 		%\immediate\openout \_pythonimmediate_write_file=symlink-to-stderr.txt~
 		% tried this method, it seems to work except that it's buffered when stderr is redirected to a file...
-		\immediate\openout \_pythonimmediate_write_file=|"\_pythonimmediate_python_executable \space \_pythonimmediate_python_flags \space -m ~ pythonimmediate.copy_to_stderr"~
+		\immediate\openout \_pythonimmediate_write_file=|"\_pythonimmediate_python_executable \space \_pythonimmediate_python_flags \space -m ~ pythonimmediatehelper.copy_to_stderr"~
 	}
+}
+
+\bool_if:NTF \_pythonimmediate_child_process {
+	\newwrite \_pythonimmediate_write_file
+	\_pythonimmediate_open_write_child_process:
+	\cs_new_protected:Npn \pythonimmediatechildprocessdump {
+		\everyjob\expandafter{
+			\the\everyjob
+			\_pythonimmediate_open_write_child_process:
+			\pythonimmediatelisten
+			\stop
+		}
+		\dump
+	}
 } {
 
 	\sys_if_engine_luatex:TF {



More information about the tex-live-commits mailing list.