1313import  pathlib  as  _pathlib 
1414import  subprocess  as  _subprocess 
1515import  sys  as  _sys 
16+ from  typing  import  cast 
1617
1718import  setuptools  as  _setuptools 
1819import  setuptools .command .build  as  _build_command 
@@ -38,24 +39,31 @@ class CompileProto(_setuptools.Command):
3839    description : str  =  "compile protobuf files" 
3940    """Description of the command.""" 
4041
41-     user_options : list [tuple [str , str  |  None , str ]] =  [
42-         (
43-             "proto-path=" ,
44-             None ,
45-             "path of the root directory containing the protobuf files" ,
46-         ),
47-         ("proto-glob=" , None , "glob pattern to use to find the protobuf files" ),
48-         (
49-             "include-paths=" ,
50-             None ,
51-             "comma-separated list of paths to include when compiling the protobuf files" ,
52-         ),
53-         (
54-             "py-path=" ,
55-             None ,
56-             "path of the root directory where the Python files will be generated" ,
57-         ),
58-     ]
42+     # We need the cast here because Command.user_options has the type annoatation 
43+     # ClassVar[list[tuple[str, str, str]] | list[tuple[str, str | None, str]]] but the 
44+     # expression resolves to list[tuple[str, None, str]] and mypy is not smart enough to 
45+     # see that this is compatible with the list[tuple[str, str | None, str]] variant. 
46+     user_options  =  cast (
47+         list [tuple [str , str , str ]] |  list [tuple [str , str  |  None , str ]],
48+         [
49+             (
50+                 "proto-path=" ,
51+                 None ,
52+                 "path of the root directory containing the protobuf files" ,
53+             ),
54+             ("proto-glob=" , None , "glob pattern to use to find the protobuf files" ),
55+             (
56+                 "include-paths=" ,
57+                 None ,
58+                 "comma-separated list of paths to include when compiling the protobuf files" ,
59+             ),
60+             (
61+                 "py-path=" ,
62+                 None ,
63+                 "path of the root directory where the Python files will be generated" ,
64+             ),
65+         ],
66+     )
5967    """Options of the command.""" 
6068
6169    def  initialize_options (self ) ->  None :
0 commit comments