Repository: vega/altair

Issue:
alt.Color fails mypy --strict with error: Call to untyped function "Color" in typed context  [no-untyped-call]
### What happened?

I use altair in my project, which is typedchecked with mypy strict mode. When I have a graph in that project which uses alt.Color, I get `error: Call to untyped function "Color" in typed context  [no-untyped-call]` from mypy --strict. Oddly, this does not happen to other alt.Whatever objects, only color. I can't be sure if this is an altair bug or a mypy bug, to be honest.

Here's a minimal example:

```python
import altair as alt
import pandas as pd
dicted_rows = {"a": [1, 2, 3], "b": [4, 5, 6], "c": ["red", "blue", "yellow"]}
chart = alt.Chart(pd.DataFrame(dicted_rows)).mark_circle(size=90).encode(alt.X("a"), alt.Y("b"), alt.Color("c"))
chart.save('chart.html') #note: this works fine
```
Results from mypy version 1.9.0 (compiled: yes):

```
$ mypy "minimal altair example.py"
Success: no issues found in 1 source file
```

```
$ mypy --strict "minimal altair example.py"
minimal altair example.py:4: error: Call to untyped function "Color" in typed context  [no-untyped-call]
Found 1 error in 1 file (checked 1 source file)
```

### What would you like to happen instead?

The types should be annotated appropriately so Color is deduced to be a typed function and therefore mypy strict would not report an error.

I'm not sure exactly what this would involve. https://peps.python.org/pep-0484/ says the return type of __init__ ought to be `None`, so that's somewhere to start, maybe, perhaps.

### Which version of Altair are you using?

5.3.0


Discussion:
Weird, `Color` is type annotated in the same way as other encoding channels such as `X` and `Y`. Maybe mypy somehow gets confused... Thanks for raising it! I'll have a look.
It also seems to fail pyright, erroring for all three arguments.

In case it helps, here's the output from various type checkers, using `reveal_type` on alt.X, alt.Y, and alt.Color, and some other parts as well:

```
import altair as alt
import pandas as pd
dicted_rows = {"a": [1, 2, 3], "b": [4, 5, 6], "c": ["red", "blue", "yellow"]}
chart = alt.Chart(pd.DataFrame(dicted_rows)).mark_circle(size=90).encode(alt.X("a"), alt.Y("b"), alt.Color("c"))
chart.save('chart.html') #note: this works fine
reveal_type(alt.X)
reveal_type(alt.Y)
reveal_type(alt.Color)
reveal_type(alt.Chart)
reveal_type(alt.Chart(pd.DataFrame(dicted_rows)).mark_circle(size=90))
reveal_type(alt.Chart(pd.DataFrame(dicted_rows)).mark_circle(size=90).encode)
```

pyright 1.1.360:

