Allow package references as version specifiers

I’ve opened Suggest how stub packages can be tied to the appropriate version of their parent package · Issue #1264 · python/typing · GitHub to suggest that provide guidance on those typing docs.

Agreed. But I don’t know of any mechanism to do this short of standardising, and the point of letting backends come up with something is so that they can iterate on the best solution - which means standardising prematurely is not the right approach.

But I’m a strong +1 on backend developers co-operating on a solution (which could then be standardised if appropriate). Maybe use a shared pyproject.toml section, such as [tool.shared] for this?

1 Like

It would be very helpful to have a mechanism to specify a version constraint for a group of dependencies that rely on each other. However, I wouldn’t be keen to directly reference using @= because that’s too arbitrary and can easily result in more dependency resolution issues. Instead, it would be useful to introduce a notion of “group” where packages can belong to. For instance for grpc packages we could have:

dependencies = [
    "group.grpc >=1.46.0,<2.0.0",
    "grpcio: group.grpc",
    "grpcio-tools: group.grpc",
]

And that would only work when the packages belong to the same group.

2 Likes