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

Compatibility with Python 3.7 #57

Closed
nateraw opened this issue Nov 7, 2022 · 4 comments
Closed

Compatibility with Python 3.7 #57

nateraw opened this issue Nov 7, 2022 · 4 comments
Labels
good first issue Good for newcomers

Comments

@nateraw
Copy link

nateraw commented Nov 7, 2022

So related to #56 , Colab's environment uses Python 3.7. Since in the package you are using typing.Final, it makes this package unusable on Python 3.7 unfortunately, as that is only supported on Python >= 3.8

Would it be possible to not use this typing feature so the package works on Python < 3.8?

@nateraw
Copy link
Author

nateraw commented Nov 7, 2022

This issue can be worked around rather easily by adding calls to import from typing_extensions if the version is less than 3.8.

import sys

if sys.version_info < (3, 8):
    from typing_extensions import Final
else:
    from typing import Final

@cragwolfe
Copy link
Contributor

Thanks for the tip @nateraw , we will look into adding 3.7 support.

@firmai
Copy link

firmai commented Dec 20, 2022

You might be happy to hear the Colab has recently updated to 3.8. I still run 3.7 environments, and stumbled across the following problem

This should be changed:

if sys.version_info < (3, 8):
    from typing_extensions import Final, List, Optional
else:
    from typing import Final, List, Optional

To this:

from typing import  List, Optional
if sys.version_info < (3, 8):
    from typing_extensions import Final
else:
    from typing import Final

https://github.com/Unstructured-IO/unstructured/blob/main/unstructured/partition/text_type.py

ImportError: cannot import name 'List' from 'typing_extensions' (/opt/conda/lib/python3.7/site-packages/typing_extensions.py)

@yuming-long yuming-long reopened this Dec 20, 2022
cragwolfe added a commit that referenced this issue Dec 21, 2022
Per issue #57 , fix typing imports in Python 3.7.
@MthwRobinson MthwRobinson added the good first issue Good for newcomers label Dec 26, 2022
@cragwolfe
Copy link
Contributor

This was completed with #108 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

5 participants