```
c:\experiment\minalt.py
  c:\experiment\minalt.py:4:74 - error: Argument of type "X" cannot be assigned to parameter "angle" of type "str | Angle | dict[Unknown, Unknown] | AngleDatum | AngleValue | UndefinedType"
    Type "X" is incompatible with type "str | Angle | dict[Unknown, Unknown] | AngleDatum | AngleValue | UndefinedType"
      "X" is incompatible with "str"
      "X" is incompatible with "Angle"
      "X" is incompatible with "dict[Unknown, Unknown]"
      "X" is incompatible with "AngleDatum"
      "X" is incompatible with "AngleValue"
      "X" is incompatible with "UndefinedType" (reportArgumentType)
  c:\experiment\minalt.py:4:86 - error: Argument of type "Y" cannot be assigned to parameter "color" of type "str | Color | dict[Unknown, Unknown] | ColorDatum | ColorValue | UndefinedType"
    Type "Y" is incompatible with type "str | Color | dict[Unknown, Unknown] | ColorDatum | ColorValue | UndefinedType"
      "Y" is incompatible with "str"
      "Y" is incompatible with "Color"
      "Y" is incompatible with "dict[Unknown, Unknown]"
      "Y" is incompatible with "ColorDatum"
      "Y" is incompatible with "ColorValue"
      "Y" is incompatible with "UndefinedType" (reportArgumentType)
  c:\experiment\minalt.py:4:98 - error: Argument of type "Color" cannot be assigned to parameter "column" of type "str | Column | dict[Unknown, Unknown] | UndefinedType"
    Type "Color" is incompatible with type "str | Column | dict[Unknown, Unknown] | UndefinedType"
      "Color" is incompatible with "str"
      "Color" is incompatible with "Column"
      "Color" is incompatible with "dict[Unknown, Unknown]"
      "Color" is incompatible with "UndefinedType" (reportArgumentType)
  c:\experiment\minalt.py:6:13 - information: Type of "alt.X" is "type[X]"
  c:\experiment\minalt.py:7:13 - information: Type of "alt.Y" is "type[Y]"
  c:\experiment\minalt.py:8:13 - information: Type of "alt.Color" is "type[Color]"
  c:\experiment\minalt.py:9:13 - information: Type of "alt.Chart" is "type[Chart]"
  c:\experiment\minalt.py:10:13 - information: Type of "alt.Chart(pd.DataFrame(dicted_rows)).mark_circle(size=90)" is "Chart"
  c:\experiment\minalt.py:11:13 - information: Type of "alt.Chart(pd.DataFrame(dicted_rows)).mark_circle(size=90).encode" is "(angle: str | Angle | dict[Unknown, Unknown] | AngleDatum | AngleValue | UndefinedType = Undefined, color: str | Color | dict[Unknown, Unknown] | ColorDatum | ColorValue | UndefinedType = Undefined, column: str | Column | dict[Unknown, Unknown] | UndefinedType = Undefined, description: str | Description | dict[Unknown, Unknown] | DescriptionValue | UndefinedType = Undefined, detail: str | Detail | dict[Unknown, Unknown] | list[Unknown] | UndefinedType = Undefined, facet: str | Facet | dict[Unknown, Unknown] | UndefinedType = Undefined, fill: str | Fill | dict[Unknown, Unknown] | FillDatum | FillValue | UndefinedType = Undefined, fillOpacity: str | FillOpacity | dict[Unknown, Unknown] | FillOpacityDatum | FillOpacityValue | UndefinedType = Undefined, href: str | Href | dict[Unknown, Unknown] | HrefValue | UndefinedType = Undefined, key: str | Key | dict[Unknown, Unknown] | UndefinedType = Undefined, latitude: str | Latitude | dict[Unknown, Unknown] | LatitudeDatum | UndefinedType = Undefined, latitude2: str | Latitude2 | dict[Unknown, Unknown] | Latitude2Datum | Latitude2Value | UndefinedType = Undefined, longitude: str | Longitude | dict[Unknown, Unknown] | LongitudeDatum | UndefinedType = Undefined, longitude2: str | Longitude2 | dict[Unknown, Unknown] | Longitude2Datum | Longitude2Value | UndefinedType = Undefined, opacity: str | Opacity | dict[Unknown, Unknown] | OpacityDatum | OpacityValue | UndefinedType = Undefined, order: str | Order | dict[Unknown, Unknown] | list[Unknown] | OrderValue | UndefinedType = Undefined, radius: str | Radius | dict[Unknown, Unknown] | RadiusDatum | RadiusValue | UndefinedType = Undefined, radius2: str | Radius2 | dict[Unknown, Unknown] | Radius2Datum | Radius2Value | UndefinedType = Undefined, row: str | Row | dict[Unknown, Unknown] | UndefinedType = Undefined, shape: str | Shape | dict[Unknown, Unknown] | ShapeDatum | ShapeValue | UndefinedType = Undefined, size: str | Size | dict[Unknown, Unknown] | SizeDatum | SizeValue | UndefinedType = Undefined, stroke: str | Stroke | dict[Unknown, Unknown] | StrokeDatum | StrokeValue | UndefinedType = Undefined, strokeDash: str | StrokeDash | dict[Unknown, Unknown] | StrokeDashDatum | StrokeDashValue | UndefinedType = Undefined, strokeOpacity: str | StrokeOpacity | dict[Unknown, Unknown] | StrokeOpacityDatum | StrokeOpacityValue | UndefinedType = Undefined, strokeWidth: str | StrokeWidth | dict[Unknown, Unknown] | StrokeWidthDatum | StrokeWidthValue | UndefinedType = Undefined, text: str | Text | dict[Unknown, Unknown] | TextDatum | TextValue | UndefinedType = Undefined, theta: str | Theta | dict[Unknown, Unknown] | ThetaDatum | ThetaValue | UndefinedType = Undefined, theta2: str | Theta2 | dict[Unknown, Unknown] | Theta2Datum | Theta2Value | UndefinedType = Undefined, tooltip: str | Tooltip | dict[Unknown, Unknown] | list[Unknown] | TooltipValue | UndefinedType = Undefined, url: str | Url | dict[Unknown, Unknown] | UrlValue | UndefinedType = Undefined, x: str | X | dict[Unknown, Unknown] | XDatum | XValue | UndefinedType = Undefined, x2: str | X2 | dict[Unknown, Unknown] | X2Datum | X2Value | UndefinedType = Undefined, xError: str | XError | dict[Unknown, Unknown] | XErrorValue | UndefinedType = Undefined, xError2: str | XError2 | dict[Unknown, Unknown] | XError2Value | UndefinedType = Undefined, xOffset: str | XOffset | dict[Unknown, Unknown] | XOffsetDatum | XOffsetValue | UndefinedType = Undefined, y: str | Y | dict[Unknown, Unknown] | YDatum | YValue | UndefinedType = Undefined, y2: str | Y2 | dict[Unknown, Unknown] | Y2Datum | Y2Value | UndefinedType = Undefined, yError: str | YError | dict[Unknown, Unknown] | YErrorValue | UndefinedType = Undefined, yError2: str | YError2 | dict[Unknown, Unknown] | YError2Value | UndefinedType = Undefined, yOffset: str | YOffset | dict[Unknown, Unknown] | YOffsetDatum | YOffsetValue | UndefinedType = Undefined) -> Chart"
3 errors, 0 warnings, 6 informations
```
mypy 1.9.0 (compiled: yes), with --strict:

