Skip to content

Commit

Permalink
Add support for conflicting resolutions
Browse files Browse the repository at this point in the history
  • Loading branch information
adisbladis committed Jan 8, 2025
1 parent 7b6d7da commit b088856
Show file tree
Hide file tree
Showing 28 changed files with 324 additions and 12 deletions.
31 changes: 30 additions & 1 deletion dev/checks.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,14 @@ let
pythonEnv =
let
# Generate overlay
overlay = ws.mkPyprojectOverlay { inherit sourcePreference environ; };
overlay = ws.mkPyprojectOverlay (
{
inherit sourcePreference environ;
}
// lib.optionalAttrs (spec != { }) {
dependencies = spec;
}
);

# Construct package set
pythonSet =
Expand Down Expand Up @@ -202,6 +209,28 @@ let
'';
};

conflictsA = mkCheck {
name = "conflicts-group-a";
root = ../lib/fixtures/conflicts;
spec = {
conflicts = [ "extra-a" ];
};
check = ''
python -c 'import arpeggio'
'';
};

conflictsB = mkCheck {
name = "conflicts-group-b";
root = ../lib/fixtures/conflicts;
spec = {
conflicts = [ "extra-b" ];
};
check = ''
python -c 'import arpeggio'
'';
};

editable-workspace =
let
workspaceRoot = ../lib/fixtures/workspace;
Expand Down
10 changes: 5 additions & 5 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@
self.formatter.${system}
pkgs.npins
] ++ self.packages.${system}.doc.nativeBuildInputs;

shellHook = ''
export UV_NO_SYNC=1
export UV_PYTHON_DOWNLOADS=never
'';
env = {
UV_NO_SYNC = "1";
UV_PYTHON_DOWNLOADS = "never";
UV_PYTHON = pkgs.python3.interpreter;
};
};
in
{
Expand Down
46 changes: 46 additions & 0 deletions lib/expected/lock1.parseLock.testConflicts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"conflicts": [
[
{
"extra": "extra-a",
"package": "conflicts"
},
{
"extra": "extra-b",
"package": "conflicts"
},
{
"group": "group-c",
"package": "conflicts"
}
]
],
"manifest": {
"members": []
},
"options": {
"exclude-newer": null,
"prerelease-mode": null,
"resolution-mode": null
},
"requires-python": [
{
"op": ">=",
"version": {
"dev": null,
"epoch": 0,
"local": null,
"post": null,
"pre": null,
"release": [
3,
12
],
"str": "3.12"
}
}
],
"resolution-markers": {},
"supported-markers": [],
"version": 1
}
1 change: 1 addition & 0 deletions lib/expected/lock1.parseLock.testKitchenSinkA.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"conflicts": [],
"manifest": {
"members": []
},
Expand Down
1 change: 1 addition & 0 deletions lib/expected/lock1.parseLock.testKitchenSinkB.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"conflicts": [],
"manifest": {
"members": []
},
Expand Down
1 change: 1 addition & 0 deletions lib/expected/lock1.parseLock.testKitchenSinkCEditable.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"conflicts": [],
"manifest": {
"members": []
},
Expand Down
1 change: 1 addition & 0 deletions lib/expected/lock1.parseLock.testMultiChoicePackage.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"conflicts": [],
"manifest": {
"members": []
},
Expand Down
1 change: 1 addition & 0 deletions lib/expected/lock1.parseLock.testMultiPythons.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"conflicts": [],
"manifest": {
"members": [
"multi-depends",
Expand Down
1 change: 1 addition & 0 deletions lib/expected/lock1.parseLock.testNo-binary-no-build.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"conflicts": [],
"manifest": {
"members": []
},
Expand Down
1 change: 1 addition & 0 deletions lib/expected/lock1.parseLock.testNo-binary.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"conflicts": [],
"manifest": {
"members": []
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"conflicts": [],
"manifest": {
"members": []
},
Expand Down
1 change: 1 addition & 0 deletions lib/expected/lock1.parseLock.testNo-build.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"conflicts": [],
"manifest": {
"members": []
},
Expand Down
1 change: 1 addition & 0 deletions lib/expected/lock1.parseLock.testNoDeps.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"conflicts": [],
"manifest": {
"members": []
},
Expand Down
1 change: 1 addition & 0 deletions lib/expected/lock1.parseLock.testOptionalDeps.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"conflicts": [],
"manifest": {
"members": []
},
Expand Down
1 change: 1 addition & 0 deletions lib/expected/lock1.parseLock.testTrivial.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"conflicts": [],
"manifest": {
"members": []
},
Expand Down
1 change: 1 addition & 0 deletions lib/expected/lock1.parseLock.testWithExtra.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"conflicts": [],
"manifest": {
"members": []
},
Expand Down
1 change: 1 addition & 0 deletions lib/expected/lock1.parseLock.testWithResolverOptions.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"conflicts": [],
"manifest": {
"members": []
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"conflicts": [],
"manifest": {
"members": []
},
Expand Down
1 change: 1 addition & 0 deletions lib/expected/lock1.parseLock.testWithToolUvDevDeps.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"conflicts": [],
"manifest": {
"members": []
},
Expand Down
1 change: 1 addition & 0 deletions lib/expected/lock1.parseLock.testWorkspace.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"conflicts": [],
"manifest": {
"members": [
"workspace",
Expand Down
1 change: 1 addition & 0 deletions lib/expected/lock1.parseLock.testWorkspaceFlat.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"conflicts": [],
"manifest": {
"members": [
"pkg-a",
Expand Down
Empty file.
36 changes: 36 additions & 0 deletions lib/fixtures/conflicts/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[project]
name = "conflicts"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
authors = [
{ name = "adisbladis", email = "[email protected]" }
]
requires-python = ">=3.12"
dependencies = []

[project.optional-dependencies]
extra-a = [
"arpeggio==2.0.0",
]
extra-b = [
"arpeggio==2.0.1",
]

[dependency-groups]
group-c = [
"arpeggio==2.0.0",
]

[tool.uv]
conflicts = [
[
{ extra = "extra-a" },
{ extra = "extra-b" },
{ group = "group-c" },
],
]

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
2 changes: 2 additions & 0 deletions lib/fixtures/conflicts/src/conflicts/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def main() -> None:
print("Hello from conflicts!")
52 changes: 52 additions & 0 deletions lib/fixtures/conflicts/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b088856

Please sign in to comment.