Closed pradyunsg closed 11 months ago
Thanks @pradyunsg - it looks like @layday has already done a detailed review of the annotations, so I'll skip doing that.
My inclination is to be fairly conservative with Python version support, since this is meant to be a boring piece of low-level infrastructure that doesn't change often. I see pip hasn't dropped 3.7 support yet, so I'd suggest we don't here either. But I'm not going to argue about this if you really want to.
The latest commit makes it possible to do...
if TYPE_CHECKING:
from pyproject_hooks import SubprocessRunner
And then annotate subprocess runners using that type.
Instead of leaving that as a comment, I've gone ahead and documented that.
Wouldn’t it make sense to allow SubprocessRunner
at runtime on Python 3.8+? So this interface oddity will go away once 3.7 is dropped? Another idea (if it’s not runtime checkable) is to just make it a dummy object at runtime, so downstream code isn’t forced into extra TYPE_CHECKING checks.
That's what we do with the IsolatedEnv
in build, it's a simple ABC
at runtime on Python 3.7.
On the basis of "this is better than status quo", I'm gonna go ahead and merge this.
There's a couple of potential follow ups to improve this further:
(I'll fix the documentation build separately)
Closes #90