Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Distribute latexminted binary as binary to ease the configuration at user's end #427

Open
TLCFEM opened this issue Dec 19, 2024 · 6 comments

Comments

@TLCFEM
Copy link

TLCFEM commented Dec 19, 2024

Having a python environment ready and pip install the required package could be cumbersome for some users.
For Windows it is even more complex.

Maybe it would help users if the latexminted binary can be distributed.
Then one just download the binary and place it in PATH, no need to manually configure the python environment, this may avoid a lot of hassles.

By creating latexminted.py under folder /python with the content.

from latexminted.cmdline import main

if __name__ == "__main__":
    main()

And then installing pyinstaller and call

pyinstaller -F ./latexminted.py

One can get an executable to get things running.

This procedure shall be relatively easy with CICD workflows.

Maybe you can consider this.
I can submit a PR if you like the idea.

@gpoore
Copy link
Owner

gpoore commented Dec 20, 2024

With TeX Live, a latexminted executable is bundled with the LaTeX package and installed with it, so there is no separate Python installation step.

There is a bug in the way that MiKTeX has packaged minted, but whenever that is resolved, MiKTeX should work in the same way, with no separate Python installation step.

@TLCFEM
Copy link
Author

TLCFEM commented Dec 20, 2024

There is no issue with texlive after recent transition.

There is a MiKTeX/miktex#1538 in the way that MiKTeX has packaged minted, but whenever that is resolved, MiKTeX should work in the same way, with no separate Python installation step.

Do you know how that is achieved, I do not think miktex ships with a python environment as there is no python.exe found anywhere related to miktex.
So I presume an executable needs to be generated, either for miktex to bundle it, or being uploaded to ctan.

For v2, it has been complaining about missing the pygmentize executable with miktex, which made me manually prepare the executable previously.

@muzimuzhi
Copy link
Contributor

@TLCFEM What minted v3 provides is a Python "executable" (not a real platform-specific no-runtime binary), which still needs a user installation of Python 3.8+. This is documented in the sec. 2.1 "Package manager" of package manual:

When the minted package is installed, it includes the latexminted Python executable
and all required Python libraries including Pygments. For these to function correctly, Python 3.8+ must be installed and on PATH when the latexminted executable runs.

@TLCFEM
Copy link
Author

TLCFEM commented Dec 20, 2024

@TLCFEM What minted v3 provides is a Python "executable" (not a real platform-specific no-runtime binary), which still needs a user installation of Python 3.8+. This is documented in the sec. 2.1 "Package manager" of package manual:

When the minted package is installed, it includes the latexminted Python executable
and all required Python libraries including Pygments. For these to function correctly, Python 3.8+ must be installed and on PATH when the latexminted executable runs.

That's why I think it is cumbersome for 2 reasons: 1) users need to install a python environment and make it available in PATH, 2) it does not support venv.

pyinstaller packs the runtime into a single executable, which is self-contained, which appears to be simpler to me compared to requiring a global python environment.

@muzimuzhi
Copy link
Contributor

That's why I think it is cumbersome for 2 reasons: 1) users need to install a python environment and make it available in PATH, 2) it does not support venv.

It seems venv is supported on macOS. Maybe things are different on Windows?

# versions provided by TeX Live
$ latexminted --version | grep Libraries
Libraries: latex2pydata 0.4.0, latexrestricted 0.6.0, pygments 2.18.0

$ mkdir minted-venv-test
$ cd minted-venv-test
$ python3 -m venv .venv
$ source .venv/bin/activate
# install different versions
$ pip3 install pygments==2.17.0 latexminted==0.3.0
$ latexminted --version | grep Libraries
Libraries: latex2pydata 0.4.1, latexrestricted 0.6.2, pygments 2.17.0

@TLCFEM
Copy link
Author

TLCFEM commented Dec 20, 2024

That's why I think it is cumbersome for 2 reasons: 1) users need to install a python environment and make it available in PATH, 2) it does not support venv.

It seems venv is supported on macOS. Maybe things are different on Windows?

# versions provided by TeX Live
$ latexminted --version | grep Libraries
Libraries: latex2pydata 0.4.0, latexrestricted 0.6.0, pygments 2.18.0

$ mkdir minted-venv-test
$ cd minted-venv-test
$ python3 -m venv .venv
$ source .venv/bin/activate
# install different versions
$ pip3 install pygments==2.17.0 latexminted==0.3.0
$ latexminted --version | grep Libraries
Libraries: latex2pydata 0.4.1, latexrestricted 0.6.2, pygments 2.17.0

I mean bundling python files with the package does not allow users to user different venvs with ease. venv itself is for sure supported.
One shall for example activate the venv before compiling latex, if one wants to avoid the global python environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants