Skip to content

Does not work under Python 3.9 (likely any version <3.12) because of wrong usage of importlib.metadata.entry_points #83

Description

@arnauldvm

See https://github.com/NiklasRosenstein/python-databind/blob/4.5.4/databind/src/databind/core/union.py#L14-L20

The function importlib.metadata.entry_points accepts an argument only since Python 3.12
(as shown here (3.11) and here (3.12))

Issue with Python 3.9 likely exists since 4.5.3

This should either be fixed, or the minimal version of Python that is compatible should be adapted (pyproject.toml currently says: requires-python = ">=3.8").

Here my stack trace:

(...)
  File "...../lib64/python3.9/site-packages/pydoc_markdown/__init__.py", line 120, in load_config
    result = databind.json.load(
  File "...../lib64/python3.9/site-packages/databind/json/__init__.py", line 66, in load
    return get_object_mapper().deserialize(value, type_, filename, settings)
  File "...../lib64/python3.9/site-packages/databind/core/mapper.py", line 104, in deserialize
    self.convert(Direction.DESERIALIZE, value, datatype, Location(filename, None, None), settings),
  File "...../lib64/python3.9/site-packages/databind/core/mapper.py", line 76, in convert
    return context.convert()
  File "...../lib64/python3.9/site-packages/databind/core/context.py", line 123, in convert
    return self.convert_func(self)
  File "...../lib64/python3.9/site-packages/databind/core/converter.py", line 84, in convert
    return converter.convert(ctx)
  File "...../lib64/python3.9/site-packages/databind/core/converter.py", line 45, in convert
    return self.deserialize(ctx)
  File "...../lib64/python3.9/site-packages/databind/json/converters.py", line 619, in deserialize
    return self.deserialize_from_schema(ctx, schema)
  File "...../lib64/python3.9/site-packages/databind/json/converters.py", line 600, in deserialize_from_schema
    value = ctx.spawn(container[field_name], field.datatype, field_name).convert()
  File "...../lib64/python3.9/site-packages/databind/core/context.py", line 123, in convert
    return self.convert_func(self)
  File "...../lib64/python3.9/site-packages/databind/core/converter.py", line 84, in convert
    return converter.convert(ctx)
  File "...../lib64/python3.9/site-packages/databind/json/converters.py", line 161, in convert
    values = list(values)
  File "...../lib64/python3.9/site-packages/databind/json/converters.py", line 147, in <genexpr>
    ctx.spawn(val, item_type, idx).convert()
  File "...../lib64/python3.9/site-packages/databind/core/context.py", line 123, in convert
    return self.convert_func(self)
  File "...../lib64/python3.9/site-packages/databind/core/converter.py", line 84, in convert
    return converter.convert(ctx)
  File "...../lib64/python3.9/site-packages/databind/json/converters.py", line 814, in convert
    member_type = union.members.get_type_by_id(member_name)
  File "...../lib64/python3.9/site-packages/databind/core/union.py", line 268, in get_type_by_id
    return delegate.get_type_by_id(type_id)
  File "...../lib64/python3.9/site-packages/databind/core/union.py", line 182, in get_type_by_id
    return self._entrypoints[type_id].load()
  File "...../lib64/python3.9/site-packages/databind/core/union.py", line 170, in _entrypoints
    for ep in iter_entry_points(self.group):
  File "...../lib64/python3.9/site-packages/databind/core/union.py", line 22, in iter_entry_points
    return iter(entry_points(group=group))
TypeError: entry_points() got an unexpected keyword argument 'group'

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions