Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ruff support for Databricks notebook formatting - Ignore lines starting with ! or % #15650

Open
vivek-freddy opened this issue Jan 21, 2025 · 1 comment
Labels
core Related to core functionality notebook Related to (Jupyter) notebooks

Comments

@vivek-freddy
Copy link

I have a .py file which runs as notebook

# Databricks notebook source
!pip install -U dspy python-dotenv
!pip install torchmetrics
dbutils.library.restartPython() 
# COMMAND ----------
from tqdm.notebook import tqdm
tqdm.pandas()
import logging
# COMMAND ----------
!pip install matplotlib seaborn

The above is python file which runs as notebook where each cell is defined by # COMMAND in databricks. When applying ruff formatting I want to skip the pip install related lines. I tried using noqa but still above is causing warnings. How do I skip checking lines which have ! or % as starting character?

Warnings which I get is

Invalid character "\u21" in token
or
SyntaxError: Simple statements must be separated by newlines or semicolons
@MichaReiser MichaReiser added the core Related to core functionality label Jan 21, 2025
@MichaReiser
Copy link
Member

Hi. Databrick files aren't supported today and the only "mitigation" for now is to exclude the files from formatting and linting using exclude.

Related issues:

@dhruvmanila dhruvmanila added the notebook Related to (Jupyter) notebooks label Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Related to core functionality notebook Related to (Jupyter) notebooks
Projects
None yet
Development

No branches or pull requests

3 participants