adamzap/landslide

Python v3.10?

Closed this issue · 15 comments

Are there any plans to update Landslide for Python v3.10?

I'm open to PRs. I should probably get the project switched to GitHub Actions first.

Is Landslide broken on Python v3.10?

Yes. Will retry after work today and post the error output.

Arch Linux, Python v3.10.5. Landslide installed into a venv using pip. Output follows:

(landslide) {17:42:56 @ Thu Jul 07}
[drwho @ windbringer ~] () $ landslide
Traceback (most recent call last):
  File "/home/drwho/landslide/bin/landslide", line 5, in <module>
    from landslide.main import main
  File "/home/drwho/landslide/lib/python3.10/site-packages/landslide/main.py", line 8, in <module>
    from . import generator
  File "/home/drwho/landslide/lib/python3.10/site-packages/landslide/generator.py", line 7, in <module>
    import jinja2
  File "/home/drwho/landslide/lib/python3.10/site-packages/jinja2/__init__.py", line 33, in <module>
    from jinja2.environment import Environment, Template
  File "/home/drwho/landslide/lib/python3.10/site-packages/jinja2/environment.py", line 16, in <module>
    from jinja2.defaults import BLOCK_START_STRING, \
  File "/home/drwho/landslide/lib/python3.10/site-packages/jinja2/defaults.py", line 32, in <module>
    from jinja2.tests import TESTS as DEFAULT_TESTS
  File "/home/drwho/landslide/lib/python3.10/site-packages/jinja2/tests.py", line 13, in <module>
    from collections import Mapping
ImportError: cannot import name 'Mapping' from 'collections' (/usr/lib/python3.10/collections/__init__.py)

Output happens when just running landslide by itself, with --help, or when trying to compile a Markdown doc into slides.

I got same errors and broken.

I'll try to address this sometime in the near future. I'm open to PRs as well!

nega0 commented

update the copy of Jinja2 you're using.

Same here:

pip install landslide
Collecting landslide
  Using cached landslide-1.1.9-py3-none-any.whl (100 kB)
Collecting six==1.11.0
  Using cached six-1.11.0-py2.py3-none-any.whl (10 kB)
Collecting Markdown==2.6.11
  Using cached Markdown-2.6.11-py2.py3-none-any.whl (78 kB)
Collecting docutils==0.14
  Using cached docutils-0.14-py3-none-any.whl (543 kB)
Collecting Jinja2==2.10.1
  Using cached Jinja2-2.10.1-py2.py3-none-any.whl (124 kB)
Collecting MarkupSafe==1.1.1
  Using cached MarkupSafe-1.1.1-cp310-cp310-linux_x86_64.whl
Collecting Pygments==2.2.0
  Using cached Pygments-2.2.0-py2.py3-none-any.whl (841 kB)
Installing collected packages: six, Pygments, Markdown, docutils, MarkupSafe, Jinja2, landslide
Successfully installed Jinja2-2.10.1 Markdown-2.6.11 MarkupSafe-1.1.1 Pygments-2.2.0 docutils-0.14 landslide-1.1.9 six-1.11.0
2023-01-06 08:07:39 [INFO] Disk space used ...
30M	.
[user@tower Python]$ . bin/activate
bash: bin/activate: No such file or directory
[user@tower Python]$ cd landslide/
[user@tower landslide]$ . bin/activate
(landslide) [user@tower landslide]$ landslide  -h
Traceback (most recent call last):
  File "/home/user/Development/Python/landslide/bin/landslide", line 5, in <module>
    from landslide.main import main
  File "/home/user/Development/Python/landslide/lib/python3.10/site-packages/landslide/main.py", line 8, in <module>
    from . import generator
  File "/home/user/Development/Python/landslide/lib/python3.10/site-packages/landslide/generator.py", line 7, in <module>
    import jinja2
  File "/home/user/Development/Python/landslide/lib/python3.10/site-packages/jinja2/__init__.py", line 33, in <module>
    from jinja2.environment import Environment, Template
  File "/home/user/Development/Python/landslide/lib/python3.10/site-packages/jinja2/environment.py", line 16, in <module>
    from jinja2.defaults import BLOCK_START_STRING, \
  File "/home/user/Development/Python/landslide/lib/python3.10/site-packages/jinja2/defaults.py", line 32, in <module>
    from jinja2.tests import TESTS as DEFAULT_TESTS
  File "/home/user/Development/Python/landslide/lib/python3.10/site-packages/jinja2/tests.py", line 13, in <module>
    from collections import Mapping
ImportError: cannot import name 'Mapping' from 'collections' (/usr/lib/python3.10/collections/__init__.py)

jedie commented

Same here.

update the copy of Jinja2 you're using.

It's not possible because of:

landslide/setup.py

Lines 25 to 32 in 675dd4d

install_requires=[
'MarkupSafe==1.1.1',
'Jinja2==2.10.1',
'Markdown==2.6.11',
'Pygments==2.2.0',
'docutils==0.14',
'six==1.11.0'
],
:(

If you edit setup.py such that:

++    'Jinja2==3.1.2'
--    'Jinja2==2.10.1'

And install via:

python setup.py build
sudo python setup.py install

It works (using Python 3.10).

I also made sure my Jinja2 install was up to date:

pip install -U jinja2

Any idea if this is a safe upgrade? Will anything break?

I don't know - I'll try it later this week when I get home.

Thanks!

Any idea if this is a safe upgrade? Will anything break?

Seems to work for my limited use case.

I released v2.0.0 to fix this. Please let me know if you have issues!

https://pypi.org/project/landslide/

I'll test it later today - thanks!