Skip to content

Conflicting behavior of ruff isort rule for same file in different environments #15920

@rashishhume

Description

@rashishhume

Description

I've noticed that ruff linter with isort enabled is behaving differently for me when running locally (in a Linux machine with Ubuntu) vs in a Github action runner (running ubuntu-latest).

Locally, its not happy about the lack of line between yaml and RcloneHelper.

$ ruff check --config ./pyproject.toml ./backup.py
backup2.py:5:1: I001 [*] Import block is un-sorted or un-formatted
   |
 3 |   """
 4 |
 5 | / import logging
 6 | | import os
 7 | | from typing import Annotated, List
 8 | |
 9 | | import typer
10 | | import yaml
11 | | from data_backup.rclone_helper import RcloneHelper
   | |__________________________________________________^ I001
12 |
13 |   logging.basicConfig(
   |
   = help: Organize imports

Found 1 error.

In a Github action runner its not happy with a line (ran below via tmate ssh session in the runner)

$ ruff check --config ./tools/data-backup/pyproject.toml ./tools/data-backup/backup.py
tools/data-backup/backup.py:5:1: I001 [*] Import block is un-sorted or un-formatted
   |
 3 |   """
 4 |
 5 | / import logging
 6 | | import os
 7 | | from typing import Annotated, List
 8 | |
 9 | | import typer
10 | | import yaml
11 | |
12 | | from data_backup.rclone_helper import RcloneHelper
   | |__________________________________________________^ I001
13 |
14 |   logging.basicConfig(
   |
   = help: Organize imports

Found 1 error.

My pyproject.toml is:

[tool.ruff]
line-length = 120
indent-width = 4

[tool.ruff.lint]
ignore = ["E203", "E501"]
extend-select = ["I"]

Any thoughts on what might be the issue here ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    isortRelated to import sortingquestionAsking for support or clarification

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions