Skip to content

Commit 2bff677

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 41a19f5 commit 2bff677

File tree

5 files changed

+829
-961
lines changed

5 files changed

+829
-961
lines changed

flake.lock

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

flake.nix

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,20 @@
1212
url = "git+https://codeberg.org/HU90m/mdutils.git";
1313
inputs.nixpkgs.follows = "nixpkgs";
1414
};
15-
poetry2nix = {
16-
url = "github:nix-community/poetry2nix";
15+
uv2nix = {
16+
url = "github:pyproject-nix/uv2nix";
17+
inputs.pyproject-nix.follows = "pyproject-nix";
1718
inputs.nixpkgs.follows = "nixpkgs";
18-
inputs.flake-utils.follows = "flake-utils";
19+
};
20+
pyproject-nix = {
21+
url = "github:pyproject-nix/pyproject.nix";
22+
inputs.nixpkgs.follows = "nixpkgs";
23+
};
24+
pyproject-build-systems = {
25+
url = "github:pyproject-nix/build-system-pkgs";
26+
inputs.nixpkgs.follows = "nixpkgs";
27+
inputs.pyproject-nix.follows = "pyproject-nix";
28+
inputs.uv2nix.follows = "uv2nix";
1929
};
2030
zermio = {
2131
url = "github:engdoreis/zermio?ref=v0.2.0";
@@ -52,18 +62,24 @@
5262
inherit (pkgs.lib) fileset getExe;
5363
zermio-cli = inputs.zermio.packages.${system}.default;
5464

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 = ./.;
65+
workspace = inputs.uv2nix.lib.workspace.loadWorkspace {workspaceRoot = ./.;};
66+
overlay = workspace.mkPyprojectOverlay {
67+
sourcePreference = "wheel";
68+
};
69+
70+
pythonSet =
71+
(pkgs.callPackage inputs.pyproject-nix.build.packages {
6172
python = pkgs.python310;
62-
overrides = [
63-
poetryOverrides
64-
poetry2nix.defaultPoetryOverrides
65-
];
66-
};
73+
}).overrideScope
74+
(
75+
pkgs.lib.composeManyExtensions [
76+
inputs.pyproject-build-systems.overlays.default
77+
overlay
78+
(lowrisc-nix.lib.pyprojectOverrides {inherit pkgs;})
79+
]
80+
);
81+
82+
pythonEnv = pythonSet.mkVirtualEnv "python-env" workspace.deps.default;
6783

6884
sonata-documentation = lrDoc.buildMdbookSite {
6985
version = "";
@@ -183,6 +199,7 @@
183199
gtkwave
184200
openfpgaloader
185201
openocd
202+
uv
186203
])
187204
++ cheriotPkgs
188205
++ (with lrPkgs; [

0 commit comments

Comments
 (0)