Skip to content

isort configuration doesnt seem to respect localfolder (vs real isort) in monorepo #3115

Open
@merc1031

Description

@merc1031

ruff 0.0.249

run ruff check pure_check/checks/docker_active_container.py

The format that ruff isort wants doesn't agree with regular isort (which is seemingly more correct). maybe do to the default_section config on regular isort

snippet in question (works with isort config)

import rich_click as click

from lib.enums.general import CheckResult
from lib.pure_check import Target

from pure_check.checks.base_check import BaseCheck
from pure_check.rehabs.remove_active_docker import RemoveActiveDocker
from pure_check.rehabs.restart_node import RestartNode

what ruff wants me to change it to

import rich_click as click

from lib.enums.general import CheckResult
from lib.pure_check import Target
from pure_check.checks.base_check import BaseCheck
from pure_check.rehabs.remove_active_docker import RemoveActiveDocker
from pure_check.rehabs.restart_node import RestartNode

directory structure

lib
| __init__.py
├── pure_check.py
├── enums
│   ├── __init__.py
│   ├── general.py
pure_check
├── pure_check
│   ├── __init__.py
│   ├── checks
│   │   ├── __init__.py
│   │   ├── base_check.py
│   └── rehabs
│      ├── __init__.py
│       ├── remove_active_docker.py
│       └── restart_node.py

pyproject.toml

[tool.ruff.isort]
force-sort-within-sections = true
force-to-top = []
forced-separate = []
known-first-party = ["lib", "tests", "app"]
lines-after-imports = 2
no-lines-before = []

.isort.cfg (known_third_party is seeded by seed-isort-cfg)

[settings]
default_section=LOCALFOLDER
force_grid_wrap=2
force_sort_within_sections=1
force_to_top=
forced_separate=
include_trailing_comma=1
indent='    '
known_first_party=lib,tests,app
known_future_library=
known_standard_library=
# This is generated from isort-seed-config DO NOT MODIFY BY HAND
known_third_party=Levenshtein,PyInstaller,alembic,anubis,attr,autotriage_spark_monitor,backpack,billiard,blinker,boto3,bs4,cachetools,cassandra,celery,cleo,click,click_default_group,consul,dateutil,dirty_equals,distro,distutils,dns,dotenv,elasticsearch,faker,flake8,flask,flask_restful,flexmock,frozendict,git,gspread,haproxy_check,inflection,influxdb,iso8601,jinja2,jira,jira_cookie_auth,jwt,kafka,kif,kombu,lazy_object_proxy,ldap,lru,marshmallow,matplotlib,methodtools,metrics_helper,mock,more_itertools,multimethod,nltk,nomad,numpy,octillion_lib,pampy,pandas,pendulum,pika,postgresql,prometheus_api_client,prometheus_client,psycopg2,pygments,pympler,pysnmp,pyspark,pytest,pytest_describe,pytoml,pytz,re2,redis,redis_lock,requests,rethinkdb,rich_click,seaborn,setuptools,sh,simplejson,six,slack_bolt,slack_sdk,slackclient,snowflake,sqlalchemy,statsd,structlog,sumtypes,tenacity,texttable,typing_extensions,unidecode,urllib3,webargs,werkzeug,wrapt,xmltodict,yaml
length_sort=0
line_length=120
lines_after_imports=2
multi_line_output=3
no_lines_before=
sections=FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
skip=
skip_glob=citadel/node_modules/*.*
use_parentheses=1
src_paths=*/tests,*
old_finders=true

Thanks for any help

Metadata

Metadata

Assignees

No one assigned

    Labels

    isortRelated to import sorting

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions