Skip to content

Commit

Permalink
feat(pack)!: Split python pack into python and python-ruff (#603)
Browse files Browse the repository at this point in the history
* feat(pack): Split python pack into python and python-ruff

* fix(python-ruff): Don't use black and isort in ruff pack
  • Loading branch information
Uzaaft authored Oct 17, 2023
1 parent c624e8a commit e0615a4
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 4 deletions.
11 changes: 11 additions & 0 deletions lua/astrocommunity/pack/python-ruff/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Python Ruff Language Pack

**Requirements:** `python` must be in your `PATH` and executable

This plugin pack does the following:

- Adds `python` and `toml` Treesitter parsers
- Adds `pyright` and `ruff_lsp` language servers
- Adds the following `null-ls` sources:
- [ruff](https://pypi.org/project/ruff/)
- Adds `debugpy` for debugging
43 changes: 43 additions & 0 deletions lua/astrocommunity/pack/python-ruff/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
local utils = require "astronvim.utils"
return {
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if opts.ensure_installed ~= "all" then
opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, { "python", "toml" })
end
end,
},
{
"williamboman/mason-lspconfig.nvim",
opts = function(_, opts)
opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, { "pyright", "ruff_lsp" })
end,
},
{
"jay-babu/mason-null-ls.nvim",
opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, { "ruff" }) end,
},
{
"jay-babu/mason-nvim-dap.nvim",
opts = function(_, opts)
opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "python")
if not opts.handlers then opts.handlers = {} end
opts.handlers.python = function() end -- make sure python doesn't get set up by mason-nvim-dap, it's being set up by nvim-dap-python
end,
},
{
"linux-cultist/venv-selector.nvim",
opts = {},
keys = { { "<leader>lv", "<cmd>:VenvSelect<cr>", desc = "Select VirtualEnv" } },
},
{
"mfussenegger/nvim-dap-python",
dependencies = "mfussenegger/nvim-dap",
ft = "python", -- NOTE: ft: lazy-load on filetype
config = function(_, opts)
local path = require("mason-registry").get_package("debugpy"):get_install_path() .. "/venv/bin/python"
require("dap-python").setup(path, opts)
end,
},
}
2 changes: 1 addition & 1 deletion lua/astrocommunity/pack/python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
This plugin pack does the following:

- Adds `python` and `toml` Treesitter parsers
- Adds `pyright` and `ruff_lsp` language servers
- Adds `pyright` language servers
- Adds the following `null-ls` sources:
- [black](https://pypi.org/project/black/)
- [isort](https://pypi.org/project/isort/)
Expand Down
4 changes: 1 addition & 3 deletions lua/astrocommunity/pack/python/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ return {
},
{
"williamboman/mason-lspconfig.nvim",
opts = function(_, opts)
opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, { "pyright", "ruff_lsp" })
end,
opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, { "pyright" }) end,
},
{
"jay-babu/mason-null-ls.nvim",
Expand Down

0 comments on commit e0615a4

Please sign in to comment.