devidw / obsidian-to-hugo

Process Obsidian notes to publish them with Hugo. Supports transformation of Obsidian wiki links into Hugo shortcodes for internal linking.
https://obsidian-to-hugo.wolf.gdn
MIT License
329 stars 23 forks source link

fix: type annotation issue with python 3.8 #15

Closed green-leader closed 1 year ago

green-leader commented 1 year ago

When running python -m obsidian_to_hugo --version from an appropriate venv this is returned:

Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 185, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/usr/lib/python3.8/runpy.py", line 144, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/usr/lib/python3.8/runpy.py", line 111, in _get_module_details
    __import__(pkg_name)
  File "/home/sion/Toybox/docs.int/venv/lib/python3.8/site-packages/obsidian_to_hugo/__init__.py", line 1, in <module>
    from .obsidian_to_hugo import ObsidianToHugo
  File "/home/sion/Toybox/docs.int/venv/lib/python3.8/site-packages/obsidian_to_hugo/obsidian_to_hugo.py", line 8, in <module>
    from .wiki_links_processor import replace_wiki_links
  File "/home/sion/Toybox/docs.int/venv/lib/python3.8/site-packages/obsidian_to_hugo/wiki_links_processor.py", line 12, in <module>
    def get_wiki_links(text: str) -> list[WikiLink]:
TypeError: 'type' object is not subscriptable

expected result is: obsidian-to-hugo 0.3.0

When using version 3.9 the different types are depreciated but as this is targeting any version newer than 3.6 it's neccesary to use the generics.

3.9 will not generate DeprecationWarnings

devidw commented 1 year ago

Thanks @green-leader