Skip to content

Commit e6235b4

Browse files
committed
python/uv: init
1 parent f9ee813 commit e6235b4

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

docs/release-notes/rl-0.8.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,13 @@
352352

353353
[rrvsh](https://github.com/rrvsh):
354354

355+
[uv.nvim]: https://github.com/benomahony/uv.nvim
356+
355357
- Add custom snippet support to `vim.snippets.luasnip`
356358
- Fix namespace of python-lsp-server by changing it to python3Packages
359+
- Add [uv.nvim] for integration with the uv Python package manager,
360+
allowing automatic activation of virtual environments and
361+
running code directly from Neovim. Available at `vim.languages.python.uv`.
357362

358363
[Noah765](https://github.com/Noah765):
359364

modules/plugins/languages/python.nix

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
inherit (lib.lists) isList;
1212
inherit (lib.types) enum either listOf package str bool;
1313
inherit (lib.nvim.lua) expToLua;
14+
inherit (lib.nvim.types) mkPluginSetupOption;
1415

1516
cfg = config.vim.languages.python;
1617

@@ -225,6 +226,11 @@ in {
225226
'';
226227
};
227228
};
229+
230+
uv = {
231+
enable = mkEnableOption "the uv.nvim plugin";
232+
setupOpts = mkPluginSetupOption "uv.nvim." {};
233+
};
228234
};
229235

230236
config = mkIf cfg.enable (mkMerge [
@@ -261,5 +267,16 @@ in {
261267
vim.debugger.nvim-dap.enable = true;
262268
vim.debugger.nvim-dap.sources.python-debugger = debuggers.${cfg.dap.debugger}.dapConfig;
263269
})
270+
271+
(mkIf cfg.uv.enable {
272+
vim.lazy.plugins."uv.nvim" = {
273+
package = "uv.nvim";
274+
setupModule = "uv";
275+
inherit (cfg.uv) setupOpts;
276+
# Plugin should be loaded whenever we enter a buffer
277+
# so it can load the uv virtual environment.
278+
event = ["BufEnter"];
279+
};
280+
})
264281
]);
265282
}

npins/sources.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2436,6 +2436,19 @@
24362436
"url": "https://github.com/chomosuke/typst-preview.nvim/archive/dea4525d5420b7c32eebda7de15a6beb9d6574fa.tar.gz",
24372437
"hash": "0y658l2ibq0x4cwa4rl3lab7aw4ba68xcrdnxp81p2rsk0d60qq4"
24382438
},
2439+
"uv.nvim": {
2440+
"type": "Git",
2441+
"repository": {
2442+
"type": "GitHub",
2443+
"owner": "benomahony",
2444+
"repo": "uv.nvim"
2445+
},
2446+
"branch": "main",
2447+
"submodules": false,
2448+
"revision": "642e45d392a65fe15dbebd63444e45e21a38f883",
2449+
"url": "https://github.com/benomahony/uv.nvim/archive/642e45d392a65fe15dbebd63444e45e21a38f883.tar.gz",
2450+
"hash": "1l681q5d3c8hqr1vvb4rxs6y5a1fs3m3cx3v0n6lvmlcdbdn4mjb"
2451+
},
24392452
"vim-dirtytalk": {
24402453
"type": "Git",
24412454
"repository": {

0 commit comments

Comments
 (0)