https://pantsbuild.org/ logo
#development
Title
# development
h

hundreds-father-404

10/29/2020, 4:23 AM
Hey does anyone know of a class of algorithms to statically identify that the constraint
==2.7 & ==3.6
is impossible to satisfy? In https://github.com/pantsbuild/pants/issues/11072, I thought I could use boolean algebra. For example, we can simplify
(==2.7 | >=3.6) & >=3.6
to simply `>=3.6`; i.e.
(x | y) & x => x
. But that only covers a couple edge cases.
cc @chilly-magazine-21545
I think this is the boolean satisfiability problem / SAT, iiuc https://en.wikipedia.org/wiki/Boolean_satisfiability_problem. And iiuc, implementing this is essentially what tools like Cargo, Pip’s new resolver, and Poetry/Pipenv do.
j

jolly-midnight-72759

10/29/2020, 2:46 PM
The experimentalist in me suggest the algorithm of taking the list of all released versions of python (a finite set) and compare their truthiness with each item in the list of constraints (another finite set). This will give you an empty set or a set of python versions that can map to a simplified constraint list.