Skip to main content

Add your description here

Project description

python pypi ruff ty tests


Ruff Logo Ruff Logo

demonstration

ruff-jupyter-jetbrains

ruff-jupyter-jetbrains is a python package that is designed to be run as a file watcher tool in JetBrains IDEs to display ruff linting inspections in Jupyter notebooks.

Usage

  1. Install the package in your environment, using your package manager of choice. E.g:

    uv add --dev ruff-jupyter-jetbrains
    
  2. Ensure you have the JetBrains File Watchers plugin enabled.

  3. Under Settings > Tools > File Watchers, configure a new file watcher with the following settings:

    • File type: Jupyter Notebook
    • Program: uv (or your tool of choice)
    • Arguments: run ruff-jupyter-jetbrains $FilePath$
    • Show console: Never (unless you need to debug)
    • Output Filters: $FILE_PATH$:$LINE$:$COLUMN$: $MESSAGE$

settings

  1. Set your desired severity level and color scheme under Settings > Editor > Inspections > File watcher problems

Alternative Usage

If you want to keep your project dependencies minimal, you could also use an isolated runner like uvx, without installing the package in your environment. In that case ignore step 1 above and use the following settings instead:

  • Program: uvx
  • Arguments: ruff-jupyter-jetbrains $FilePath$

How it works

JetBrains maintains an intermediary notebook representation that differs from the raw notebook JSON content: each cell source appears as is in order and is marked up with a comment line that specifies its type (# %% for code and # %%m for markdown).

In addition, custom JetBrains file watchers can show inspection messages when their output can be parsed into a file path, line, column and message.

With that knowledge the ruff linting output can be used and converted to a format compatible with JetBrains file watchers.

[!WARNING]

This little tool, while functional, is only meant as a workaround. Ideally, this functionality should live in a proper plugin that makes use of the language server protocol. This was motivated by a standing issue in the Ruff plugin and my lack of Kotlin knowledge to fix it at the root.


Development

Setup

Clone the repo:

git clone https://github.com/OliverSieweke/ruff-jupyter-jetbrains.git

This project uses uv as a project manager. To set up the environment, ensure uv is installed and run:

uv sync

To ensure code follows the project’s guidelines, install pre-commit hooks with:

pre-commit install

Code Standards

ruff is used as a formatter and can be run with:

ruff format

ruff is used as a linter and code can be checked with:

ruff check

ty is used as a type checker and code can be checked with:

ty check

Tests are handled by pytest and can be run with:

pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ruff_jupyter_jetbrains-1.0.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ruff_jupyter_jetbrains-1.0.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file ruff_jupyter_jetbrains-1.0.0.tar.gz.

File metadata

  • Download URL: ruff_jupyter_jetbrains-1.0.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ruff_jupyter_jetbrains-1.0.0.tar.gz
Algorithm Hash digest
SHA256 e8af7d96ea7719570c37cc4239a5fbaf37499cd9f41244d3648393685b5b3bd8
MD5 90857644c37ddf00b382f5b98b60e1fb
BLAKE2b-256 5b06c227d1d1ebf5b33cf631a2137ca8a6be7b91a18500b5155f60d66f60ef36

See more details on using hashes here.

Provenance

The following attestation bundles were made for ruff_jupyter_jetbrains-1.0.0.tar.gz:

Publisher: publish.yml on OliverSieweke/ruff-jupyter-jetbrains

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ruff_jupyter_jetbrains-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ruff_jupyter_jetbrains-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e79890da409b0ba94853267756294533a55d51dc8f3d7ec817d086fdeba5da46
MD5 dd75fc2bb606c9e660f3e56b235a350e
BLAKE2b-256 5c3053a9c729335188a263a99a7904926763879bb6dc85e8202cb1213ffc784a

See more details on using hashes here.

Provenance

The following attestation bundles were made for ruff_jupyter_jetbrains-1.0.0-py3-none-any.whl:

Publisher: publish.yml on OliverSieweke/ruff-jupyter-jetbrains

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page