landslide icon indicating copy to clipboard operation
landslide copied to clipboard

Python v3.10?

Open virtadpt opened this issue 3 years ago • 6 comments

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

virtadpt avatar Jul 06 '22 00:07 virtadpt

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

Is Landslide broken on Python v3.10?

adamzap avatar Jul 06 '22 01:07 adamzap

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

virtadpt avatar Jul 06 '22 18:07 virtadpt

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.

virtadpt avatar Jul 08 '22 00:07 virtadpt

I got same errors and broken.

metapost avatar Aug 01 '22 09:08 metapost

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

adamzap avatar Aug 01 '22 23:08 adamzap

update the copy of Jinja2 you're using.

nega0 avatar Sep 15 '22 17:09 nega0

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)

nobicycle avatar Jan 06 '23 08:01 nobicycle

Same here.

update the copy of Jinja2 you're using.

It's not possible because of: https://github.com/adamzap/landslide/blob/675dd4dd7123b1fe013c41ebd3ed0321a7ad1833/setup.py#L25-L32 :(

jedie avatar Jan 18 '23 15:01 jedie

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

kurtlawrence avatar Feb 14 '23 05:02 kurtlawrence

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

adamzap avatar Feb 14 '23 13:02 adamzap

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

virtadpt avatar Feb 14 '23 14:02 virtadpt

Thanks!

adamzap avatar Feb 14 '23 14:02 adamzap

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

Seems to work for my limited use case.

kurtlawrence avatar Feb 15 '23 05:02 kurtlawrence

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

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

adamzap avatar Mar 24 '23 04:03 adamzap

I'll test it later today - thanks!

virtadpt avatar Mar 24 '23 17:03 virtadpt