<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Override ruff linter settings for notebook cells in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/override-ruff-linter-settings-for-notebook-cells/m-p/102416#M41099</link>
    <description>&lt;P&gt;How can I override the ruff linter settings for my notebooks?&lt;BR /&gt;&lt;BR /&gt;I have various projects/git folders in my workspace, and oftentimes, they represent different teams and thus different sets of code formatting patterns. I would like to override the default ruff settings on a project-by-project basis using `pyproject.toml` files in the project directories, similar to how I can do this locally. However, when these files are added, the ruff linter still ignores my specific settings.&lt;BR /&gt;&lt;BR /&gt;I have tried my own ideas + looked for documentation but I can't find the info. Thanks for your help!&lt;/P&gt;</description>
    <pubDate>Tue, 17 Dec 2024 19:02:03 GMT</pubDate>
    <dc:creator>rgooch_cfa</dc:creator>
    <dc:date>2024-12-17T19:02:03Z</dc:date>
    <item>
      <title>Override ruff linter settings for notebook cells</title>
      <link>https://community.databricks.com/t5/data-engineering/override-ruff-linter-settings-for-notebook-cells/m-p/102416#M41099</link>
      <description>&lt;P&gt;How can I override the ruff linter settings for my notebooks?&lt;BR /&gt;&lt;BR /&gt;I have various projects/git folders in my workspace, and oftentimes, they represent different teams and thus different sets of code formatting patterns. I would like to override the default ruff settings on a project-by-project basis using `pyproject.toml` files in the project directories, similar to how I can do this locally. However, when these files are added, the ruff linter still ignores my specific settings.&lt;BR /&gt;&lt;BR /&gt;I have tried my own ideas + looked for documentation but I can't find the info. Thanks for your help!&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2024 19:02:03 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/override-ruff-linter-settings-for-notebook-cells/m-p/102416#M41099</guid>
      <dc:creator>rgooch_cfa</dc:creator>
      <dc:date>2024-12-17T19:02:03Z</dc:date>
    </item>
    <item>
      <title>Re: Override ruff linter settings for notebook cells</title>
      <link>https://community.databricks.com/t5/data-engineering/override-ruff-linter-settings-for-notebook-cells/m-p/102422#M41104</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Steps to Ensure Ruff Reads&lt;/STRONG&gt; `pyproject.toml`&lt;/P&gt;