```
minalt.py:4: error: Call to untyped function "Color" in typed context  [no-untyped-call]
minalt.py:6: note: Revealed type is "def (shorthand: Union[builtins.str, builtins.dict[Any, Any], typing.Sequence[builtins.str], Any, altair.utils.schemapi.UndefinedType] =, aggregate: Union[builtins.dict[Any, Any], Any, Literal['average'], Literal['count'], Literal['distinct'], Literal['max'], Literal['mean'], Literal['median'], Literal['min'], Literal['missing'], Literal['product'], Literal['q1'], Literal['q3'], Literal['ci0'], Literal['ci1'], Literal['stderr'], Literal['stdev'], Literal['stdevp'], Literal['sum'], Literal['valid'], Literal['values'], Literal['variance'], Literal['variancep'], Literal['exponential'], Literal['exponentialb'], altair.utils.schemapi.UndefinedType] =, axis: Union[builtins.dict[Any, Any], None, Any, altair.utils.schemapi.UndefinedType] =, bandPosition: Union[builtins.float, altair.utils.schemapi.UndefinedType] =, bin: Union[builtins.str, builtins.bool, builtins.dict[Any, Any], None, Any, altair.utils.schemapi.UndefinedType] =, field: Union[builtins.str, builtins.dict[Any, Any], Any, altair.utils.schemapi.UndefinedType] =, impute: Union[builtins.dict[Any, Any], None, Any, altair.utils.schemapi.UndefinedType] =, scale: Union[builtins.dict[Any, Any], None, Any, altair.utils.schemapi.UndefinedType] =, sort: Union[builtins.dict[Any, Any], None, typing.Sequence[builtins.str], typing.Sequence[builtins.bool], Any, typing.Sequence[builtins.float], Literal['ascending'], Literal['descending'], typing.Sequence[Union[builtins.dict[Any, Any], Any]], Literal['x'], Literal['y'], Literal['color'], Literal['fill'], Literal['stroke'], Literal['strokeWidth'], Literal['size'], Literal['shape'], Literal['fillOpacity'], Literal['strokeOpacity'], Literal['opacity'], Literal['text'], Literal['-x'], Literal['-y'], Literal['-color'], Literal['-fill'], Literal['-stroke'], Literal['-strokeWidth'], Literal['-size'], Literal['-shape'], Literal['-fillOpacity'], Literal['-strokeOpacity'], Literal['-opacity'], Literal['-text'], altair.utils.schemapi.UndefinedType] =, stack: Union[builtins.bool, None, Any, Literal['zero'], Literal['center'], Literal['normalize'], altair.utils.schemapi.UndefinedType] =, timeUnit: Union[builtins.dict[Any, Any], Any, Literal['year'], Literal['quarter'], Literal['month'], Literal['week'], Literal['day'], Literal['dayofyear'], Literal['date'], Literal['hours'], Literal['minutes'], Literal['seconds'], Literal['milliseconds'], Literal['utcyear'], Literal['utcquarter'], Literal['utcmonth'], Literal['utcweek'], Literal['utcday'], Literal['utcdayofyear'], Literal['utcdate'], Literal['utchours'], Literal['utcminutes'], Literal['utcseconds'], Literal['utcmilliseconds'], Literal['binnedyear'], Literal['binnedyearquarter'], Literal['binnedyearquartermonth'], Literal['binnedyearmonth'], Literal['binnedyearmonthdate'], Literal['binnedyearmonthdatehours'], Literal['binnedyearmonthdatehoursminutes'], Literal['binnedyearmonthdatehoursminutesseconds'], Literal['binnedyearweek'], Literal['binnedyearweekday'], Literal['binnedyearweekdayhours'], Literal['binnedyearweekdayhoursminutes'], Literal['binnedyearweekdayhoursminutesseconds'], Literal['binnedyeardayofyear'], Literal['binnedutcyear'], Literal['binnedutcyearquarter'], Literal['binnedutcyearquartermonth'], Literal['binnedutcyearmonth'], Literal['binnedutcyearmonthdate'], Literal['binnedutcyearmonthdatehours'], Literal['binnedutcyearmonthdatehoursminutes'], Literal['binnedutcyearmonthdatehoursminutesseconds'], Literal['binnedutcyearweek'], Literal['binnedutcyearweekday'], Literal['binnedutcyearweekdayhours'], Literal['binnedutcyearweekdayhoursminutes'], Literal['binnedutcyearweekdayhoursminutesseconds'], Literal['binnedutcyeardayofyear'], Literal['yearquarter'], Literal['yearquartermonth'], Literal['yearmonth'], Literal['yearmonthdate'], Literal['yearmonthdatehours'], Literal['yearmonthdatehoursminutes'], Literal['yearmonthdatehoursminutesseconds'], Literal['yearweek'], Literal['yearweekday'], Literal['yearweekdayhours'], Literal['yearweekdayhoursminutes'], Literal['yearweekdayhoursminutesseconds'], Literal['yeardayofyear'], Literal['quartermonth'], Literal['monthdate'], Literal['monthdatehours'], Literal['monthdatehoursminutes'], Literal['monthdatehoursminutesseconds'], Literal['weekday'], Literal['weekdayhours'], Literal['weekdayhoursminutes'], Literal['weekdayhoursminutesseconds'], Literal['dayhours'], Literal['dayhoursminutes'], Literal['dayhoursminutesseconds'], Literal['hoursminutes'], Literal['hoursminutesseconds'], Literal['minutesseconds'], Literal['secondsmilliseconds'], Literal['utcyearquarter'], Literal['utcyearquartermonth'], Literal['utcyearmonth'], Literal['utcyearmonthdate'], Literal['utcyearmonthdatehours'], Literal['utcyearmonthdatehoursminutes'], Literal['utcyearmonthdatehoursminutesseconds'], Literal['utcyearweek'], Literal['utcyearweekday'], Literal['utcyearweekdayhours'], Literal['utcyearweekdayhoursminutes'], Literal['utcyearweekdayhoursminutesseconds'], Literal['utcyeardayofyear'], Literal['utcquartermonth'], Literal['utcmonthdate'], Literal['utcmonthdatehours'], Literal['utcmonthdatehoursminutes'], Literal['utcmonthdatehoursminutesseconds'], Literal['utcweekday'], Literal['utcweeksdayhours'], Literal['utcweekdayhoursminutes'], Literal['utcweekdayhoursminutesseconds'], Literal['utcdayhours'], Literal['utcdayhoursminutes'], Literal['utcdayhoursminutesseconds'], Literal['utchoursminutes'], Literal['utchoursminutesseconds'], Literal['utcminutesseconds'], Literal['utcsecondsmilliseconds'], altair.utils.schemapi.UndefinedType] =, title: Union[builtins.str, None, typing.Sequence[builtins.str], Any, altair.utils.schemapi.UndefinedType] =, type: Union[Any, Literal['quantitative'], Literal['ordinal'], Literal['temporal'], Literal['nominal'], altair.utils.schemapi.UndefinedType] =, **kwds: Any) -> altair.vegalite.v5.schema.channels.X"
minalt.py:7: note: Revealed type is "def (shorthand: Union[builtins.str, builtins.dict[Any, Any], typing.Sequence[builtins.str], Any, altair.utils.schemapi.UndefinedType] =, aggregate: Union[builtins.dict[Any, Any], Any, Literal['average'], Literal['count'], Literal['distinct'], Literal['max'], Literal['mean'], Literal['median'], Literal['min'], Literal['missing'], Literal['product'], Literal['q1'], Literal['q3'], Literal['ci0'], Literal['ci1'], Literal['stderr'], Literal['stdev'], Literal['stdevp'], Literal['sum'], Literal['valid'], Literal['values'], Literal['variance'], Literal['variancep'], Literal['exponential'], Literal['exponentialb'], altair.utils.schemapi.UndefinedType] =, axis: Union[builtins.dict[Any, Any], None, Any, altair.utils.schemapi.UndefinedType] =, bandPosition: Union[builtins.float, altair.utils.schemapi.UndefinedType] =, bin: Union[builtins.str, builtins.bool, builtins.dict[Any, Any], None, Any, altair.utils.schemapi.UndefinedType] =, field: Union[builtins.str, builtins.dict[Any, Any], Any, altair.utils.schemapi.UndefinedType] =, impute: Union[builtins.dict[Any, Any], None, Any, altair.utils.schemapi.UndefinedType] =, scale: Union[builtins.dict[Any, Any], None, Any, altair.utils.schemapi.UndefinedType] =, sort: Union[builtins.dict[Any, Any], None, typing.Sequence[builtins.str], typing.Sequence[builtins.bool], Any, typing.Sequence[builtins.float], Literal['ascending'], Literal['descending'], typing.Sequence[Union[builtins.dict[Any, Any], Any]], Literal['x'], Literal['y'], Literal['color'], Literal['fill'], Literal['stroke'], Literal['strokeWidth'], Literal['size'], Literal['shape'], Literal['fillOpacity'], Literal['strokeOpacity'], Literal['opacity'], Literal['text'], Literal['-x'], Literal['-y'], Literal['-color'], Literal['-fill'], Literal['-stroke'], Literal['-strokeWidth'], Literal['-size'], Literal['-shape'], Literal['-fillOpacity'], Literal['-strokeOpacity'], Literal['-opacity'], Literal['-text'], altair.utils.schemapi.UndefinedType] =, stack: Union[builtins.bool, None, Any, Literal['zero'], Literal['center'], Literal['normalize'], altair.utils.schemapi.UndefinedType] =, timeUnit: Union[builtins.dict[Any, Any], Any, Literal['year'], Literal['quarter'], Literal['month'], Literal['week'], Literal['day'], Literal['dayofyear'], Literal['date'], Literal['hours'], Literal['minutes'], Literal['seconds'], Literal['milliseconds'], Literal['utcyear'], Literal['utcquarter'], Literal['utcmonth'], Literal['utcweek'], Literal['utcday'], Literal['utcdayofyear'], Literal['utcdate'], Literal['utchours'], Literal['utcminutes'], Literal['utcseconds'], Literal['utcmilliseconds'], Literal['binnedyear'], Literal['binnedyearquarter'], Literal['binnedyearquartermonth'], Literal['binnedyearmonth'], Literal['binnedyearmonthdate'], Literal['binnedyearmonthdatehours'], Literal['binnedyearmonthdatehoursminutes'], Literal['binnedyearmonthdatehoursminutesseconds'], Literal['binnedyearweek'], Literal['binnedyearweekday'], Literal['binnedyearweekdayhours'], Literal['binnedyearweekdayhoursminutes'], Literal['binnedyearweekdayhoursminutesseconds'], Literal['binnedyeardayofyear'], Literal['binnedutcyear'], Literal['binnedutcyearquarter'], Literal['binnedutcyearquartermonth'], Literal['binnedutcyearmonth'], Literal['binnedutcyearmonthdate'], Literal['binnedutcyearmonthdatehours'], Literal['binnedutcyearmonthdatehoursminutes'], Literal['binnedutcyearmonthdatehoursminutesseconds'], Literal['binnedutcyearweek'], Literal['binnedutcyearweekday'], Literal['binnedutcyearweekdayhours'], Literal['binnedutcyearweekdayhoursminutes'], Literal['binnedutcyearweekdayhoursminutesseconds'], Literal['binnedutcyeardayofyear'], Literal['yearquarter'], Literal['yearquartermonth'], Literal['yearmonth'], Literal['yearmonthdate'], Literal['yearmonthdatehours'], Literal['yearmonthdatehoursminutes'], Literal['yearmonthdatehoursminutesseconds'], Literal['yearweek'], Literal['yearweekday'], Literal['yearweekdayhours'], Literal['yearweekdayhoursminutes'], Literal['yearweekdayhoursminutesseconds'], Literal['yeardayofyear'], Literal['quartermonth'], Literal['monthdate'], Literal['monthdatehours'], Literal['monthdatehoursminutes'], Literal['monthdatehoursminutesseconds'], Literal['weekday'], Literal['weekdayhours'], Literal['weekdayhoursminutes'], Literal['weekdayhoursminutesseconds'], Literal['dayhours'], Literal['dayhoursminutes'], Literal['dayhoursminutesseconds'], Literal['hoursminutes'], Literal['hoursminutesseconds'], Literal['minutesseconds'], Literal['secondsmilliseconds'], Literal['utcyearquarter'], Literal['utcyearquartermonth'], Literal['utcyearmonth'], Literal['utcyearmonthdate'], Literal['utcyearmonthdatehours'], Literal['utcyearmonthdatehoursminutes'], Literal['utcyearmonthdatehoursminutesseconds'], Literal['utcyearweek'], Literal['utcyearweekday'], Literal['utcyearweekdayhours'], Literal['utcyearweekdayhoursminutes'], Literal['utcyearweekdayhoursminutesseconds'], Literal['utcyeardayofyear'], Literal['utcquartermonth'], Literal['utcmonthdate'], Literal['utcmonthdatehours'], Literal['utcmonthdatehoursminutes'], Literal['utcmonthdatehoursminutesseconds'], Literal['utcweekday'], Literal['utcweeksdayhours'], Literal['utcweekdayhoursminutes'], Literal['utcweekdayhoursminutesseconds'], Literal['utcdayhours'], Literal['utcdayhoursminutes'], Literal['utcdayhoursminutesseconds'], Literal['utchoursminutes'], Literal['utchoursminutesseconds'], Literal['utcminutesseconds'], Literal['utcsecondsmilliseconds'], altair.utils.schemapi.UndefinedType] =, title: Union[builtins.str, None, typing.Sequence[builtins.str], Any, altair.utils.schemapi.UndefinedType] =, type: Union[Any, Literal['quantitative'], Literal['ordinal'], Literal['temporal'], Literal['nominal'], altair.utils.schemapi.UndefinedType] =, **kwds: Any) -> altair.vegalite.v5.schema.channels.Y"
minalt.py:8: note: Revealed type is "def (*args: Any, **kwds: Any) -> altair.vegalite.v5.schema.core.Color"
minalt.py:9: note: Revealed type is "def (data: Union[Union[builtins.dict[Any, Any], pandas.core.frame.DataFrame, altair.utils.data.SupportsGeoInterface, altair.utils.core.DataFrameLike, altair.vegalite.v5.schema.core.Data, builtins.str, altair.vegalite.v5.schema.core.Generator, Any], Any] =, encoding: Union[altair.vegalite.v5.schema.core.FacetedEncoding, Any] =, mark: Union[builtins.str, altair.vegalite.v5.schema.core.AnyMark, Any] =, width: Union[builtins.int, builtins.str, builtins.dict[Any, Any], altair.vegalite.v5.schema.core.Step, Any] =, height: Union[builtins.int, builtins.str, builtins.dict[Any, Any], altair.vegalite.v5.schema.core.Step, Any] =, **kwargs: Any) -> altair.vegalite.v5.api.Chart"
minalt.py:10: note: Revealed type is "altair.vegalite.v5.api.Chart"
minalt.py:11: note: Revealed type is "Any"
Found 1 error in 1 file (checked 1 source file)
```

