sematic icon indicating copy to clipboard operation
sematic copied to clipboard

Types module collision in Python 3.10

Open tscurtu opened this issue 1 year ago • 1 comments

In Python 3.10 only sematic.types is being imported instead of the standard types library when executing import types from anywhere inside the codebase:

~/sematic$ python3.9 sematic/versions.py
0.27.0
~/sematic$
~/sematic$ python3.10 sematic/versions.py
Traceback (most recent call last):
  File "/home/tudor/sematic/sematic/versions.py", line 2, in <module>
    import logging
  File "/usr/lib/python3.10/logging/__init__.py", line 26, in <module>
    import sys, os, time, io, re, traceback, warnings, weakref, collections.abc
  File "/usr/lib/python3.10/re.py", line 124, in <module>
    import enum
  File "/usr/lib/python3.10/enum.py", line 2, in <module>
    from types import MappingProxyType, DynamicClassAttribute
  File "/home/tudor/sematic/sematic/types/__init__.py", line 8, in <module>
    import sematic.types.types.bool  # noqa: F401
ModuleNotFoundError: No module named 'sematic'

In several places in the introductory part of the documentation, we state running certain commands via python3 directly, which will fail if new prospective users have also checked out the codebase and are evaluating the product.

tscurtu avatar Mar 28 '23 22:03 tscurtu

I skimmed the 3.10 release docs and did web searches, but wasn't able to find explicit changes to the way module import resolutions are being done in 3.10.

tscurtu avatar Mar 28 '23 22:03 tscurtu