&lt;P&gt;1. Place `pyproject.toml` in the Project Root:&lt;BR /&gt;- Ruff automatically detects configuration files like `pyproject.toml`, `ruff.toml`, or `.ruff.toml` when they are located at the root of the project directory. Ensure your `pyproject.toml` is in the correct directory for each project.&lt;/P&gt;
&lt;P&gt;2. Define Ruff Settings in `pyproject.toml`:&lt;BR /&gt;- Use the `[tool.ruff]` section to define your desired settings. For example:&lt;BR /&gt;```toml&lt;BR /&gt;[tool.ruff]&lt;BR /&gt;line-length = 120&lt;BR /&gt;select = ["E", "F", "W"]&lt;BR /&gt;ignore = ["E501"]&lt;BR /&gt;```&lt;BR /&gt;- This ensures Ruff uses these specific rules and ignores others.&lt;/P&gt;
&lt;P&gt;3. Verify Configuration Detection:&lt;BR /&gt;- Run Ruff manually using the command: &lt;BR /&gt;```bash&lt;BR /&gt;ruff check . --config pyproject.toml&lt;BR /&gt;```&lt;BR /&gt;- This explicitly tells Ruff to use your configuration file. If you see a message like `Using pyproject.toml at /path/to/project`, it confirms that Ruff is reading the file.&lt;/P&gt;
&lt;P&gt;4. Handle Workspace or Global Overrides:&lt;BR /&gt;- In environments like Databricks or VSCode, global or workspace-level configurations may override project-specific settings. For instance:&lt;BR /&gt;- In VSCode, check if `ruff.format.args` or similar settings are overriding your `pyproject.toml`. You can unset these or explicitly specify the path to your configuration file.&lt;BR /&gt;- In Databricks, ensure no global Ruff configurations are conflicting.&lt;/P&gt;
&lt;P&gt;5. Pass Configuration Explicitly (if Necessary):&lt;BR /&gt;- If automatic detection fails, you can pass the configuration file explicitly in commands or pre-commit hooks:&lt;BR /&gt;```bash&lt;BR /&gt;ruff check . --config=/path/to/pyproject.toml&lt;BR /&gt;```&lt;BR /&gt;- For pre-commit hooks, update the arguments to include:&lt;BR /&gt;```yaml&lt;BR /&gt;args: ["--config=pyproject.toml"]&lt;BR /&gt;``'&lt;/P&gt;
&lt;P&gt;6. Check for Nested Configurations:&lt;BR /&gt;- If you have multiple configuration files (e.g., one at a parent directory and another at a subdirectory), Ruff might prioritize one over the other. Ensure only the intended file exists for each project.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2024 20:46:53 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/override-ruff-linter-settings-for-notebook-cells/m-p/102422#M41104</guid>
      <dc:creator>Louis_Frolio</dc:creator>
      <dc:date>2024-12-17T20:46:53Z</dc:date>
    </item>
    <item>
      <title>Re: Override ruff linter settings for notebook cells</title>
      <link>https://community.databricks.com/t5/data-engineering/override-ruff-linter-settings-for-notebook-cells/m-p/102426#M41106</link>
      <description>&lt;P&gt;Thanks for following up. I was following this documentation and the custom settings weren't picked up in my Databricks notebooks in the project directory. I've placed the `pyproject.toml` in the project root, but the ruff tooltip still appears (see screenshot)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="rgooch_cfa_0-1734469244415.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/13580i046BBFE266F26B8F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="rgooch_cfa_0-1734469244415.png" alt="rgooch_cfa_0-1734469244415.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2024 21:07:43 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/override-ruff-linter-settings-for-notebook-cells/m-p/102426#M41106</guid>
      <dc:creator>rgooch_cfa</dc:creator>
      <dc:date>2024-12-17T21:07:43Z</dc:date>
    </item>
    <item>
      <title>Re: Override ruff linter settings for notebook cells</title>
      <link>https://community.databricks.com/t5/data-engineering/override-ruff-linter-settings-for-notebook-cells/m-p/102582#M41168</link>
      <description>&lt;P&gt;So my takeaway after moving the `pyproject.toml` file location throughout my workspace is that it's impossible to apply custom settings to the ruff formatter in Databricks notebooks.&lt;/P&gt;&lt;P&gt;Please confirm that it is impossible to use custom settings, or if not, I would love guidance on how to make this work.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 18 Dec 2024 21:03:54 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/override-ruff-linter-settings-for-notebook-cells/m-p/102582#M41168</guid>
      <dc:creator>rgooch_cfa</dc:creator>
      <dc:date>2024-12-18T21:03:54Z</dc:date>
    </item>
    <item>
      <title>Re: Override ruff linter settings for notebook cells</title>
      <link>https://community.databricks.com/t5/data-engineering/override-ruff-linter-settings-for-notebook-cells/m-p/102591#M41170</link>
      <description>&lt;P&gt;If your `pyproject.toml` file is not being picked up by Ruff in your Databricks notebooks, there are a few potential reasons and solutions to address the issue:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Common Causes and Solutions&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;1. Ruff Version Compatibility:&lt;BR /&gt;- Ensure you are using a recent version of Ruff (preferably 0.5.1 or later). Earlier versions had issues with reliably detecting `pyproject.toml` configurations automatically.&lt;/P&gt;
&lt;P&gt;2. Explicitly Specify the Configuration File:&lt;BR /&gt;- If Ruff is not automatically detecting your `pyproject.toml`, you can explicitly pass the configuration file path using the `--config` flag when running Ruff. For example:&lt;BR /&gt;```bash ruff check . --config=path/to/pyproject.toml&lt;BR /&gt;```&lt;BR /&gt;- This ensures that Ruff uses the specified configuration file regardless of its automatic detection logic.&lt;/P&gt;
&lt;P&gt;3. Correct Placement of `pyproject.toml`:&lt;BR /&gt;- Verify that the `pyproject.toml` file is located in the root directory of your project. Ruff treats the directory containing the configuration file as the "project root" and applies rules accordingly.&lt;/P&gt;
&lt;P&gt;4. Databricks-Specific Considerations:&lt;BR /&gt;- Databricks environments may not automatically apply Ruff configurations to notebooks. If you are running Ruff as part of a CI/CD pipeline or through a script, ensure that the command explicitly references the configuration file.&lt;BR /&gt;- For interactive notebook usage, consider running Ruff commands manually or integrating them into your workflow with explicit configuration paths.&lt;/P&gt;
&lt;P&gt;5. Alternative Configuration Files:&lt;BR /&gt;- If `pyproject.toml` is not working as expected, try using a `ruff.toml` or `.ruff.toml` file instead. These files do not require the `[tool.ruff]` prefix and may simplify configuration.&lt;/P&gt;
&lt;P&gt;6. Restarting Services:&lt;BR /&gt;- If you are using a language server (e.g., Ruff's LSP or an IDE integration), restart the server after adding or modifying your `pyproject.toml`. Some services cache settings and need to be refreshed to pick up changes[4][9].&lt;/P&gt;
&lt;P&gt;7. Debugging Configuration Issues:&lt;BR /&gt;- Use the following command to verify which configuration file Ruff is using:&lt;BR /&gt;```bash ruff config path/to/file&lt;BR /&gt;```&lt;BR /&gt;- This command lists all active settings and can help identify whether your custom rules are being applied.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Example Configuration in `pyproject.toml`&lt;/STRONG&gt;&lt;BR /&gt;Ensure your `pyproject.toml` includes a valid `[tool.ruff]` section, like this:&lt;BR /&gt;```toml&lt;BR /&gt;[tool.ruff]&lt;BR /&gt;select = ["E", "F", "W"]&lt;BR /&gt;ignore = ["E501"]&lt;BR /&gt;per-file-ignores = {&lt;BR /&gt;"__init__.py" = ["F401"],&lt;BR /&gt;"tests/*.py" = ["D"]&lt;BR /&gt;}&lt;BR /&gt;```&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Additional Notes for Databricks&lt;/STRONG&gt;&lt;BR /&gt;- If you are working with Jupyter Notebooks in Databricks, ensure that you have enabled Ruff's notebook linting support (available in version 0.6.0 and higher). You can configure this via the `exclude` or `per-file-ignores` options for `.ipynb` files.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Dec 2024 22:05:43 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/override-ruff-linter-settings-for-notebook-cells/m-p/102591#M41170</guid>
      <dc:creator>Louis_Frolio</dc:creator>
      <dc:date>2024-12-18T22:05:43Z</dc:date>
    </item>
    <item>
      <title>Re: Override ruff linter settings for notebook cells</title>
      <link>https://community.databricks.com/t5/data-engineering/override-ruff-linter-settings-for-notebook-cells/m-p/116123#M45246</link>
      <description>&lt;P&gt;How does databricks define a "project" and does it work with ruff.toml files or does it have to be pyproject.toml? I can't seem to get it to adopt settings either, and Ctrl+Shift+F for formatting doesn't seem to do anything.&lt;/P&gt;&lt;P&gt;Trying to run ruff manually seems to result in errors but i nevertheless get little ruff popups so it's *somewhere*&lt;/P&gt;</description>
      <pubDate>Tue, 22 Apr 2025 04:50:19 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/override-ruff-linter-settings-for-notebook-cells/m-p/116123#M45246</guid>
      <dc:creator>GalenSwint</dc:creator>
      <dc:date>2025-04-22T04:50:19Z</dc:date>
    </item>
    <item>
      <title>Re: Override ruff linter settings for notebook cells</title>
      <link>https://community.databricks.com/t5/data-engineering/override-ruff-linter-settings-for-notebook-cells/m-p/116179#M45258</link>
      <description>&lt;P&gt;Databricks defines a “project” as a structured collection of assets (jobs, pipelines, notebooks) organized using Databricks Asset Bundles, which use infrastructure-as-code templates to standardize deployments. Hope this helps.&amp;nbsp; Lou.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Apr 2025 11:26:10 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/override-ruff-linter-settings-for-notebook-cells/m-p/116179#M45258</guid>
      <dc:creator>Louis_Frolio</dc:creator>
      <dc:date>2025-04-22T11:26:10Z</dc:date>
    </item>
  </channel>
</rss>

