pandoc / dockerfiles

Dockerfiles for various pandoc images
GNU General Public License v2.0
364 stars 98 forks source link

Use the latest pandoc-latex-environment version in pandoc/extra/requirements.txt #220

Closed princefishthrower closed 4 months ago

princefishthrower commented 9 months ago

Hi all, my team and I discovered that the pandoc/extra image is using a very old (2 years+) version of pandoc-latex-environment, looks like the 1.1.0.0 version:

https://github.com/pandoc/dockerfiles/blob/61b1fbf7355923f817b447301543d40316eea9c2/common/extra/requirements.txt#L8

The latest of pandoc-latex-environment appears to be 1.1.6.2 (from July 2023)... I think the fix here is to simply modify the == to >=

daamien commented 4 months ago

yes what was actually meant is pandoc-latex-environment==1.1.* : we want to freeze the major version and still get the minor patches.

daamien commented 4 months ago

@tarleb : Seems like moving to pipx broke something. The filter is not found in the latest image

I believe the problem comes form this commit: https://github.com/pandoc/dockerfiles/commit/fe78ac352544cd426cf0eccaec82b1a686eead5b

docker run --rm --volume "$(pwd):/data" pandoc/extra README.md --filter pandoc-latex-environment                   
Error running filter pandoc-latex-environment: 
Could not find executable pandoc-latex-environment

Version 3.1 works fine


docker run --rm --volume "$(pwd):/data" pandoc/extra:3.1 README.md --filter pandoc-latex-environment
tarleb commented 4 months ago

Sorry, my bad. I don't really know how to install this properly, the previous installation method lead to a build error. I don't know much about pip, unfortunately.

daamien commented 4 months ago

@tarleb I am very confused by this new pipx thing too 😅

In other images, I tend to use pip with the --break-system-packages option. It sounds bad, but it works and since nobody's gonna use the python system package of this image, I'd say "we don't care" if they're broken :)

daamien commented 4 months ago

Ok so pipx install the filter in /root/.local/bin/

docker run -it --entrypoint=sh pandoc/extra
/data # pipx install pandoc-latex-environment 
/data # ls /root/.local/bin
pandoc-latex-environment                                                                                             
/data # echo 'plop' | pandoc --filter pandoc-latex-environment                                                       
Error running filter pandoc-latex-environment:                                                                       
Could not find executable pandoc-latex-environment                                                                   
/data # echo 'plop' | pandoc --filter /root/.local/bin/pandoc-latex-environment
<p>plop</p>                                                                                                          
/data #

I guess we just need to add /root/.local/bin/ to the PATH

tarleb commented 4 months ago

I'm ok with either of these options :smile:

Do you want to write a fix, or should I try?

tarleb commented 4 months ago

Option 3: we re-write this as a Lua filter. Then we wouldn't need to install Python, but would need to find a way to make it easy to use.

Of the other two options, I think I lean towards --break-system-packages, it seems the easiest and not too terrible.

I'm going to spend some time on #127, maybe that will help.

daamien commented 4 months ago

yes afaik the --break-system-packages solution is the simplest approach. It's just the same install method as before but with an explicit option to allow it...

In other words, in previous versions we were already "breaking system packages" 😈 . We were simply breaking them silently and nobody ever complained about it.

I can try to fix that later today or tomorrow...

daamien commented 4 months ago

And btw the lua-filters are pretty cool, it would be a nice addition to the extra image.

But I think rewriting the pandoc-latex-environment filter in lua is NOT in the scope of this project... Plus we might have to add other Python filters sooner or later...