PEP 751: one last time

The edge case I’m thinking of is if two extras have different constraints on the same package suck that the resolved version is different when both extras are selected than when either one is selected on its own.

I think the only way to make this happen is to have at least one extra exclude specific versions. For example, imagine pkg_a has version 1.0, 1.5, and 2.0. extra-1 depends on pkg_a with the version constraint >=1.0,!=1.5 while extra-2 depends on pkg_a with the version constraint <2.0. Further assume the locker allows for incompatible extras and favors selecting the highest allowed version of all dependencies.

In that scenario, extra-1 on its own requires pkg_a version 2.0, extra-2 on its own requires pkg_a version 1.5, but activating both extra-1 and extra-2 would require pkg_a version 1.0. How would that be expressed without an … and … construction?

1 Like