@narumitw/pi-python-lsp 0.1.4 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -10
- package/package.json +6 -1
package/README.md
CHANGED
|
@@ -1,16 +1,28 @@
|
|
|
1
|
-
# pi-python-lsp
|
|
1
|
+
# 🐍 pi-python-lsp — ty and Ruff Language Server Tools for Pi
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@narumitw/pi-python-lsp) [](https://pi.dev) [](./LICENSE)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
`@narumitw/pi-python-lsp` is a native [Pi coding agent](https://pi.dev) extension that exposes Python language-server tools from [ty](https://github.com/astral-sh/ty) and [Ruff](https://docs.astral.sh/ruff/).
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Use it to give Pi reliable Python type diagnostics, Ruff lint diagnostics, formatting, import organization, and source fixes through Language Server Protocol (LSP) workflows.
|
|
8
|
+
|
|
9
|
+
## ✨ Features
|
|
10
|
+
|
|
11
|
+
- Runs `ty server` on demand for Python type diagnostics.
|
|
12
|
+
- Runs `ruff server` on demand for lint diagnostics.
|
|
13
|
+
- Computes or writes Ruff formatting edits.
|
|
14
|
+
- Computes or writes Ruff source actions such as `source.fixAll.ruff` and `source.organizeImports.ruff`.
|
|
15
|
+
- Supports workspace roots, file limits, and recursive Python file discovery.
|
|
16
|
+
- Starts language servers only for tool calls, then shuts them down.
|
|
17
|
+
- Provides clear setup errors when ty or Ruff is missing.
|
|
18
|
+
|
|
19
|
+
## 📦 Install
|
|
8
20
|
|
|
9
21
|
```bash
|
|
10
22
|
pi install npm:@narumitw/pi-python-lsp
|
|
11
23
|
```
|
|
12
24
|
|
|
13
|
-
Try without installing:
|
|
25
|
+
Try without installing permanently:
|
|
14
26
|
|
|
15
27
|
```bash
|
|
16
28
|
pi -e npm:@narumitw/pi-python-lsp
|
|
@@ -22,7 +34,7 @@ Try this package locally from the repository root:
|
|
|
22
34
|
pi -e ./extensions/pi-python-lsp
|
|
23
35
|
```
|
|
24
36
|
|
|
25
|
-
## Requirements
|
|
37
|
+
## ✅ Requirements
|
|
26
38
|
|
|
27
39
|
Install `ty` and/or `ruff` somewhere on `PATH`, for example:
|
|
28
40
|
|
|
@@ -43,14 +55,16 @@ Optional timeout overrides:
|
|
|
43
55
|
PI_TY_LSP_TIMEOUT_MS=30000 PI_RUFF_LSP_TIMEOUT_MS=30000 pi -e ./extensions/pi-python-lsp
|
|
44
56
|
```
|
|
45
57
|
|
|
46
|
-
##
|
|
58
|
+
## 🛠️ Pi tools
|
|
47
59
|
|
|
48
60
|
- `ty_lsp_diagnostics` — start `ty server`, open Python files, and return type diagnostics.
|
|
49
61
|
- `ruff_lsp_diagnostics` — start `ruff server`, open Python files, and return lint diagnostics.
|
|
50
62
|
- `ruff_lsp_format` — compute or write Ruff formatting edits for one Python file.
|
|
51
63
|
- `ruff_lsp_fix` — compute or write Ruff source actions such as `source.fixAll.ruff` or `source.organizeImports.ruff`.
|
|
52
64
|
|
|
53
|
-
Examples
|
|
65
|
+
## 🚀 Examples
|
|
66
|
+
|
|
67
|
+
Check a Python project with ty or Ruff diagnostics:
|
|
54
68
|
|
|
55
69
|
```json
|
|
56
70
|
{
|
|
@@ -59,6 +73,8 @@ Examples:
|
|
|
59
73
|
}
|
|
60
74
|
```
|
|
61
75
|
|
|
76
|
+
Format a Python file with Ruff:
|
|
77
|
+
|
|
62
78
|
```json
|
|
63
79
|
{
|
|
64
80
|
"path": "src/app.py",
|
|
@@ -66,6 +82,8 @@ Examples:
|
|
|
66
82
|
}
|
|
67
83
|
```
|
|
68
84
|
|
|
85
|
+
Organize imports with Ruff:
|
|
86
|
+
|
|
69
87
|
```json
|
|
70
88
|
{
|
|
71
89
|
"path": "src/app.py",
|
|
@@ -76,7 +94,7 @@ Examples:
|
|
|
76
94
|
|
|
77
95
|
If `paths` is omitted for diagnostics, the tool recursively discovers Python files under the workspace root, skipping common cache and virtualenv directories.
|
|
78
96
|
|
|
79
|
-
## Command
|
|
97
|
+
## 💬 Command
|
|
80
98
|
|
|
81
99
|
```text
|
|
82
100
|
/python-lsp
|
|
@@ -84,7 +102,15 @@ If `paths` is omitted for diagnostics, the tool recursively discovers Python fil
|
|
|
84
102
|
|
|
85
103
|
Shows the configured ty and Ruff LSP commands and whether each command is available on `PATH`.
|
|
86
104
|
|
|
87
|
-
##
|
|
105
|
+
## 🧠 Use cases
|
|
106
|
+
|
|
107
|
+
- Let Pi typecheck Python code with ty before completing a task.
|
|
108
|
+
- Ask Pi to run Ruff lint diagnostics while editing.
|
|
109
|
+
- Format Python files through a native Pi tool.
|
|
110
|
+
- Organize imports and apply safe Ruff fixes.
|
|
111
|
+
- Add Python quality gates to AI coding agent workflows.
|
|
112
|
+
|
|
113
|
+
## 🗂️ Package layout
|
|
88
114
|
|
|
89
115
|
```txt
|
|
90
116
|
extensions/pi-python-lsp/
|
|
@@ -95,3 +121,11 @@ extensions/pi-python-lsp/
|
|
|
95
121
|
├── tsconfig.json
|
|
96
122
|
└── package.json
|
|
97
123
|
```
|
|
124
|
+
|
|
125
|
+
## 🔎 Keywords
|
|
126
|
+
|
|
127
|
+
Pi extension, Pi coding agent, Python LSP, ty, Ruff, Python type checking, Python linting, Python formatter, import organization, Language Server Protocol, AI coding tools.
|
|
128
|
+
|
|
129
|
+
## 📄 License
|
|
130
|
+
|
|
131
|
+
MIT. See [`LICENSE`](./LICENSE).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@narumitw/pi-python-lsp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"description": "Pi extension that exposes ty and Ruff language-server tools for Python.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -39,5 +39,10 @@
|
|
|
39
39
|
"@mariozechner/pi-coding-agent": "0.73.0",
|
|
40
40
|
"@types/node": "25.6.0",
|
|
41
41
|
"typescript": "6.0.3"
|
|
42
|
+
},
|
|
43
|
+
"repository": {
|
|
44
|
+
"type": "git",
|
|
45
|
+
"url": "https://github.com/narumiruna/pi-extensions",
|
|
46
|
+
"directory": "extensions/pi-python-lsp"
|
|
42
47
|
}
|
|
43
48
|
}
|