Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: databind.core.converter.NoMatchingConverter #291

Closed
casperdcl opened this issue Jun 6, 2023 · 8 comments
Closed

error: databind.core.converter.NoMatchingConverter #291

casperdcl opened this issue Jun 6, 2023 · 8 comments
Assignees
Labels

Comments

@casperdcl
Copy link
Contributor

casperdcl commented Jun 6, 2023

Environment

  • Pydoc-Markdown Version: v4.8.0
  • Python Version: v3.11.3
  • Operating System: GHA ubuntu-latest

Describe the bug

v4.7.0 works fine. v4.8.0 (#289) results in:

Traceback (most recent call last):
...
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/pydoc_markdown/main.py", line 117, in load
    config.load_config(self.config)
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/pydoc_markdown/__init__.py", line 113, in load_config
    result = databind.json.load(
             ^^^^^^^^^^^^^^^^^^^
...
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/core/converter.py", line 87, in convert
    raise NoMatchingConverter(self, ctx, errors)
databind.core.converter.NoMatchingConverter: no deserializer for `TypeHint(~T_Page)` and payload of type `dict`

Trace:
  In "pydoc-markdown.yml"
    $: TypeHint(pydoc_markdown.PydocMarkdown)
    .renderer: TypeHint(pydoc_markdown.interfaces.Renderer)
    ^: TypeHint(pydoc_markdown.contrib.renderers.mkdocs.MkdocsRenderer)
    .pages: TypeHint(pydoc_markdown.util.pages.Pages[pydoc_markdown.util.pages.Page])
    [2]: TypeHint(pydoc_markdown.util.pages.Page)
    .children: TypeHint(typing.List[~T_Page])
    [0]: TypeHint(~T_Page)
full trace
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.11.3/x64/bin/pydoc-markdown", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/pydoc_markdown/main.py", line 371, in cli
    pydocmd = session.load()
              ^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/pydoc_markdown/main.py", line 117, in load
    config.load_config(self.config)
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/pydoc_markdown/__init__.py", line 113, in load_config
    result = databind.json.load(
             ^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/json/__init__.py", line 67, in load
    return get_object_mapper().deserialize(value, type_, filename, settings)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/core/mapper.py", line 104, in deserialize
    self.convert(Direction.DESERIALIZE, value, datatype, Location(filename, None, None), settings),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/core/mapper.py", line 76, in convert
    return context.convert()
           ^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/core/context.py", line 123, in convert
    return self.convert_func(self)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/core/converter.py", line 86, in convert
    raise errors[0][1]
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/core/converter.py", line 80, in convert
    return converter.convert(ctx)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/core/converter.py", line 86, in convert
    raise errors[0][1]
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/core/converter.py", line 80, in convert
    return converter.convert(ctx)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/core/converter.py", line 45, in convert
    return self.deserialize(ctx)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/json/converters.py", line 561, in deserialize
    value = ctx.spawn(container[field_name], field.datatype, field_name).convert()
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/core/context.py", line 123, in convert
    return self.convert_func(self)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/core/converter.py", line 86, in convert
    raise errors[0][1]
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/core/converter.py", line 80, in convert
    return converter.convert(ctx)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/core/converter.py", line 86, in convert
    raise errors[0][1]
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/core/converter.py", line 80, in convert
    return converter.convert(ctx)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/json/converters.py", line 789, in convert
    result = child_context.convert()
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/core/context.py", line 123, in convert
    return self.convert_func(self)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/core/converter.py", line 86, in convert
    raise errors[0][1]
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/core/converter.py", line 80, in convert
    return converter.convert(ctx)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/core/converter.py", line 86, in convert
    raise errors[0][1]
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/core/converter.py", line 80, in convert
    return converter.convert(ctx)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/core/converter.py", line 45, in convert
    return self.deserialize(ctx)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/json/converters.py", line 561, in deserialize
    value = ctx.spawn(container[field_name], field.datatype, field_name).convert()
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/core/context.py", line 123, in convert
    return self.convert_func(self)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/core/converter.py", line 86, in convert
    raise errors[0][1]
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/core/converter.py", line 80, in convert
    return converter.convert(ctx)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/core/converter.py", line 86, in convert
    raise errors[0][1]
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/core/converter.py", line 80, in convert
    return converter.convert(ctx)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/json/converters.py", line 129, in convert
    values = list(values)
             ^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/json/converters.py", line 115, in <genexpr>
    ctx.spawn(val, item_type, idx).convert()
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/core/context.py", line 123, in convert
    return self.convert_func(self)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/core/converter.py", line 86, in convert
    raise errors[0][1]
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/core/converter.py", line 80, in convert
    return converter.convert(ctx)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/core/converter.py", line 86, in convert
    raise errors[0][1]
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/core/converter.py", line 80, in convert
    return converter.convert(ctx)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/core/converter.py", line 45, in convert
    return self.deserialize(ctx)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/json/converters.py", line 561, in deserialize
    value = ctx.spawn(container[field_name], field.datatype, field_name).convert()
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/core/context.py", line 123, in convert
    return self.convert_func(self)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/core/converter.py", line 86, in convert
    raise errors[0][1]
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/core/converter.py", line 80, in convert
    return converter.convert(ctx)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/core/converter.py", line 86, in convert
    raise errors[0][1]
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/core/converter.py", line 80, in convert
    return converter.convert(ctx)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/json/converters.py", line 129, in convert
    values = list(values)
             ^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/json/converters.py", line 115, in <genexpr>
    ctx.spawn(val, item_type, idx).convert()
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/core/context.py", line 123, in convert
    return self.convert_func(self)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/core/converter.py", line 86, in convert
    raise errors[0][1]
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/core/converter.py", line 80, in convert
    return converter.convert(ctx)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/databind/core/converter.py", line 87, in convert
    raise NoMatchingConverter(self, ctx, errors)
databind.core.converter.NoMatchingConverter: no deserializer for `TypeHint(~T_Page)` and payload of type `dict`

Trace:
  In "pydoc-markdown.yml"
    $: TypeHint(pydoc_markdown.PydocMarkdown)
    .renderer: TypeHint(pydoc_markdown.interfaces.Renderer)
    ^: TypeHint(pydoc_markdown.contrib.renderers.mkdocs.MkdocsRenderer)
    .pages: TypeHint(pydoc_markdown.util.pages.Pages[pydoc_markdown.util.pages.Page])
    [2]: TypeHint(pydoc_markdown.util.pages.Page)
    .children: TypeHint(typing.List[~T_Page])
    [0]: TypeHint(~T_Page)
@mcarans
Copy link

mcarans commented Jun 9, 2023

I have this error too. It doesn't happen with 4.7.0. Seems to be a problem with the databind upgrade.

casperdcl added a commit to AMYPAD/NumCu that referenced this issue Jun 11, 2023
casperdcl added a commit to iterative/shtab that referenced this issue Jun 12, 2023
@NiklasRosenstein
Copy link
Owner

Thanks for reporting; this is indeed a bug in databind. Turns out the unit tests do not cover the serialization sufficiently, which I'll address as well.

casperdcl added a commit to iterative/shtab that referenced this issue Jun 12, 2023
@mcarans
Copy link

mcarans commented Jun 21, 2023

@NiklasRosenstein Do the problem(s) with databind render 4.8.0 unusable for many people or are these just edge cases that affect a few? If the former, please can you consider pulling 4.8.0 from PyPI so that pinning to 4.7.0 isn't needed as I have multiple projects (that call pydoc-markdown from readthedocs) that I need to change if I have to add a pin.

@NiklasRosenstein
Copy link
Owner

Hey @mcarans, it does affect everyone that defines their own pages with the Mkdocs renderer. 🙈 What you suggest would've been a good call indeed, esp. given that I needed some time to find time to fix this.

But it's fixed now finally. As soon as #294 get's merged, I'll make a 4.8.1 release.

@NiklasRosenstein
Copy link
Owner

4.8.1 released 🚀

@mcarans
Copy link

mcarans commented Jun 22, 2023

Thanks @NiklasRosenstein !

@casperdcl
Copy link
Contributor Author

Follow-up: pre-render hooks aren't working now

@NiklasRosenstein
Copy link
Owner

@casperdcl Thanks for reporting; unfortunately another issue introduced with the Databind upgrade. Fixed in #295 and released as 4.8.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants