Quick Python Setup in Zed Editor: Pyright LSP and Ruff Linter
Hi my gorgeous friends on the internet. I want to share about my quick and easy Python setup for Zed Editor. Anyway, wtf is Zed? Why don’t…
Quick Python Setup in Zed Editor: Pyright LSP and Ruff Linter
Hi my gorgeous friends on the internet. I want to share about my quick and easy Python setup for Zed Editor. Anyway, wtf is Zed? Why don’t I use Visual Studio Code? Basically, just because Zed is super fast because it is written in Rust. If you want to explore more about Zed, you can check the website here.

Let’s go!
A. Setup Language Server Protocol (LSP)
First things first, what is LSP? LSP is a tool that is used for code completion, showing code documentation on hover, syntax highlighting, error checking, on click code navigation, and others.

contoh penampilan dokumentasi kode fungsi requests.get() oleh LSP
Of course, we need to install LSP in any programming language for easier development process.
1. Create Project Settings
First, we need to create project specific settings by ctrl + shift + p then select zed: open project settings. Now, we should see our project specific settings in .zed/settings.json.

2. Configure Pyright LSP
After we got our project settings in .zed/settings.json, now we have to add Pyright to our settings. You can just copy this file btw.
{
"languages": {
"Python": {
"language_servers": ["pyright"]
}
},
"lsp": {
"pyright": {
"settings": {
"python": {
"pythonPath": ".venv/bin/python"
}
}
}
}
}
Here, I use virtual environment in .venv directory. So, the pythonPath value is .venv/bin/python.
But if you are using any other things, you can always check your pythonPath by typing which python in terminal.
For example, if you using conda, you can get the pythonPath by activating the environment and type which python to the terminal. Here is the detailed steps.
conda env listconda activate [name]which python

pythonPath when using conda
As you can see, pythonPath can be changed to ~/miniconda3/envs/langchain/bin/python.
{
"languages": {
"Python": {
"language_servers": ["pyright"]
}
},
"lsp": {
"pyright": {
"settings": {
"python": {
"pythonPath": "~/miniconda3/envs/langchain/bin/python"
}
}
}
}
}
3. Restart Zed
I’m not sure if this is required. But, restarting Zed loaded the settings on my laptop. You can just type ctrl + shift + p then select workspace: reload and Zed will be restarted (chill, the restart is super fast in Zed).

restart Zed
B. Setup Ruff Linter and Formatter
Pyright does not have capability to do linting and formatting. So, to do that, we need to use Ruff. Now, Ruff is the fastest Python linter and formatter because it is written in Rust.
If you from web development background, Ruff’s role is more likely similar to Eslint and Prettier in JavaScript
Anyway, here is what we call formatting. See that line 22 is too long, so just by pressing ctrl + s (alias saving the file), Ruff automatically format it to multiple line to become tidier than one long line. Maximum number of character threshold can be configured in ruff.toml (will be explained in the next section).

example of formatting
And here is what we call linting. Linting is a process that check code readability. With linter tool like Ruff, we can make sure that our code style comply with standards, like character count each line, import order, indentation, unused variable, and many more. Of course, when using linter, our code readability will increase because it complies with standards.

contoh linting Ruff yang menampilkan import module harus di awal file
1. Create ruff.toml
File ruff.toml is Ruff’s configuration file. Here, we can add many configurations that provided by Ruff. Anyway, for most usecase, this is my ruff.toml file. Please note that Ruff does not use yml file anymore now.
line-length = 80
[lint]
extend-select = ["I"]
[format]
quote-style = "single"
docstring-code-format = true
line-length = 80is for limiting each line in our code to maximum 80 character. If more than 80 characters, Ruff will format it down to next line.extend-select = ["I"]is for enable import sorting. This will make our import tidier because it is sorted now.

sort import
quote-style = "single"is for using qoute'instead of double quote"if we write a string. Anyway, this is only my preference. Double quote is good too.docstring-code-format = trueis for format our docstring if there is a python code. Btw, docstring is class or function documentation string that written inside"""{docstring here}"""under class or function definition.

code formatting inside docstring
2. Add Ruff Configuration to Project Settings
First, open the project settings in .zed/settings.json, then you can just copy/paste this settings. See, I only need to add: lsp > ruff settings, add ruff to languages.Python.language_servers, and adding languanges.Python.format_on_save.
Anyway, i love the format on save settings so much 😁
{
"languages": {
"Python": {
"format_on_save": "on",
"language_servers": ["pyright", "ruff"]
}
},
"lsp": {
"ruff": {
"initialization_options": {
"settings": {
"configuration": "ruff.toml"
}
}
},
"pyright": {
"settings": {
"python": {
"pythonPath": ".venv/bin/python"
}
}
}
}
}
3. Install Ruff Extension
Go to extensions menu, then search Ruff. Just install it.

4. Restart Zed
Once again, I’m not sure if this is required. But, restarting Zed loaded the settings on my laptop.
And voila, we just set up Pyright and Ruff easily in Zed. Happy coding!
References
메타데이터
- post_id
- 7a293bc5c306
- slug
- quick-python-setup-in-zed-editor-pyright-lsp-and-ruff-linter-7a293bc5c306
- url
- https://levelup.gitconnected.com/quick-python-setup-in-zed-editor-pyright-lsp-and-ruff-linter-7a293bc5c306
- canonical_url
- https://levelup.gitconnected.com/quick-python-setup-in-zed-editor-pyright-lsp-and-ruff-linter-7a293bc5c306
- author_url
- https://medium.com/@lutfiandri
- status
- ok
- fetched_at
- 2026-07-09 06:39:14