tobiasah / mkdocs-caption

MkDocs plugin to add captions and easy element numbering
MIT License
3 stars 2 forks source link

Typing issue in Python 3.8 #3

Closed dpad closed 9 months ago

dpad commented 9 months ago

When trying to run mkdocs build with mkdocs_caption==0.0.7 under Python 3.8, the following exception occurs:

File ".../lib/python3.8/site-packages/mkdocs_caption/logger.py", line 21, in PluginLogger
    ) -> tuple[str, t.Any]:
TypeError: 'type' object is not subscriptable

This is due to the use of tuple in the type hint, instead of Tuple (also needs from typing import Tuple).

tobiasah commented 9 months ago

😁 Very much appreciated that you reported this. I encountered the same issue yesterday as well and already fixed it on the main branch.

But instead of using t.Tuple[...] I imported from __future__ import annotations which allows using tuple[...] even in Python 3.8.

I plan to release a new version today but want to fix another issue in the same release.

Would you mind trying out the main version by installing the plugin directly from GitHub? Thus I can be sure that this works also for you.

dpad commented 9 months ago

Hi @tobiasah , thanks for your quick response (and for the great plugin of course). I've just tried your main version (0.0.8.dev1+gfc8d6e1) and yes, I confirm your change fixes it too :)

tobiasah commented 9 months ago

🎉 Thanks for the verification.

I will release a new version within the next hours and then close this issue.

tobiasah commented 9 months ago

Fixed with version 0.0.8