snok/drf-openapi-tester

cannot import name 'cached_property'

Closed this issue · 3 comments

  File "/usr/local/lib/python3.6/site-packages/openapi_tester/loaders.py", line 5, in <module>
    from functools import cached_property
ImportError: cannot import name 'cached_property'

I get this error when using drf-openapi-tester 1.3.2. After a quick investigation, it seems that functools.cached_property was introduced in python 3.8 and I'm using 3.6.

There's another cached_property decorator in django.utils.functional. Since django is already a dependency of this project, can we switch to using that one instead?

Thanks!

Thank you for the report @idesoto-rover. This sounds very reasonable; we will support Python 3.6 for the foreseeable future, so adding a 3.8 feature was definitely an oversight on our part.

I'll see if I can resolve this some time today and publish a new version.

Just published v1.3.3 @idesoto-rover 🙂 Hopefully this will resolve this issue. To be sure, I (eventually managed to) set up Python 3.6 locally to do some testing and it looks good for me at least. Let me know if you spot anything else 👏

That was quick! It works like a charm. Thank you so much!