pytest-language-server 0.3.0__py3-none-win32.whl
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.
|
Binary file
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pytest-language-server
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Classifier: Development Status :: 4 - Beta
|
|
5
|
+
Classifier: Intended Audience :: Developers
|
|
6
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
12
|
+
Classifier: Programming Language :: Rust
|
|
13
|
+
Classifier: Topic :: Software Development :: Testing
|
|
14
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Summary: A blazingly fast Language Server Protocol implementation for pytest
|
|
17
|
+
Keywords: pytest,lsp,language-server,testing
|
|
18
|
+
Author-email: Thiago Bellini Ribeiro <hackedbellini@gmail.com>
|
|
19
|
+
License: MIT
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
22
|
+
Project-URL: Homepage, https://github.com/bellini666/pytest-language-server
|
|
23
|
+
Project-URL: Repository, https://github.com/bellini666/pytest-language-server
|
|
24
|
+
Project-URL: Issues, https://github.com/bellini666/pytest-language-server/issues
|
|
25
|
+
|
|
26
|
+
# pytest-language-server 🔥
|
|
27
|
+
|
|
28
|
+
> **Shamelessly vibed into existence** 🤖✨
|
|
29
|
+
>
|
|
30
|
+
> This entire LSP implementation was built from scratch in a single AI-assisted coding session.
|
|
31
|
+
> No template. No boilerplate. Just pure vibes and Rust. That's right - a complete, working
|
|
32
|
+
> Language Server Protocol implementation for pytest, vibed into reality through the power of
|
|
33
|
+
> modern AI tooling. Even this message about vibing was vibed into existence.
|
|
34
|
+
|
|
35
|
+
A blazingly fast Language Server Protocol (LSP) implementation for pytest, built with Rust.
|
|
36
|
+
|
|
37
|
+
## Features
|
|
38
|
+
|
|
39
|
+
### 🎯 Go to Definition
|
|
40
|
+
Jump directly to fixture definitions from anywhere they're used:
|
|
41
|
+
- Local fixtures in the same file
|
|
42
|
+
- Fixtures in `conftest.py` files
|
|
43
|
+
- Third-party fixtures from pytest plugins (pytest-mock, pytest-asyncio, etc.)
|
|
44
|
+
- Respects pytest's fixture shadowing/priority rules
|
|
45
|
+
|
|
46
|
+
### 🔍 Find References
|
|
47
|
+
Find all usages of a fixture across your entire test suite:
|
|
48
|
+
- Works from fixture definitions or usage sites
|
|
49
|
+
- Character-position aware (distinguishes between fixture name and parameters)
|
|
50
|
+
- Shows references in all test files
|
|
51
|
+
|
|
52
|
+
### 📚 Hover Documentation
|
|
53
|
+
View fixture information on hover:
|
|
54
|
+
- Fixture signature
|
|
55
|
+
- Source file location
|
|
56
|
+
- Docstring (with proper formatting and dedenting)
|
|
57
|
+
- Markdown support in docstrings
|
|
58
|
+
|
|
59
|
+
### ⚡️ Performance
|
|
60
|
+
Built with Rust for maximum performance:
|
|
61
|
+
- Fast workspace scanning with concurrent file processing
|
|
62
|
+
- Efficient AST parsing using rustpython-parser
|
|
63
|
+
- Lock-free data structures with DashMap
|
|
64
|
+
- Minimal memory footprint
|
|
65
|
+
|
|
66
|
+
## Installation
|
|
67
|
+
|
|
68
|
+
Choose your preferred installation method:
|
|
69
|
+
|
|
70
|
+
### 📦 PyPI (Recommended)
|
|
71
|
+
|
|
72
|
+
The easiest way to install for Python projects:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# Using uv (recommended)
|
|
76
|
+
uv tool install pytest-language-server
|
|
77
|
+
|
|
78
|
+
# Or with pip
|
|
79
|
+
pip install pytest-language-server
|
|
80
|
+
|
|
81
|
+
# Or with pipx (isolated environment)
|
|
82
|
+
pipx install pytest-language-server
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### 🍺 Homebrew (macOS/Linux)
|
|
86
|
+
|
|
87
|
+
Install via Homebrew for system-wide availability:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
brew install bellini666/tap/pytest-language-server
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
To add the tap first:
|
|
94
|
+
```bash
|
|
95
|
+
brew tap bellini666/tap https://github.com/bellini666/pytest-language-server
|
|
96
|
+
brew install pytest-language-server
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### 🦀 Cargo (Rust)
|
|
100
|
+
|
|
101
|
+
Install from crates.io if you have Rust installed:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
cargo install pytest-language-server
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### 📥 Pre-built Binaries
|
|
108
|
+
|
|
109
|
+
Download pre-built binaries from the [GitHub Releases](https://github.com/bellini666/pytest-language-server/releases) page.
|
|
110
|
+
|
|
111
|
+
Available for:
|
|
112
|
+
- **Linux**: x86_64, aarch64, armv7 (glibc and musl)
|
|
113
|
+
- **macOS**: Intel and Apple Silicon
|
|
114
|
+
- **Windows**: x64 and x86
|
|
115
|
+
|
|
116
|
+
### 🔨 From Source
|
|
117
|
+
|
|
118
|
+
Build from source for development or customization:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
git clone https://github.com/bellini666/pytest-language-server
|
|
122
|
+
cd pytest-language-server
|
|
123
|
+
cargo build --release
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
The binary will be at `target/release/pytest-language-server`.
|
|
127
|
+
|
|
128
|
+
## Setup
|
|
129
|
+
|
|
130
|
+
### Neovim (with nvim-lspconfig)
|
|
131
|
+
|
|
132
|
+
```lua
|
|
133
|
+
require'lspconfig'.pytest_lsp.setup{
|
|
134
|
+
cmd = { "pytest-language-server" },
|
|
135
|
+
filetypes = { "python" },
|
|
136
|
+
root_dir = function(fname)
|
|
137
|
+
return require'lspconfig'.util.root_pattern('pyproject.toml', 'setup.py', 'setup.cfg', 'pytest.ini')(fname)
|
|
138
|
+
end,
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### VS Code
|
|
143
|
+
|
|
144
|
+
Install the extension from the marketplace (coming soon) or configure manually:
|
|
145
|
+
|
|
146
|
+
```json
|
|
147
|
+
{
|
|
148
|
+
"pytest-language-server.enable": true,
|
|
149
|
+
"pytest-language-server.path": "pytest-language-server"
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Other Editors
|
|
154
|
+
|
|
155
|
+
Any editor with LSP support can use pytest-language-server. Configure it to run the `pytest-language-server` command.
|
|
156
|
+
|
|
157
|
+
## Configuration
|
|
158
|
+
|
|
159
|
+
### Logging
|
|
160
|
+
|
|
161
|
+
Control log verbosity with the `RUST_LOG` environment variable:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
# Minimal logging (default)
|
|
165
|
+
RUST_LOG=warn pytest-language-server
|
|
166
|
+
|
|
167
|
+
# Info level
|
|
168
|
+
RUST_LOG=info pytest-language-server
|
|
169
|
+
|
|
170
|
+
# Debug level (verbose)
|
|
171
|
+
RUST_LOG=debug pytest-language-server
|
|
172
|
+
|
|
173
|
+
# Trace level (very verbose)
|
|
174
|
+
RUST_LOG=trace pytest-language-server
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Logs are written to stderr, so they won't interfere with LSP communication.
|
|
178
|
+
|
|
179
|
+
### Virtual Environment Detection
|
|
180
|
+
|
|
181
|
+
The server automatically detects your Python virtual environment:
|
|
182
|
+
1. Checks for `.venv/`, `venv/`, or `env/` in your project root
|
|
183
|
+
2. Falls back to `$VIRTUAL_ENV` environment variable
|
|
184
|
+
3. Scans third-party pytest plugins for fixtures
|
|
185
|
+
|
|
186
|
+
## Supported Fixture Patterns
|
|
187
|
+
|
|
188
|
+
### Decorator Style
|
|
189
|
+
```python
|
|
190
|
+
@pytest.fixture
|
|
191
|
+
def my_fixture():
|
|
192
|
+
"""Fixture docstring."""
|
|
193
|
+
return 42
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Assignment Style (pytest-mock)
|
|
197
|
+
```python
|
|
198
|
+
mocker = pytest.fixture()(_mocker)
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### Async Fixtures
|
|
202
|
+
```python
|
|
203
|
+
@pytest.fixture
|
|
204
|
+
async def async_fixture():
|
|
205
|
+
return await some_async_operation()
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### Fixture Dependencies
|
|
209
|
+
```python
|
|
210
|
+
@pytest.fixture
|
|
211
|
+
def fixture_a():
|
|
212
|
+
return "a"
|
|
213
|
+
|
|
214
|
+
@pytest.fixture
|
|
215
|
+
def fixture_b(fixture_a): # Go to definition works on fixture_a
|
|
216
|
+
return fixture_a + "b"
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## Fixture Priority Rules
|
|
220
|
+
|
|
221
|
+
pytest-language-server correctly implements pytest's fixture shadowing rules:
|
|
222
|
+
1. **Same file**: Fixtures defined in the same file have highest priority
|
|
223
|
+
2. **Closest conftest.py**: Searches parent directories for conftest.py files
|
|
224
|
+
3. **Virtual environment**: Third-party plugin fixtures
|
|
225
|
+
|
|
226
|
+
## Supported Third-Party Fixtures
|
|
227
|
+
|
|
228
|
+
Automatically discovers fixtures from popular pytest plugins:
|
|
229
|
+
- **pytest-mock**: `mocker`, `class_mocker`
|
|
230
|
+
- **pytest-asyncio**: `event_loop`
|
|
231
|
+
- **pytest-django**: Database fixtures
|
|
232
|
+
- **pytest-cov**: Coverage fixtures
|
|
233
|
+
- And any other pytest plugin in your environment
|
|
234
|
+
|
|
235
|
+
## Architecture
|
|
236
|
+
|
|
237
|
+
- **Language**: Rust 🦀
|
|
238
|
+
- **LSP Framework**: tower-lsp
|
|
239
|
+
- **Parser**: rustpython-parser
|
|
240
|
+
- **Concurrency**: tokio async runtime
|
|
241
|
+
- **Data Structures**: DashMap for lock-free concurrent access
|
|
242
|
+
|
|
243
|
+
## Development
|
|
244
|
+
|
|
245
|
+
### Prerequisites
|
|
246
|
+
|
|
247
|
+
- Rust 1.83+ (2021 edition)
|
|
248
|
+
- Python 3.10+ (for testing)
|
|
249
|
+
|
|
250
|
+
### Building
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
cargo build --release
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### Running Tests
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
cargo test
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### Logging During Development
|
|
263
|
+
|
|
264
|
+
```bash
|
|
265
|
+
RUST_LOG=debug cargo run
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
## Contributing
|
|
269
|
+
|
|
270
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
271
|
+
|
|
272
|
+
## License
|
|
273
|
+
|
|
274
|
+
MIT License - see LICENSE file for details.
|
|
275
|
+
|
|
276
|
+
## Acknowledgments
|
|
277
|
+
|
|
278
|
+
Built with:
|
|
279
|
+
- [tower-lsp](https://github.com/ebkalderon/tower-lsp) - LSP framework
|
|
280
|
+
- [rustpython-parser](https://github.com/RustPython/RustPython) - Python AST parsing
|
|
281
|
+
- [tokio](https://tokio.rs/) - Async runtime
|
|
282
|
+
|
|
283
|
+
Special thanks to the pytest team for creating such an amazing testing framework.
|
|
284
|
+
|
|
285
|
+
---
|
|
286
|
+
|
|
287
|
+
**Made with ❤️ and Rust. Shamelessly vibed into existence. Blazingly fast. 🔥**
|
|
288
|
+
|
|
289
|
+
*When you need a pytest LSP and the vibes are just right.* ✨
|
|
290
|
+
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
pytest_language_server-0.3.0.data/scripts/pytest-language-server.exe,sha256=qRSFg4HI9v3-zLThtu0ETHIFj9KFtUKJLC0gcbcMNgs,6466048
|
|
2
|
+
pytest_language_server-0.3.0.dist-info/METADATA,sha256=7-4NP18u0M8XvPUJqtxsgzxCA-C3DBq5az6y3CDWlOI,7848
|
|
3
|
+
pytest_language_server-0.3.0.dist-info/WHEEL,sha256=lPIF_-a9b6wBRM6wJEi4UfKQLiQkWyexCm1ykMTrK2U,90
|
|
4
|
+
pytest_language_server-0.3.0.dist-info/licenses/LICENSE,sha256=xCOXkDUUFLJ_nyfCrIWRA-_SQKEeAcFMo0SRH1A6EWE,1093
|
|
5
|
+
pytest_language_server-0.3.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Patrick Arminio
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|