facebookresearch/iopath

iopath does not support Python<3.8 anymore

ppwwyyxx opened this issue · 6 comments

This commit f4e103f introduces
from typing import Protocol which is only available after python 3.8. https://docs.python.org/3/library/typing.html#typing.Protocol

Please fix this as it has broken downstream projects that rely on iopath, e.g. https://github.com/facebookresearch/detectron2/runs/5100428039?check_suite_focus=true

In general, please revamp the open source CI and enable it so such issues can be caught: https://github.com/facebookresearch/iopath/blob/main/.circleci/config.yml

cc @sujitoc

Hey @ppwwyyxx , is deprecating python versions < 3.8 a viable option now?

Python<3.8 are widely used outside facebook. This is the usage rate of fvcore: (from https://pypistats.org/packages/fvcore)
2022-02-18_00-45

and pytorch:
2022-02-18_00-46

We will fix it by using typing_extensions instead of typing.

Hi @sujitoc , thanks a lot for fixing this issue using typing_extensions! However it appears that there is still another incompatibility with python<3.8. There is a failure that can be seen in the CI https://app.circleci.com/pipelines/github/facebookresearch/iopath/1/workflows/d79b49f1-5f0f-4ff4-8d65-ed8a35c0aa93/jobs/2:

  File "/home/circleci/iopath/iopath/common/file_io.py", line 1610
    g_pathmgr: PathManager = PathManagerFactory.get(defaults_setup=True)
    ^
SyntaxError: annotated name 'g_pathmgr' can't be global

Looking at the list of tags in python/cpython@de2aea0, this is a syntax that's supported only since Python3.8.

Verified that now it works for Detectron2.

Thanks! closing