chirun-ncl / chirun

A Python package providing the command line interface for building flexible and accessible content with Chirun.
https://chirun.org.uk/
Other
29 stars 4 forks source link

TypeError: BlockHtmlFormatter.wrap() missing 1 required positional argument: 'outfile' #130

Closed aarchiba closed 2 years ago

aarchiba commented 2 years ago

I tried following the install instructions (conda version): https://chirun.readthedocs.io/en/latest/getting_started/cli/install.html and ran into trouble.

To avoid #129 I used pip install "Jinja2<=3.0.0", but now I receive:

TypeError: BlockHtmlFormatter.wrap() missing 1 required positional argument: 'outfile'

This appears to be some kind of version problem with pygments: https://github.com/squidfunk/mkdocs-material/issues/3840

I am using the version of pygments that bug report cites as the most current but the bug report suggests that some package that is calling pygments might be triggering the problem?

Output of pip freeze:

appdirs==1.4.4
arrow==1.2.2
attrs==21.4.0
beautifulsoup4==4.11.1
bleach==5.0.1
bs4==0.0.1
certifi==2022.6.15
charset-normalizer==2.1.0
chirun @ git+https://github.com/chirun-ncl/chirun.git@45897319d5203b9867b5d6e00b2db1aa90a6580c
defusedxml==0.7.1
entrypoints==0.4
fastjsonschema==2.15.3
funcsigs==1.0.2
idna==3.3
importlib-metadata==4.12.0
iniconfig==1.1.1
Jinja2==3.0.0
jinja2-time==0.2.0
jsonschema==4.6.2
jupyter-client==7.3.4
jupyter-core==4.11.1
jupyterlab-pygments==0.2.2
lxml==4.9.1
Markdown==3.1.1
markdown-figure==0.0.1
MarkupSafe==2.1.1
mistune==0.8.4
mock==4.0.3
nbclient==0.6.6
nbconvert==6.5.0
nbformat==5.4.0
nest-asyncio==1.5.5
notedown==1.5.1
olefile==0.46
packaging==21.3
pandoc-attributes==0.1.7
pandocfilters==1.5.0
pbr==5.9.0
Pillow==9.2.0
plasTeX==2.1
pluggy==1.0.0
py==1.11.0
pyee==8.2.2
Pygments==2.12.0
pymdown-extensions==6.0
pyoembed==0.1.2
pyparsing==3.0.9
PyPDF2==2.4.2
pyppeteer==1.0.2
pyrsistent==0.18.1
pytest==7.1.2
python-dateutil==2.8.2
PyYAML==6.0
pyzmq==23.2.0
requests==2.28.1
six==1.16.0
soupsieve==2.3.2.post1
tinycss2==1.1.1
tomli==2.0.1
tornado==6.2
tqdm==4.64.0
traitlets==5.3.0
typing_extensions==4.3.0
Unidecode==1.3.4
urllib3==1.26.10
webencodings==0.5.1
websockets==10.3
zipp==3.8.0

Additionally doing pip install "Pygments<2.12.0" seems to have fixed the problem.

christianp commented 2 years ago

It looks like markdown and pymarkdown-extensions aren't properly pinned, so the version of pymarkdown-extensions that gets installed is incompatible with a breaking change in markdown.

This can be fixed quickly by pinning exact versions, but I'm trying to see what needs to happen to upgrade everything to the latest version. Once I've done that, I'll pin to exact versions.

christianp commented 2 years ago

Note for myself: plasTeX hasn't tagged a new release since 2019, but the current master branch has been updated to work with jinja2 3.1. I've opened plastex/plastex#292 to prod them to make a new release.

georgestagg commented 2 years ago

Just a quick note to say that I had implemented a lot of functionality in Chirun by overriding specifically that old version of plasTeX's behaviour with monkey patching. That's what a fair amount of the contents of the chirun/plastex directory does, particularly chirun/plastex/overrides.

IIRC upgrading to the as-yet-untagged version of plasTeX>=3.0 will not only involve API changes but you'll also need to remove no-longer-required patches that are new merged into plasTeX's main branch (e.g. the tikz packages and supporting imagers), and/or re-work patches I had made for the old plasTeX v2.1 to work with the new version.

I had clearly made an attempt at an upgrade to v3 at some point in 2020 (See https://github.com/chirun-ncl/chirun/tree/plastex3/), but it will now be behind and I forget how successful I was.

christianp commented 2 years ago

Thanks, @georgestagg! I suppose getting rid of the overrides will be easier once the plasTeX team document their changes.

I made pretty good progress, which I've committed in a branch called updated-2022. I diffed the output of the sample course on this version and the current master branch, and the big problems I noticed were the runnable environment in markdown, and the revtex documentclass, but it does compile. I reckon it'd take another day or two to get there.

We really need some unit tests! I will set New George on that once we know who that is!

christianp commented 2 years ago

I've tagged a version v0.7.1 which pins exact versions of the dependencies, so avoiding this error.