More details on how to configure Ruff can be found here: https://docs.astral.sh/ruff
To use this linter inside Zeus do the following:
1. Download the Linter
Go to the releases page and select the ruff-x86_64-pc-windows-msvc.zip asset.
The releases page is found here: https://github.com/astral-sh/ruff/releases
2. Ruff Installation
The installation is as simple as extracting the executable from the zip file, however the location of that executable will need to be in the PATH.
The easiest option is to unzip the file into this Zeus directory as this will mean the executable is automatically in the PATH:
Code: Select all
Zeus (x64)\zGNU
To use Ruff as a formatting tool refer to this link: https://www.zeusedit.com/phpBB3/viewtopic.php?t=8408
4. Zeus Configuration - Ruff Linting
Ruff can be run inside Zeus as a Python tool, which can be done by using the Options, Document Types menu, editing the Python Document Type and adding the tool using the Tools panel.
However, another option is to configure Ruff as the compiler for the Python Document Type.
This is done be editing the Python Document Type and then adding Ruff to the Compiler panel rather than the Tools panel.
In that compiler panel set the following values:
Code: Select all
Command Line: ruff.exe check "$f"
Errors Regex: Error:|error:|File .*, line [0-9]+
Warnings Regex: :[0-9]+:[0-9]+:
[x] Capture Standard Output [x] Capture Standard Error
(o) Display on any output
Once configured, Ruff can be used to check a file using the Compiler, Compile menu.
For example, assume the following Example.py file is open in Zeus:
Code: Select all
from typing import Iterable
import os
def sum_even_numbers(numbers: Iterable[int]) -> int:
"""Given an iterable of integers, return the sum of all even numbers in the iterable."""
return sum(
num for num in numbers
if num % 2 == 0
)
Jussi