pytype 2024.04.11
(this passes the typechecker with no complaints, so here are just the reveal_type messages)
```
File "/mnt/c/experiment/minalt.py", line 6, in <module>: Any [reveal-type]
File "/mnt/c/experiment/minalt.py", line 7, in <module>: Any [reveal-type]
File "/mnt/c/experiment/minalt.py", line 8, in <module>: Any [reveal-type]
File "/mnt/c/experiment/minalt.py", line 9, in <module>: Any [reveal-type]
File "/mnt/c/experiment/minalt.py", line 10, in <module>: Any [reveal-type]
File "/mnt/c/experiment/minalt.py", line 11, in <module>: Any [reveal-type]
```
Thanks! Those outputs were very helpful. I think mypy at least thinks that `alt.Color` is `alt.vegalite.v5.schema.core.Color` instead of `alt.vegalite.v5.schema.channels.Color` due to the `from *` imports in https://github.com/vega/altair/blob/main/altair/vegalite/v5/schema/__init__.py#L4 where the channels overwrite core. We should probably be explicit with the imports (needs to be autogenerated) or specify it in `__all__` on `core.py`.

Is this blocking you from using Altair or can you `type: ignore` it for now? Just so I know how to prioritise this.
Not a blocker for me at all! As you say, I can just type ignore.

