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

Autogmatic class generation for AlignedDynamicTable fails #554

Open
5 tasks done
oruebel opened this issue Apr 6, 2021 · 0 comments
Open
5 tasks done

Autogmatic class generation for AlignedDynamicTable fails #554

oruebel opened this issue Apr 6, 2021 · 0 comments
Labels
category: bug errors in the code or code behavior priority: low alternative solution already working and/or relevant to only specific user(s) topic: extension issues related to extensions or dynamic class generation

Comments

@oruebel
Copy link
Contributor

oruebel commented Apr 6, 2021

Description

This issue has come up as part of #551 to integrated AlignedDynamicTable which is a DynamicTable that itself contains other DynamicTable objects. Due #553 integrating AlignedDynamicTable triggered the automatic class generation for that type. The automatic class generation for AlignedDynamicTable , however, fails on the current HDMF dev branch. It appears that the automatic class generation attempts to use both DynamicTable and MultiContainerInterface as a base type for AlignedDynamicTable which appear to result into a conflict with regard to method resolution order. Specifically the type of error I am seeing is:

ImportError: Failed to import test module: validator_tests.test_validate
Traceback (most recent call last):
  File "/Users/oruebel/anaconda3/envs/icephys-port/lib/python3.8/unittest/loader.py", line 436, in _find_test_path
    module = self._get_module_from_name(name)
  File "/Users/oruebel/anaconda3/envs/icephys-port/lib/python3.8/unittest/loader.py", line 377, in _get_module_from_name
    __import__(name)
  File "/Users/oruebel/Devel/nwb/icephys_extensions/port_to_nwb/hdmf/tests/unit/validator_tests/test_validate.py", line 10, in <module>
    from hdmf.testing import TestCase
  File "/Users/oruebel/Devel/nwb/icephys_extensions/port_to_nwb/hdmf/src/hdmf/testing/__init__.py", line 1, in <module>
    from .testcase import TestCase, H5RoundTripMixin  # noqa: F401
  File "/Users/oruebel/Devel/nwb/icephys_extensions/port_to_nwb/hdmf/src/hdmf/testing/testcase.py", line 11, in <module>
    from ..common import validate as common_validate, get_manager
  File "/Users/oruebel/Devel/nwb/icephys_extensions/port_to_nwb/hdmf/src/hdmf/common/__init__.py", line 109, in <module>
    load_namespaces(__resources['namespace_path'])
  File "/Users/oruebel/Devel/nwb/icephys_extensions/port_to_nwb/hdmf/src/hdmf/utils.py", line 584, in func_call
    return func(**pargs)
  File "/Users/oruebel/Devel/nwb/icephys_extensions/port_to_nwb/hdmf/src/hdmf/common/__init__.py", line 97, in load_namespaces
    return __TYPE_MAP.load_namespaces(namespace_path)
  File "/Users/oruebel/Devel/nwb/icephys_extensions/port_to_nwb/hdmf/src/hdmf/utils.py", line 580, in func_call
    return func(args[0], **pargs)
  File "/Users/oruebel/Devel/nwb/icephys_extensions/port_to_nwb/hdmf/src/hdmf/build/manager.py", line 477, in load_namespaces
    container_cls = self.get_container_cls(src_ns, dt)
  File "/Users/oruebel/Devel/nwb/icephys_extensions/port_to_nwb/hdmf/src/hdmf/utils.py", line 580, in func_call
    return func(args[0], **pargs)
  File "/Users/oruebel/Devel/nwb/icephys_extensions/port_to_nwb/hdmf/src/hdmf/build/manager.py", line 505, in get_container_cls
    cls = self.__class_generator.generate_class(data_type, spec, parent_cls, attr_names, self)
  File "/Users/oruebel/Devel/nwb/icephys_extensions/port_to_nwb/hdmf/src/hdmf/utils.py", line 580, in func_call
    return func(args[0], **pargs)
  File "/Users/oruebel/Devel/nwb/icephys_extensions/port_to_nwb/hdmf/src/hdmf/build/classgenerator.py", line 79, in generate_class
    cls = ExtenderMeta(data_type, tuple(bases), classdict)
  File "/Users/oruebel/anaconda3/envs/icephys-port/lib/python3.8/abc.py", line 85, in __new__
    cls = super().__new__(mcls, name, bases, namespace, **kwargs)
TypeError: Cannot create a consistent method resolution
order (MRO) for bases MultiContainerInterface, DynamicTable

I implemented a hackish workaround in 09e4cac to avoid the automatic class generation for AlignedDynamicTable so that I could proceed with implementation of the PR and testing, but this is not the appropriate fix.

Steps to Reproduce

  • Check out the branch from this PR Add/aligned dynamic table #551
  • Comment out the following change 09e4cac
  • Simply try to import the class, i.e., from hdmf.common import AlignedDynamicTable

Environment

Python Executable: Install from branch https://github.com/hdmf-dev/hdmf/pull/551
Python Version: Python  3.8
Operating System:  macOS 
HDMF Version: dev with modifications from https://github.com/hdmf-dev/hdmf/pull/551

Checklist

  • Have you ensured the bug was not already reported ?
  • Have you included a brief and descriptive title?
  • Have you included a clear description of the problem you are trying to solve?
  • Have you included a minimal code snippet that reproduces the issue you are encountering?
  • Have you checked our Contributing document?
@oruebel oruebel added the category: bug errors in the code or code behavior label Apr 6, 2021
@rly rly removed their assignment Jan 11, 2024
@rly rly added priority: low alternative solution already working and/or relevant to only specific user(s) topic: extension issues related to extensions or dynamic class generation labels Jan 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: bug errors in the code or code behavior priority: low alternative solution already working and/or relevant to only specific user(s) topic: extension issues related to extensions or dynamic class generation
Projects
None yet
Development

No branches or pull requests

2 participants