Skip to content

Commit 86109ef

Browse files
committed
Change the python package manager from poetry to uv
Opentitan has has been using uv for months, so this repo will better support using uv. Signed-off-by: Douglas Reis <[email protected]>
1 parent cb214af commit 86109ef

File tree

5 files changed

+823
-875
lines changed

5 files changed

+823
-875
lines changed

flake.lock

Lines changed: 30 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,21 @@
1717
inputs.nixpkgs.follows = "nixpkgs";
1818
inputs.flake-utils.follows = "flake-utils";
1919
};
20+
uv2nix = {
21+
url = "github:pyproject-nix/uv2nix";
22+
inputs.pyproject-nix.follows = "pyproject-nix";
23+
inputs.nixpkgs.follows = "nixpkgs";
24+
};
25+
pyproject-nix = {
26+
url = "github:pyproject-nix/pyproject.nix";
27+
inputs.nixpkgs.follows = "nixpkgs";
28+
};
29+
pyproject-build-systems = {
30+
url = "github:pyproject-nix/build-system-pkgs";
31+
inputs.nixpkgs.follows = "nixpkgs";
32+
inputs.pyproject-nix.follows = "pyproject-nix";
33+
inputs.uv2nix.follows = "uv2nix";
34+
};
2035
zermio = {
2136
url = "github:engdoreis/zermio?ref=v0.2.0";
2237
};
@@ -52,18 +67,24 @@
5267
inherit (pkgs.lib) fileset getExe;
5368
zermio-cli = inputs.zermio.packages.${system}.default;
5469

55-
pythonEnv = let
56-
poetry2nix = inputs.poetry2nix.lib.mkPoetry2Nix {inherit pkgs;};
57-
poetryOverrides = lowrisc-nix.lib.poetryOverrides {inherit pkgs;};
58-
in
59-
poetry2nix.mkPoetryEnv {
60-
projectDir = ./.;
70+
workspace = inputs.uv2nix.lib.workspace.loadWorkspace {workspaceRoot = ./.;};
71+
overlay = workspace.mkPyprojectOverlay {
72+
sourcePreference = "wheel";
73+
};
74+
75+
pythonSet =
76+
(pkgs.callPackage inputs.pyproject-nix.build.packages {
6177
python = pkgs.python310;
62-
overrides = [
63-
poetryOverrides
64-
poetry2nix.defaultPoetryOverrides
65-
];
66-
};
78+
}).overrideScope
79+
(
80+
pkgs.lib.composeManyExtensions [
81+
inputs.pyproject-build-systems.overlays.default
82+
overlay
83+
(lowrisc-nix.lib.pyprojectOverrides {inherit pkgs;})
84+
]
85+
);
86+
87+
pythonEnv = pythonSet.mkVirtualEnv "python-env" workspace.deps.default;
6788

6889
sonata-documentation = lrDoc.buildMdbookSite {
6990
version = "";

0 commit comments

Comments
 (0)