Resolving patch:
diff --git a/altair/vegalite/v5/schema/__init__.py b/altair/vegalite/v5/schema/__init__.py
--- a/altair/vegalite/v5/schema/__init__.py
+++ b/altair/vegalite/v5/schema/__init__.py
@@ -1,7 +1,7 @@
 # ruff: noqa
 
 from .core import *
-from .channels import *  # type: ignore[assignment]
+from .channels import *
 
 SCHEMA_VERSION = "v5.17.0"
 
diff --git a/altair/vegalite/v5/schema/core.py b/altair/vegalite/v5/schema/core.py
--- a/altair/vegalite/v5/schema/core.py
+++ b/altair/vegalite/v5/schema/core.py
@@ -1,6 +1,425 @@
 # The contents of this file are automatically written by
 # tools/generate_schema_wrapper.py. Do not modify directly.
 
+__all__ = [
+    "Aggregate",
+    "AggregateOp",
+    "AggregateTransform",
+    "AggregatedFieldDef",
+    "Align",
+    "AllSortString",
+    "AnyMark",
+    "AnyMarkConfig",
+    "AreaConfig",
+    "ArgmaxDef",
+    "ArgminDef",
+    "AutoSizeParams",
+    "AutosizeType",
+    "Axis",
+    "AxisConfig",
+    "AxisOrient",
+    "AxisResolveMap",
+    "BBox",
+    "BarConfig",
+    "BaseTitleNoValueRefs",
+    "Baseline",
+    "BinExtent",
+    "BinParams",
+    "BinTransform",
+    "BindCheckbox",
+    "BindDirect",
+    "BindInput",
+    "BindRadioSelect",
+    "BindRange",
+    "Binding",
+    "BinnedTimeUnit",
+    "Blend",
+    "BoxPlot",
+    "BoxPlotConfig",
+    "BoxPlotDef",
+    "BrushConfig",
+    "CalculateTransform",
+    "Categorical",
+    "ColorDef",
+    "ColorName",
+    "ColorScheme",
+    "Encoding",
+    "CompositeMark",
+    "CompositeMarkDef",
+    "CompositionConfig",
+    "ConditionalMarkPropFieldOrDatumDef",
+    "ConditionalMarkPropFieldOrDatumDefTypeForShape",
+    "ConditionalStringFieldDef",
+    "ConditionalValueDefGradientstringnullExprRef",
+    "ConditionalValueDefTextExprRef",
+    "ConditionalValueDefnumberArrayExprRef",
+    "ConditionalValueDefnumberExprRef",
+    "ConditionalValueDefstringExprRef",
+    "ConditionalValueDefstringnullExprRef",
+    "ConditionalValueDefnumber",
+    "ConditionalAxisColor",
+    "ConditionalAxisLabelAlign",
+    "ConditionalAxisLabelBaseline",
+    "ConditionalAxisLabelFontStyle",
+    "ConditionalAxisLabelFontWeight",
+    "ConditionalAxisNumber",
+    "ConditionalAxisNumberArray",
+    "ConditionalAxisPropertyAlignnull",
+    "ConditionalAxisPropertyColornull",
+    "ConditionalAxisPropertyFontStylenull",
+    "ConditionalAxisPropertyFontWeightnull",
+    "ConditionalAxisPropertyTextBaselinenull",
+    "ConditionalAxisPropertynumberArraynull",
+    "ConditionalAxisPropertynumbernull",
+    "ConditionalAxisPropertystringnull",
+    "ConditionalAxisString",
+    "ConditionalParameterMarkPropFieldOrDatumDef",
+    "ConditionalParameterMarkPropFieldOrDatumDefTypeForShape",
+    "ConditionalParameterStringFieldDef",
+    "ConditionalParameterValueDefGradientstringnullExprRef",
+    "ConditionalParameterValueDefTextExprRef",
+    "ConditionalParameterValueDefnumberArrayExprRef",
+    "ConditionalParameterValueDefnumberExprRef",
+    "ConditionalParameterValueDefstringExprRef",
+    "ConditionalParameterValueDefstringnullExprRef",
+    "ConditionalParameterValueDefnumber",
+    "ConditionalPredicateValueDefAlignnullExprRef",
+    "ConditionalPredicateValueDefColornullExprRef",
+    "ConditionalPredicateValueDefFontStylenullExprRef",
+    "ConditionalPredicateValueDefFontWeightnullExprRef",
+    "ConditionalPredicateValueDefTextBaselinenullExprRef",
+    "ConditionalPredicateValueDefnumberArraynullExprRef",
+    "ConditionalPredicateValueDefnumbernullExprRef",
+    "ConditionalPredicateValueDefstringnullExprRef",
+    "ConditionalPredicateMarkPropFieldOrDatumDef",
+    "ConditionalPredicateMarkPropFieldOrDatumDefTypeForShape",
+    "ConditionalPredicateStringFieldDef",
+    "ConditionalPredicateValueDefGradientstringnullExprRef",
+    "ConditionalPredicateValueDefTextExprRef",
+    "ConditionalPredicateValueDefnumberArrayExprRef",
+    "ConditionalPredicateValueDefnumberExprRef",
+    "ConditionalPredicateValueDefstringExprRef",
+    "ConditionalPredicateValueDefnumber",
+    "Config",
+    "CsvDataFormat",
+    "Cursor",
+    "Cyclical",
+    "Data",
+    "DataFormat",
+    "DataSource",
+    "Datasets",
+    "DateTime",
+    "DatumDef",
+    "Day",
+    "DensityTransform",
+    "DerivedStream",
+    "DictInlineDataset",
+    "DictSelectionInit",
+    "DictSelectionInitInterval",
+    "Dict",
+    "Diverging",
+    "DomainUnionWith",
+    "DsvDataFormat",
+    "Element",
+    "EncodingSortField",
+    "ErrorBand",
+    "ErrorBandConfig",
+    "ErrorBandDef",
+    "ErrorBar",
+    "ErrorBarConfig",
+    "ErrorBarDef",
+    "ErrorBarExtent",
+    "EventStream",
+    "EventType",
+    "Expr",
+    "ExprRef",
+    "ExtentTransform",
+    "FacetEncodingFieldDef",
+    "FacetFieldDef",
+    "FacetMapping",
+    "FacetedEncoding",
+    "FacetedUnitSpec",
+    "Feature",
+    "FeatureGeometryGeoJsonProperties",
+    "FeatureCollection",
+    "Field",
+    "FieldDefWithoutScale",
+    "FieldEqualPredicate",
+    "FieldGTEPredicate",
+    "FieldGTPredicate",
+    "FieldLTEPredicate",
+    "FieldLTPredicate",
+    "FieldName",
+    "FieldOneOfPredicate",
+    "FieldOrDatumDefWithConditionDatumDefGradientstringnull",
+    "FieldOrDatumDefWithConditionDatumDefstringnull",
+    "FieldOrDatumDefWithConditionDatumDefnumber",
+    "FieldOrDatumDefWithConditionDatumDefnumberArray",
+    "FieldOrDatumDefWithConditionMarkPropFieldDefGradientstringnull",
+    "FieldOrDatumDefWithConditionMarkPropFieldDefnumber",
+    "FieldOrDatumDefWithConditionMarkPropFieldDefnumberArray",
+    "FieldOrDatumDefWithConditionMarkPropFieldDefTypeForShapestringnull",
+    "FieldOrDatumDefWithConditionStringDatumDefText",
+    "FieldOrDatumDefWithConditionStringFieldDefText",
+    "FieldOrDatumDefWithConditionStringFieldDefstring",
+    "FieldRange",
+    "FieldRangePredicate",
+    "FieldValidPredicate",
+    "FilterTransform",
+    "Fit",
+    "FlattenTransform",
+    "FoldTransform",
+    "FontStyle",
+    "FontWeight",
+    "FormatConfig",
+    "Generator",
+    "ConcatSpecGenericSpec",
+    "FacetSpec",
+    "HConcatSpecGenericSpec",
+    "Spec",
+    "GenericUnitSpecEncodingAnyMark",
+    "VConcatSpecGenericSpec",
+    "GeoJsonFeature",
+    "GeoJsonFeatureCollection",
+    "GeoJsonProperties",
+    "Geometry",
+    "GeometryCollection",
+    "Gradient",
+    "GradientStop",
+    "GraticuleGenerator",
+    "GraticuleParams",
+    "Header",
+    "HeaderConfig",
+    "HexColor",
+    "ImputeMethod",
+    "ImputeParams",
+    "ImputeSequence",
+    "ImputeTransform",
+    "InlineData",
+    "InlineDataset",
+    "Interpolate",
+    "IntervalSelectionConfig",
+    "IntervalSelectionConfigWithoutType",
+    "JoinAggregateFieldDef",
+    "JoinAggregateTransform",
+    "JsonDataFormat",
+    "LabelOverlap",
+    "LatLongDef",
+    "LatLongFieldDef",
+    "LayerRepeatMapping",
+    "LayerRepeatSpec",
+    "LayerSpec",
+    "LayoutAlign",
+    "Legend",
+    "LegendBinding",
+    "LegendConfig",
+    "LegendOrient",
+    "LegendResolveMap",
+    "LegendStreamBinding",
+    "LineConfig",
+    "LineString",
+    "LinearGradient",
+    "LocalMultiTimeUnit",
+    "LocalSingleTimeUnit",
+    "Locale",
+    "LoessTransform",
+    "LogicalAndPredicate",
+    "PredicateComposition",
+    "LogicalNotPredicate",
+    "LogicalOrPredicate",
+    "LookupData",
+    "LookupSelection",
+    "LookupTransform",
+    "Mark",
+    "MarkConfig",
+    "MarkDef",
+    "MarkPropDefGradientstringnull",
+    "MarkPropDefstringnullTypeForShape",
+    "MarkPropDefnumber",
+    "MarkPropDefnumberArray",
+    "MarkType",
+    "MergedStream",
+    "Month",
+    "MultiLineString",
+    "MultiPoint",
+    "MultiPolygon",
+    "MultiTimeUnit",
+    "NamedData",
+    "NonArgAggregateOp",
+    "NonLayerRepeatSpec",
+    "NonNormalizedSpec",
+    "NumberLocale",
+    "NumericArrayMarkPropDef",
+    "NumericMarkPropDef",
+    "OffsetDef",
+    "OrderFieldDef",
+    "OrderOnlyDef",
+    "OrderValueDef",
+    "Orient",
+    "Orientation",
+    "OverlayMarkDef",
+    "Padding",
+    "ParameterExtent",
+    "ParameterName",
+    "ParameterPredicate",
+    "Parse",
+    "ParseValue",
+    "PivotTransform",
+    "Point",
+    "PointSelectionConfig",
+    "PointSelectionConfigWithoutType",
+    "PolarDef",
+    "Polygon",
+    "Position",
+    "Position2Def",
+    "PositionDatumDef",
+    "PositionDatumDefBase",
+    "PositionDef",
+    "PositionFieldDef",
+    "PositionFieldDefBase",
+    "PositionValueDef",
+    "Predicate",
+    "PrimitiveValue",
+    "Projection",
+    "ProjectionConfig",
+    "ProjectionType",
+    "QuantileTransform",
+    "RadialGradient",
+    "RangeConfig",
+    "RangeEnum",
+    "RangeRaw",
+    "RangeRawArray",
+    "RangeScheme",
+    "RectConfig",
+    "RegressionTransform",
+    "RelativeBandSize",
+    "RepeatMapping",
+    "RepeatRef",
+    "RepeatSpec",
+    "Resolve",
+    "ResolveMode",
+    "RowColLayoutAlign",
+    "RowColboolean",
+    "RowColnumber",
+    "RowColumnEncodingFieldDef",
+    "SampleTransform",
+    "Scale",
+    "ScaleBinParams",
+    "ScaleBins",
+    "ScaleConfig",
+    "ScaleDatumDef",
+    "ScaleFieldDef",
+    "ScaleInterpolateEnum",
+    "ScaleInterpolateParams",
+    "ScaleResolveMap",
+    "ScaleType",
+    "SchemeParams",
+    "SecondaryFieldDef",
+    "SelectionConfig",
+    "SelectionInit",
+    "SelectionInitInterval",
+    "SelectionInitIntervalMapping",
+    "SelectionInitMapping",
+    "SelectionParameter",
+    "SelectionResolution",
+    "SelectionType",
+    "SequenceGenerator",
+    "SequenceParams",
+    "SequentialMultiHue",
+    "SequentialSingleHue",
+    "ShapeDef",
+    "SharedEncoding",
+    "SingleDefUnitChannel",
+    "SingleTimeUnit",
+    "Sort",
+    "SortArray",
+    "SortByChannel",
+    "SortByChannelDesc",
+    "SortByEncoding",
+    "SortField",
+    "SortOrder",
+    "SphereGenerator",
+    "StackOffset",
+    "StackTransform",
+    "StandardType",
+    "Step",
+    "StepFor",
+    "Stream",
+    "StringFieldDef",
+    "StringFieldDefWithCondition",
+    "StringValueDefWithCondition",
+    "StrokeCap",
+    "StrokeJoin",
+    "StyleConfigIndex",
+    "SymbolShape",
+    "TextBaseline",
+    "TextDef",
+    "TextDirection",
+    "TickConfig",
+    "TickCount",
+    "TimeInterval",
+    "TimeIntervalStep",
+    "TimeLocale",
+    "TimeUnit",
+    "TimeUnitParams",
+    "TimeUnitTransform",
+    "TimeUnitTransformParams",
+    "TitleAnchor",
+    "TitleConfig",
+    "TitleFrame",
+    "TitleOrient",
+    "TitleParams",
+    "TooltipContent",
+    "TopLevelConcatSpec",
+    "TopLevelHConcatSpec",
+    "TopLevelVConcatSpec",
+    "TopLevelLayerSpec",
+    "TopLevelRepeatSpec",
+    "TopLevelFacetSpec",
+    "TopLevelParameter",
+    "TopLevelSelectionParameter",
+    "TopLevelSpec",
+    "TopLevelUnitSpec",
+    "TopoDataFormat",
+    "Transform",
+    "Type",
+    "TypeForShape",
+    "TypedFieldDef",
+    "URI",
+    "UnitSpec",
+    "UnitSpecWithFrame",
+    "UrlData",
+    "UtcMultiTimeUnit",
+    "UtcSingleTimeUnit",
+    "ValueDefnumberwidthheightExprRef",
+    "ValueDefnumber",
+    "ValueDefWithConditionMarkPropFieldOrDatumDefGradientstringnull",
+    "ValueDefWithConditionMarkPropFieldOrDatumDefstringnull",
+    "ValueDefWithConditionMarkPropFieldOrDatumDefnumber",
+    "ValueDefWithConditionMarkPropFieldOrDatumDefnumberArray",
+    "ValueDefWithConditionMarkPropFieldOrDatumDefTypeForShapestringnull",
+    "ValueDefWithConditionStringFieldDefText",
+    "VariableParameter",
+    "Vector10string",
+    "Vector12string",
+    "Vector2DateTime",
+    "Vector2Vector2number",
+    "Vector2boolean",
+    "Vector2number",
+    "Vector2string",
+    "Vector3number",
+    "Vector7string",
+    "ViewBackground",
+    "ViewConfig",
+    "WindowEventType",
+    "WindowFieldDef",
+    "WindowOnlyOp",
+    "WindowTransform",
+    "Root",
+    "VegaLiteSchema",
+    "SchemaBase",
+    "load_schema",
+]
 from typing import Any, Literal, Union, Protocol, Sequence, List
 from typing import Dict as TypingDict
 from typing import Generator as TypingGenerator
diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py
--- a/tools/generate_schema_wrapper.py
+++ b/tools/generate_schema_wrapper.py
@@ -503,8 +503,22 @@ def generate_vegalite_schema_wrapper(schema_file: str) -> str:
                 assert isinstance(child.basename, list)
                 child.basename.append(name)
 
+    # Specify __all__ explicitly so that we can exclude the ones from the list
+    # of exported classes which are also defined in the channels module which takes
+    # precedent in the generated __init__.py file one level up where core.py
+    # and channels.py are imported. Importing both confuses type checkers.
+    all_ = [
+        c for c in definitions if not c.startswith("_") and c not in ("Color", "Text")
+    ] + [
+        "Root",
+        "VegaLiteSchema",
+        "SchemaBase",
+        "load_schema",
+    ]
+
     contents = [
         HEADER,
+        "__all__ = {}".format(all_),
         "from typing import Any, Literal, Union, Protocol, Sequence, List",
         "from typing import Dict as TypingDict",
         "from typing import Generator as TypingGenerator" "",
@@ -733,7 +747,7 @@ def vegalite_main(skip_download: bool = False) -> None:
     print("Writing {}".format(outfile))
     content = [
         "# ruff: noqa\n",
-        "from .core import *\nfrom .channels import *  # type: ignore[assignment]\n",
+        "from .core import *\nfrom .channels import *\n",
         f"SCHEMA_VERSION = '{version}'\n",
         "SCHEMA_URL = {!r}\n" "".format(schema_url(version)),
     ]


Test patch: