Skip to content

Python 3.6 support? #3

New issue

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

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

Already on GitHub? # to your account

Closed
liaden opened this issue Apr 7, 2022 · 2 comments
Closed

Python 3.6 support? #3

liaden opened this issue Apr 7, 2022 · 2 comments

Comments

@liaden
Copy link

liaden commented Apr 7, 2022

I realize python 3.6 is end of life but 0.3.0 fails tests on python 3.6.15 whereas it passes on 3.7.12 so just wanted to report the error, even if the "fix" is to specify the library is 3.7+.

❯ poetry run pytest
Traceback (most recent call last):
  File "/Users/joel.johnson/Library/Caches/pypoetry/virtualenvs/pytest-assert-utils-uDcuCd8V-py3.6/bin/pytest", line 8, in <module>
    sys.exit(console_main())
  File "/Users/joel.johnson/Library/Caches/pypoetry/virtualenvs/pytest-assert-utils-uDcuCd8V-py3.6/lib/python3.6/site-packages/_pytest/config/__init__.py", line 185, in console_main
    code = main()
  File "/Users/joel.johnson/Library/Caches/pypoetry/virtualenvs/pytest-assert-utils-uDcuCd8V-py3.6/lib/python3.6/site-packages/_pytest/config/__init__.py", line 143, in main
    config = _prepareconfig(args, plugins)
  File "/Users/joel.johnson/Library/Caches/pypoetry/virtualenvs/pytest-assert-utils-uDcuCd8V-py3.6/lib/python3.6/site-packages/_pytest/config/__init__.py", line 319, in _prepareconfig
    pluginmanager=pluginmanager, args=args
  File "/Users/joel.johnson/Library/Caches/pypoetry/virtualenvs/pytest-assert-utils-uDcuCd8V-py3.6/lib/python3.6/site-packages/pluggy/_hooks.py", line 265, in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
  File "/Users/joel.johnson/Library/Caches/pypoetry/virtualenvs/pytest-assert-utils-uDcuCd8V-py3.6/lib/python3.6/site-packages/pluggy/_manager.py", line 80, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/Users/joel.johnson/Library/Caches/pypoetry/virtualenvs/pytest-assert-utils-uDcuCd8V-py3.6/lib/python3.6/site-packages/pluggy/_callers.py", line 55, in _multicall
    gen.send(outcome)
  File "/Users/joel.johnson/Library/Caches/pypoetry/virtualenvs/pytest-assert-utils-uDcuCd8V-py3.6/lib/python3.6/site-packages/_pytest/helpconfig.py", line 100, in pytest_cmdline_parse
    config: Config = outcome.get_result()
  File "/Users/joel.johnson/Library/Caches/pypoetry/virtualenvs/pytest-assert-utils-uDcuCd8V-py3.6/lib/python3.6/site-packages/pluggy/_result.py", line 60, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/Users/joel.johnson/Library/Caches/pypoetry/virtualenvs/pytest-assert-utils-uDcuCd8V-py3.6/lib/python3.6/site-packages/pluggy/_callers.py", line 39, in _multicall
    res = hook_impl.function(*args)
  File "/Users/joel.johnson/Library/Caches/pypoetry/virtualenvs/pytest-assert-utils-uDcuCd8V-py3.6/lib/python3.6/site-packages/_pytest/config/__init__.py", line 1003, in pytest_cmdline_parse
    self.parse(args)
  File "/Users/joel.johnson/Library/Caches/pypoetry/virtualenvs/pytest-assert-utils-uDcuCd8V-py3.6/lib/python3.6/site-packages/_pytest/config/__init__.py", line 1283, in parse
    self._preparse(args, addopts=addopts)
  File "/Users/joel.johnson/Library/Caches/pypoetry/virtualenvs/pytest-assert-utils-uDcuCd8V-py3.6/lib/python3.6/site-packages/_pytest/config/__init__.py", line 1172, in _preparse
    self.pluginmanager.load_setuptools_entrypoints("pytest11")
  File "/Users/joel.johnson/Library/Caches/pypoetry/virtualenvs/pytest-assert-utils-uDcuCd8V-py3.6/lib/python3.6/site-packages/pluggy/_manager.py", line 287, in load_setuptools_entrypoints
    plugin = ep.load()
  File "/Users/joel.johnson/Library/Caches/pypoetry/virtualenvs/pytest-assert-utils-uDcuCd8V-py3.6/lib/python3.6/site-packages/importlib_metadata/__init__.py", line 194, in load
    module = import_module(match.group('module'))
  File "/Users/joel.johnson/.asdf/installs/python/3.6.15/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/joel.johnson/workspace/pytest-assert-utils/pytest_assert_utils/__init__.py", line 3, in <module>
    from . import util
  File "/Users/joel.johnson/workspace/pytest-assert-utils/pytest_assert_utils/util/__init__.py", line 2, in <module>
    from .decl import *
  File "/Users/joel.johnson/workspace/pytest-assert-utils/pytest_assert_utils/util/decl.py", line 317, in <module>
    class Collection(_CollectionValuesChecker, BaseCollection, metaclass=_CollectionValuesCheckerMeta):
TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
@theY4Kman
Copy link
Owner

Yeah, I'm to blame for letting Python 3.6 support continue... I added generic typing to all the declarative classes, which works fine for everything but decl.Collection — because in Python 3.6, typing.Generic has a metaclass, GenericMeta, which interferes with the ABCMeta metaclass that collections[.abc].Collection uses. In Python 3.7, they nixed GenericMeta altogether, so typing.Generic can be used alongside any other base class, without having to care about this. Ref: python/typing#449

I tried every which way to get it to work, and eventually just... well... pushed out the generic typing without killing Python 3.6 support. Probably because I was ashamed I couldn't find a workaround. It's time for it to die, though, as much as it pains me. (Though, honestly, I use the walrus operator enough that I won't use anything below 3.8 :P)

@theY4Kman
Copy link
Owner

Okay, I pushed a new version, 0.3.1, that removes Python 3.6 support. I also added a Travis CI config (one day, I'll switch to GH actions) to run the tox tests, so at least I'll have a harder time hiding my poor decisions :P Lastly, I added Python 3.11 to the tox config, for more version coverage going forward.

Thanks for taking the time to report this; I appreciate the effort <3

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

No branches or pull requests

2 participants