Skip to content

in is_overlapping_types assert type(left) != type(right) #12322

@Jasha10

Description

@Jasha10

Crash Report

Running mypy on a the hydra-zen source triggers INTERNAL ERROR.

Traceback

$ mypy src/hydra_zen/ --show-traceback
src/hydra_zen/_compatibility.py:9: error: Cannot find implementation or library stub for module named "hydra"
src/hydra_zen/_compatibility.py:10: error: Cannot find implementation or library stub for module named "omegaconf"
src/hydra_zen/typing/_implementations.py:25: error: Cannot find implementation or library stub for module named "omegaconf"
src/hydra_zen/typing/_implementations.py:168: error: Cannot resolve name "SupportedPrimitive" (possible cyclic definition)
src/hydra_zen/typing/_implementations.py:170: error: Cannot resolve name "SupportedPrimitive" (possible cyclic definition)
src/hydra_zen/typing/_implementations.py:173: error: Cannot resolve name "SupportedPrimitive" (possible cyclic definition)
src/hydra_zen/typing/_implementations.py:178: error: Cannot resolve name "SupportedPrimitive" (possible cyclic definition)
src/hydra_zen/typing/_implementations.py:180: error: Cannot resolve name "SupportedPrimitive" (possible cyclic definition)
src/hydra_zen/_version.py:54: error: Need type annotation for "LONG_VERSION_PY" (hint: "LONG_VERSION_PY: Dict[<type>, <type>] = ...")
src/hydra_zen/_utils/coerce.py:23: error: Cannot find implementation or library stub for module named "omegaconf"
src/hydra_zen/_utils/coerce.py:23: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
src/hydra_zen/structured_configs/_implementations.py:40: error: Cannot find implementation or library stub for module named "omegaconf"
src/hydra_zen/structured_configs/_utils.py:26: error: Cannot find implementation or library stub for module named "omegaconf"
src/hydra_zen/third_party/beartype.py:6: error: Cannot find implementation or library stub for module named "beartype"
src/hydra_zen/third_party/pydantic.py:6: error: Cannot find implementation or library stub for module named "pydantic"
src/hydra_zen/_hydra_overloads.py:25: error: Cannot find implementation or library stub for module named "hydra.utils"
src/hydra_zen/_hydra_overloads.py:26: error: Cannot find implementation or library stub for module named "omegaconf"
src/hydra_zen/_launch.py:6: error: Cannot find implementation or library stub for module named "hydra._internal.callbacks"
src/hydra_zen/_launch.py:7: error: Cannot find implementation or library stub for module named "hydra._internal.hydra"
src/hydra_zen/_launch.py:8: error: Cannot find implementation or library stub for module named "hydra._internal.utils"
src/hydra_zen/_launch.py:9: error: Cannot find implementation or library stub for module named "hydra.core.config_store"
src/hydra_zen/_launch.py:10: error: Cannot find implementation or library stub for module named "hydra.core.global_hydra"
src/hydra_zen/_launch.py:11: error: Cannot find implementation or library stub for module named "hydra.core.utils"
src/hydra_zen/_launch.py:12: error: Cannot find implementation or library stub for module named "hydra.plugins.sweeper"
src/hydra_zen/_launch.py:13: error: Cannot find implementation or library stub for module named "hydra.types"
src/hydra_zen/_launch.py:14: error: Cannot find implementation or library stub for module named "omegaconf"
src/hydra_zen/funcs.py:11: error: Cannot find implementation or library stub for module named "hydra._internal"
src/hydra_zen/funcs.py:12: error: Cannot find implementation or library stub for module named "hydra.utils"
src/hydra_zen/typing/_builds_overloads.py:38: error: Overloaded function signatures 1 and 4 overlap with incompatible return types
src/hydra_zen/typing/_builds_overloads.py:37: error: INTERNAL ERROR -- Please try using mypy master on Github:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 0.950+dev.4a744b35e28277e2193feb78de90d3b3cbb3169b
Traceback (most recent call last):
  File "/Users/jasha10/miniconda3/envs/tmp/bin/mypy", line 8, in <module>
    sys.exit(console_entry())
  File "/Users/jasha10/miniconda3/envs/tmp/lib/python3.7/site-packages/mypy/__main__.py", line 12, in console_entry
    main(None, sys.stdout, sys.stderr)
  File "/Users/jasha10/miniconda3/envs/tmp/lib/python3.7/site-packages/mypy/main.py", line 96, in main
    res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
  File "/Users/jasha10/miniconda3/envs/tmp/lib/python3.7/site-packages/mypy/main.py", line 173, in run_build
    res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
  File "/Users/jasha10/miniconda3/envs/tmp/lib/python3.7/site-packages/mypy/build.py", line 181, in build
    sources, options, alt_lib_path, flush_errors, fscache, stdout, stderr, extra_plugins
  File "/Users/jasha10/miniconda3/envs/tmp/lib/python3.7/site-packages/mypy/build.py", line 256, in _build
    graph = dispatch(sources, manager, stdout)
  File "/Users/jasha10/miniconda3/envs/tmp/lib/python3.7/site-packages/mypy/build.py", line 2727, in dispatch
    process_graph(graph, manager)
  File "/Users/jasha10/miniconda3/envs/tmp/lib/python3.7/site-packages/mypy/build.py", line 3071, in process_graph
    process_stale_scc(graph, scc, manager)
  File "/Users/jasha10/miniconda3/envs/tmp/lib/python3.7/site-packages/mypy/build.py", line 3169, in process_stale_scc
    graph[id].type_check_first_pass()
  File "/Users/jasha10/miniconda3/envs/tmp/lib/python3.7/site-packages/mypy/build.py", line 2186, in type_check_first_pass
    self.type_checker().check_first_pass()
  File "/Users/jasha10/miniconda3/envs/tmp/lib/python3.7/site-packages/mypy/checker.py", line 318, in check_first_pass
    self.accept(d)
  File "/Users/jasha10/miniconda3/envs/tmp/lib/python3.7/site-packages/mypy/checker.py", line 424, in accept
    stmt.accept(self)
  File "/Users/jasha10/miniconda3/envs/tmp/lib/python3.7/site-packages/mypy/nodes.py", line 573, in accept
    return visitor.visit_overloaded_func_def(self)
  File "/Users/jasha10/miniconda3/envs/tmp/lib/python3.7/site-packages/mypy/checker.py", line 457, in visit_overloaded_func_def
    self._visit_overloaded_func_def(defn)
  File "/Users/jasha10/miniconda3/envs/tmp/lib/python3.7/site-packages/mypy/checker.py", line 484, in _visit_overloaded_func_def
    self.check_overlapping_overloads(defn)
  File "/Users/jasha10/miniconda3/envs/tmp/lib/python3.7/site-packages/mypy/checker.py", line 566, in check_overlapping_overloads
    if is_unsafe_overlapping_overload_signatures(sig1, sig2):
  File "/Users/jasha10/miniconda3/envs/tmp/lib/python3.7/site-packages/mypy/checker.py", line 6043, in is_unsafe_overlapping_overload_signatures
    allow_partial_overlap=True) or
  File "/Users/jasha10/miniconda3/envs/tmp/lib/python3.7/site-packages/mypy/subtypes.py", line 968, in is_callable_compatible
    allow_partial_overlap, is_compat):
  File "/Users/jasha10/miniconda3/envs/tmp/lib/python3.7/site-packages/mypy/subtypes.py", line 1091, in are_args_compatible
    return is_compat(right.typ, left.typ)
  File "/Users/jasha10/miniconda3/envs/tmp/lib/python3.7/site-packages/mypy/subtypes.py", line 1096, in new_is_compat
    return is_compat(right, left)
  File "/Users/jasha10/miniconda3/envs/tmp/lib/python3.7/site-packages/mypy/checker.py", line 6523, in is_overlapping_types_no_promote
    return is_overlapping_types(left, right, ignore_promotions=True)
  File "/Users/jasha10/miniconda3/envs/tmp/lib/python3.7/site-packages/mypy/meet.py", line 308, in is_overlapping_types
    allow_partial_overlap=True)
  File "/Users/jasha10/miniconda3/envs/tmp/lib/python3.7/site-packages/mypy/subtypes.py", line 955, in is_callable_compatible
    if _incompatible(left_star, right_star) or _incompatible(left_star2, right_star2):
  File "/Users/jasha10/miniconda3/envs/tmp/lib/python3.7/site-packages/mypy/subtypes.py", line 953, in _incompatible
    return not is_compat(right_arg.typ, left_arg.typ)
  File "/Users/jasha10/miniconda3/envs/tmp/lib/python3.7/site-packages/mypy/meet.py", line 166, in _is_overlapping_types
    prohibit_none_typevar_overlap=prohibit_none_typevar_overlap)
  File "/Users/jasha10/miniconda3/envs/tmp/lib/python3.7/site-packages/mypy/meet.py", line 371, in is_overlapping_types
    assert type(left) != type(right)
AssertionError:
src/hydra_zen/typing/_builds_overloads.py:37: : note: use --pdb to drop into pdb

To Reproduce

I can reproduce the error by running the following commands in a bash shell:

# Install python=3.7 and pip:
yes | conda create -n tmp
conda activate tmp
yes | conda install python=3.7 pip

# Install the latest version of mypy:
git clone https://github.com/python/mypy.git
cd mypy
python3 -m pip install --upgrade .
cd ..

# Download hydra-zen and run mypy:
git clone https://github.com/mit-ll-responsible-ai/hydra-zen
cd hydra-zen/
git checkout eb3cc5d  # latest commit on main branch, as of this writing
mypy src/hydra_zen

Your Environment

  • Mypy version used: 0.950+dev.4a744b35e28277e2193feb78de90d3b3cbb3169b (compiled: no)
  • Mypy command-line flags: mypy src/hydra_zen/ --show-traceback
  • Mypy configuration options from mypy.ini (and other config files): None
  • Python version used: CPython 3.7

cc @rsokl

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions