Allow package references as version specifiers

I’d like to clarify and perhaps expand with a more general example:

We see many packages out there, popular ones included, that don’t contain typing annotations. For example, issue #795 of the Babel package discusses the problem and hints at a second package in Typeshed. Fortunately, these two are versioned in lock-step:

  • Babel is currently at release v2.10.2 and
  • Its type stubs are declared as v2.10.* which matches.

If I’d like to use Babel and its types then the above idea would enable me to specify

dependencies = [
    "babel >=2.8.0,<2.11.0",
    "types-babel @=babel",
]

and whichever tool resolves package dependencies would ensure that both package versions are the same within the specified range.

Of course, packages whose types are not versioned in lockstep with their package would fail here.

@ofek I’m curious to learn more about your suggestion—it would require me to switch from Flit to Hatch I assume, and then… ?