<p dir="auto">Will scikit-learn accept pull requests for low-level code with static type hints? Does it ever plan to?</p>
<p dir="auto">I don't know where the core team stands on static type hints in Python, but I think they make it 10x easier to grok code and convert users to contributors.</p>
<p dir="auto">2018 seems like a great time to make this change, in light of Numpy dropping support for new features in Python 2.7. <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="325075164" data-permission-text="Title is private" data-url="https://github.com/scikit-learn/scikit-learn/issues/11115" data-hovercard-type="issue" data-hovercard-url="/scikit-learn/scikit-learn/issues/11115/hovercard" href="https://github.com/scikit-learn/scikit-learn/issues/11115">#11115</a></p>
<p dir="auto">Supported version would need to change from <code class="notranslate">Python (&gt;= 2.7 or &gt;= 3.4)</code> to <code class="notranslate">Python (&gt;= 3.5)</code> to support static type hints.</p>
<h4 dir="auto">Describe the workflow you want to enable</h4>
<p dir="auto">Support Python typing, which is available in Python 3.5+, compatible with scikit-learn. This can enable tools to automatically get the estimator arg types (e.g., linters), for example. And it's a Python standard now.</p>
<h4 dir="auto">Describe your proposed solution</h4>
<p dir="auto">For example, <code class="notranslate">SVC</code> could be like this:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="def __init__(
    self,
     C: float = 1.0,
     kernel: Union[Callable[[np.ndarray, np.ndarray], np.ndarray],
                   Literal[&quot;linear&quot;, &quot;poly&quot;, &quot;rbf&quot;, &quot;sigmoid&quot;, &quot;precomputed&quot;]] = &quot;rbf&quot;,
     degree: int = 3,
     gamma: Union[float, Literal[&quot;scale&quot;, &quot;auto&quot;]] = &quot;scale&quot;,
     coef0: float = 0.0,
     shrinking: bool = True,
     probability: bool = False,
     tol: float = 1e-3,
     cache_size: int = 200,
     class_weight: Optional[Union[Mapping[int, float], Literal[&quot;balanced&quot;]]] = None,
     verbose: bool = False,
     max_iter: int = -1,
     decision_function_shape: Literal[&quot;ovo&quot;, &quot;ovr&quot;] = &quot;ovr&quot;,
     break_ties: bool = False,
     random_state: Optional[Union[int, RandomState]] = None,
 ) -&gt; None:"><pre class="notranslate"><span class="pl-k">def</span> <span class="pl-en">__init__</span>(
    <span class="pl-s1">self</span>,
     <span class="pl-v">C</span>: <span class="pl-s1">float</span> <span class="pl-c1">=</span> <span class="pl-c1">1.0</span>,
     <span class="pl-s1">kernel</span>: <span class="pl-v">Union</span>[<span class="pl-v">Callable</span>[[<span class="pl-s1">np</span>.<span class="pl-s1">ndarray</span>, <span class="pl-s1">np</span>.<span class="pl-s1">ndarray</span>], <span class="pl-s1">np</span>.<span class="pl-s1">ndarray</span>],
                   <span class="pl-v">Literal</span>[<span class="pl-s">"linear"</span>, <span class="pl-s">"poly"</span>, <span class="pl-s">"rbf"</span>, <span class="pl-s">"sigmoid"</span>, <span class="pl-s">"precomputed"</span>]] <span class="pl-c1">=</span> <span class="pl-s">"rbf"</span>,
     <span class="pl-s1">degree</span>: <span class="pl-s1">int</span> <span class="pl-c1">=</span> <span class="pl-c1">3</span>,
     <span class="pl-s1">gamma</span>: <span class="pl-v">Union</span>[<span class="pl-s1">float</span>, <span class="pl-v">Literal</span>[<span class="pl-s">"scale"</span>, <span class="pl-s">"auto"</span>]] <span class="pl-c1">=</span> <span class="pl-s">"scale"</span>,
     <span class="pl-s1">coef0</span>: <span class="pl-s1">float</span> <span class="pl-c1">=</span> <span class="pl-c1">0.0</span>,
     <span class="pl-s1">shrinking</span>: <span class="pl-s1">bool</span> <span class="pl-c1">=</span> <span class="pl-c1">True</span>,
     <span class="pl-s1">probability</span>: <span class="pl-s1">bool</span> <span class="pl-c1">=</span> <span class="pl-c1">False</span>,
     <span class="pl-s1">tol</span>: <span class="pl-s1">float</span> <span class="pl-c1">=</span> <span class="pl-c1">1e-3</span>,
     <span class="pl-s1">cache_size</span>: <span class="pl-s1">int</span> <span class="pl-c1">=</span> <span class="pl-c1">200</span>,
     <span class="pl-s1">class_weight</span>: <span class="pl-v">Optional</span>[<span class="pl-v">Union</span>[<span class="pl-v">Mapping</span>[<span class="pl-s1">int</span>, <span class="pl-s1">float</span>], <span class="pl-v">Literal</span>[<span class="pl-s">"balanced"</span>]]] <span class="pl-c1">=</span> <span class="pl-c1">None</span>,
     <span class="pl-s1">verbose</span>: <span class="pl-s1">bool</span> <span class="pl-c1">=</span> <span class="pl-c1">False</span>,
     <span class="pl-s1">max_iter</span>: <span class="pl-s1">int</span> <span class="pl-c1">=</span> <span class="pl-c1">-</span><span class="pl-c1">1</span>,
     <span class="pl-s1">decision_function_shape</span>: <span class="pl-v">Literal</span>[<span class="pl-s">"ovo"</span>, <span class="pl-s">"ovr"</span>] <span class="pl-c1">=</span> <span class="pl-s">"ovr"</span>,
     <span class="pl-s1">break_ties</span>: <span class="pl-s1">bool</span> <span class="pl-c1">=</span> <span class="pl-c1">False</span>,
     <span class="pl-s1">random_state</span>: <span class="pl-v">Optional</span>[<span class="pl-v">Union</span>[<span class="pl-s1">int</span>, <span class="pl-v">RandomState</span>]] <span class="pl-c1">=</span> <span class="pl-c1">None</span>,
 ) <span class="pl-c1">-&gt;</span> <span class="pl-c1">None</span>:</pre></div>
<h4 dir="auto">Describe alternatives you've considered, if relevant</h4>
<p dir="auto">An alternative is to keep the types just in the docstrings. However, is hard for tools to parse the arg types.</p>