mailgun / expiringdict

Dictionary with auto-expiring values for caching purposes.
Apache License 2.0
347 stars 76 forks source link

Fix typing conflict on Python 3.7 #44

Closed jonnyyu closed 4 years ago

jonnyyu commented 4 years ago

When using bazel on Python3.7, I got error message below

Traceback (most recent call last):
  File "/private/var/tmp/_bazel_yujo/abf0a3d83a4b1d722a32424a453d5c05/sandbox/darwin-sandbox/39/execroot/__main__/bazel-out/darwin-fastbuild/bin/tests/unit/unit_tests.runfiles/__main__/tests/unit/runner.py", line 2, in <module>
    from typing import Any
  File "/private/var/tmp/_bazel_yujo/abf0a3d83a4b1d722a32424a453d5c05/sandbox/darwin-sandbox/39/execroot/__main__/bazel-out/darwin-fastbuild/bin/tests/unit/unit_tests.runfiles/pip_deps_pypi__typing_3_7_4_1/typing.py", line 1357, in <module>
    class Callable(extra=collections_abc.Callable, metaclass=CallableMeta):
  File "/private/var/tmp/_bazel_yujo/abf0a3d83a4b1d722a32424a453d5c05/sandbox/darwin-sandbox/39/execroot/__main__/bazel-out/darwin-fastbuild/bin/tests/unit/unit_tests.runfiles/pip_deps_pypi__typing_3_7_4_1/typing.py", line 1005, in __new__
    self._abc_registry = extra._abc_registry
AttributeError: type object 'Callable' has no attribute '_abc_registry'

After some research, I found this is because expiringdict requires 'typing' regardless of Python version. From typing doc, it becomes part of standard library in python 3.5.

jonnyyu commented 4 years ago

uh, the coverage rate is not up to standard, but I didn't add any code.

mvaled commented 4 years ago

This, actually produces a nasty error when importing typing in Python 3.8 in an environment with expiringdict installed.

mvaled commented 4 years ago

Hi @horkhe

Would you please review this PR? Do you have some plan to do a release?

horkhe commented 4 years ago

Thank you for your contribution. Version 1.2.1 has been uploaded to PyPI.