Skip to content

Commit

Permalink
Merge pull request #155 from notatallshaw/skip-backjumping-when-name-…
Browse files Browse the repository at this point in the history
…is-not-incompatible

Only backjump if the current broken state is an incompatible dependency
  • Loading branch information
pradyunsg authored Jul 30, 2024
2 parents 314dde4 + 8147ef6 commit 58c5d90
Show file tree
Hide file tree
Showing 5 changed files with 205 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/resolvelib/resolvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,11 @@ def _backjump(self, causes: list[RequirementInformation[RT, CT]]) -> bool:
except (IndexError, KeyError):
raise ResolutionImpossible(causes) from None

# Only backjump if the current broken state is
# an incompatible dependency
if name not in incompatible_deps:
break

# If the current dependencies and the incompatible dependencies
# are overlapping then we have found a cause of the incompatibility
current_dependencies = {
Expand Down
15 changes: 15 additions & 0 deletions tests/functional/python/inputs/case/backjump-test-1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"index": "backjump-test-1",
"requested": [
"parent"
],
"resolved": {
"parent": "0.0.1",
"pandas": "1.3.5",
"pystac": "1.8.3",
"pystac-client": "0.3.3",
"sat-stac": "0.1.1",
"python-dateutil": "2.7.5",
"requests": "2.31.0"
}
}
17 changes: 17 additions & 0 deletions tests/functional/python/inputs/case/backjump-test-2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"index": "backjump-test-2",
"requested": [
"a"
],
"resolved": {
"a": "0.0.1",
"b": "0.0.2",
"c": "0.0.1",
"pandas": "1.3.5",
"pystac": "1.8.3",
"pystac-client": "0.3.3",
"sat-stac": "0.1.1",
"python-dateutil": "2.7.5",
"requests": "2.31.0"
}
}
76 changes: 76 additions & 0 deletions tests/functional/python/inputs/index/backjump-test-1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"parent": {
"0.0.1": {
"dependencies": [
"pandas<=1.4.0,>=1.3.5",
"pystac<=1.8.3,>=1.8.2",
"pystac-client<=0.3.3,>=0.3.2",
"sat-stac<=0.1.1"
]
}
},
"pandas": {
"1.4.0": {
"dependencies": [
"python-dateutil (>=2.8.1)"
]
},
"1.3.5": {
"dependencies": [
"python-dateutil (>=2.7.3)"
]
}
},
"pystac": {
"1.8.3": {
"dependencies": [
"python-dateutil (>=2.7.0)"
]
},
"1.8.2": {
"dependencies": [
"python-dateutil (>=2.7.0)"
]
}
},
"pystac-client": {
"0.3.3": {
"dependencies": [
"requests (>=2.25)",
"pystac (>=1.4.0)"
]
},
"0.3.2": {
"dependencies": [
"requests (>=2.25)",
"pystac (~=1.2.0)"
]
}
},
"sat-stac": {
"0.1.1": {
"dependencies": [
"python-dateutil (~=2.7.5)"
]
},
"0.1.0": {
"dependencies": [
"requests (~=2.19.1)",
"python-dateutil (~=2.7.5)"
]
}
},
"python-dateutil": {
"2.9.0": {
"dependencies": []
},
"2.7.5": {
"dependencies": []
}
},
"requests": {
"2.31.0": {
"dependencies": []
}
}
}
92 changes: 92 additions & 0 deletions tests/functional/python/inputs/index/backjump-test-2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
{
"a": {
"0.0.1": {
"dependencies": [
"b",
"c"
]
}
},
"b": {
"0.0.1": {
"dependencies": []
},
"0.0.2": {
"dependencies": []
}
},
"c": {
"0.0.1": {
"dependencies": [
"pandas<=1.4.0,>=1.3.5",
"pystac<=1.8.3,>=1.8.2",
"pystac-client<=0.3.3,>=0.3.2",
"sat-stac<=0.1.1"
]
}
},
"pandas": {
"1.4.0": {
"dependencies": [
"python-dateutil (>=2.8.1)"
]
},
"1.3.5": {
"dependencies": [
"python-dateutil (>=2.7.3)"
]
}
},
"pystac": {
"1.8.3": {
"dependencies": [
"python-dateutil (>=2.7.0)"
]
},
"1.8.2": {
"dependencies": [
"python-dateutil (>=2.7.0)"
]
}
},
"pystac-client": {
"0.3.3": {
"dependencies": [
"requests (>=2.25)",
"pystac (>=1.4.0)"
]
},
"0.3.2": {
"dependencies": [
"requests (>=2.25)",
"pystac (~=1.2.0)"
]
}
},
"sat-stac": {
"0.1.1": {
"dependencies": [
"python-dateutil (~=2.7.5)"
]
},
"0.1.0": {
"dependencies": [
"requests (~=2.19.1)",
"python-dateutil (~=2.7.5)"
]
}
},
"python-dateutil": {
"2.9.0": {
"dependencies": []
},
"2.7.5": {
"dependencies": []
}
},
"requests": {
"2.31.0": {
"dependencies": []
}
}
}

0 comments on commit 58c5d90

Please sign in to comment.