Skip to content

Commit 0da625f

Browse files
committed
feat(python)!: Split python pack into seperate smaller packs
This allows an end-user to more easily "stack" the python packs based on the tooling they use in their d2d work
1 parent 8d028f4 commit 0da625f

File tree

8 files changed

+128
-63
lines changed

8 files changed

+128
-63
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Basedpyright Python Pack
2+
3+
**Requirements:** `python` must be in your `PATH` and executable
4+
5+
This plugin pack does the following:
6+
7+
- Adds `basedpyright` language server
8+
9+
**Note:** This pack does not include Python syntax highlighting or debugging. Use [Python Pack](../python) for that.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
return {
2+
{
3+
"AstroNvim/astrolsp",
4+
optional = true,
5+
---@type AstroLSPOpts
6+
opts = {
7+
---@diagnostic disable: missing-fields
8+
config = {
9+
basedpyright = {
10+
before_init = function(_, c)
11+
if not c.settings then c.settings = {} end
12+
if not c.settings.python then c.settings.python = {} end
13+
c.settings.python.pythonPath = vim.fn.exepath "python"
14+
end,
15+
settings = {
16+
basedpyright = {
17+
analysis = {
18+
typeCheckingMode = "basic",
19+
autoImportCompletions = true,
20+
diagnosticSeverityOverrides = {
21+
reportUnusedImport = "information",
22+
reportUnusedFunction = "information",
23+
reportUnusedVariable = "information",
24+
reportGeneralTypeIssues = "none",
25+
reportOptionalMemberAccess = "none",
26+
reportOptionalSubscript = "none",
27+
reportPrivateImportUsage = "none",
28+
},
29+
},
30+
},
31+
},
32+
},
33+
},
34+
},
35+
},
36+
{
37+
"williamboman/mason-lspconfig.nvim",
38+
optional = true,
39+
opts = function(_, opts)
40+
opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "basedpyright" })
41+
end,
42+
},
43+
{
44+
"WhoIsSethDaniel/mason-tool-installer.nvim",
45+
optional = true,
46+
opts = function(_, opts)
47+
opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "basedpyright" })
48+
end,
49+
},
50+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Python Black Pack
2+
3+
**Requirements:** `python` must be in your `PATH` and executable
4+
5+
This plugin pack does the following:
6+
7+
- Adds [black](https://pypi.org/project/black/) formatter
8+
9+
**Note:** This pack does not include Python syntax highlighting or debugging. Use [Python Pack](../python) for that.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
return {
2+
{
3+
"jay-babu/mason-null-ls.nvim",
4+
optional = true,
5+
opts = function(_, opts)
6+
opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "black" })
7+
end,
8+
},
9+
{
10+
"WhoIsSethDaniel/mason-tool-installer.nvim",
11+
optional = true,
12+
opts = function(_, opts)
13+
opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "black" })
14+
end,
15+
},
16+
{
17+
"stevearc/conform.nvim",
18+
optional = true,
19+
opts = function(_, opts)
20+
if not opts.formatters_by_ft then opts.formatters_by_ft = {} end
21+
if not opts.formatters_by_ft.python then opts.formatters_by_ft.python = {} end
22+
table.insert(opts.formatters_by_ft.python, "black")
23+
end,
24+
},
25+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Python Isort Pack
2+
3+
**Requirements:** `python` must be in your `PATH` and executable
4+
5+
This plugin pack does the following:
6+
7+
- Adds [isort](https://pypi.org/project/isort/) formatter
8+
9+
**Note:** This pack does not include Python syntax highlighting or debugging. Use [Python Pack](../python) for that.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
return {
2+
{
3+
"jay-babu/mason-null-ls.nvim",
4+
optional = true,
5+
opts = function(_, opts)
6+
opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "isort" })
7+
end,
8+
},
9+
{
10+
"WhoIsSethDaniel/mason-tool-installer.nvim",
11+
optional = true,
12+
opts = function(_, opts)
13+
opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "isort" })
14+
end,
15+
},
16+
{
17+
"stevearc/conform.nvim",
18+
optional = true,
19+
opts = function(_, opts)
20+
if not opts.formatters_by_ft then opts.formatters_by_ft = {} end
21+
if not opts.formatters_by_ft.python then opts.formatters_by_ft.python = {} end
22+
table.insert(opts.formatters_by_ft.python, 1, "isort")
23+
end,
24+
},
25+
}

lua/astrocommunity/pack/python/README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,4 @@
55
This plugin pack does the following:
66

77
- Adds `python` and `toml` Treesitter parsers
8-
- Adds `basedpyright` language server
9-
- Adds the following `null-ls` sources:
10-
- [black](https://pypi.org/project/black/)
11-
- [isort](https://pypi.org/project/isort/)
128
- Adds `debugpy` for debugging
Lines changed: 1 addition & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,4 @@
11
return {
2-
{
3-
"AstroNvim/astrolsp",
4-
optional = true,
5-
---@type AstroLSPOpts
6-
opts = {
7-
---@diagnostic disable: missing-fields
8-
config = {
9-
basedpyright = {
10-
before_init = function(_, c)
11-
if not c.settings then c.settings = {} end
12-
if not c.settings.python then c.settings.python = {} end
13-
c.settings.python.pythonPath = vim.fn.exepath "python"
14-
end,
15-
settings = {
16-
basedpyright = {
17-
analysis = {
18-
typeCheckingMode = "basic",
19-
autoImportCompletions = true,
20-
diagnosticSeverityOverrides = {
21-
reportUnusedImport = "information",
22-
reportUnusedFunction = "information",
23-
reportUnusedVariable = "information",
24-
reportGeneralTypeIssues = "none",
25-
reportOptionalMemberAccess = "none",
26-
reportOptionalSubscript = "none",
27-
reportPrivateImportUsage = "none",
28-
},
29-
},
30-
},
31-
},
32-
},
33-
},
34-
},
35-
},
362
{
373
"nvim-treesitter/nvim-treesitter",
384
optional = true,
@@ -42,20 +8,6 @@ return {
428
end
439
end,
4410
},
45-
{
46-
"williamboman/mason-lspconfig.nvim",
47-
optional = true,
48-
opts = function(_, opts)
49-
opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "basedpyright" })
50-
end,
51-
},
52-
{
53-
"jay-babu/mason-null-ls.nvim",
54-
optional = true,
55-
opts = function(_, opts)
56-
opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "black", "isort" })
57-
end,
58-
},
5911
{
6012
"jay-babu/mason-nvim-dap.nvim",
6113
optional = true,
@@ -69,8 +21,7 @@ return {
6921
"WhoIsSethDaniel/mason-tool-installer.nvim",
7022
optional = true,
7123
opts = function(_, opts)
72-
opts.ensure_installed =
73-
require("astrocore").list_insert_unique(opts.ensure_installed, { "basedpyright", "black", "isort", "debugpy" })
24+
opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "debugpy" })
7425
end,
7526
},
7627
{
@@ -116,13 +67,4 @@ return {
11667
table.insert(opts.adapters, require "neotest-python"(require("astrocore").plugin_opts "neotest-python"))
11768
end,
11869
},
119-
{
120-
"stevearc/conform.nvim",
121-
optional = true,
122-
opts = {
123-
formatters_by_ft = {
124-
python = { "isort", "black" },
125-
},
126-
},
127-
},
12870
}

0 commit comments

Comments
 (0)