ruff
281ce56d - Make isort's `detect-same-package` behavior configurable (#6833)

Commit
2 years ago
Make isort's `detect-same-package` behavior configurable (#6833) ## Summary Our first-party import detection uses a heuristic that doesn't exist in isort: if an import appears to be from within the same package as the containing file, we mark it as first-party. For example, if you have a directory `./foo/__init__.py`, and you import `from foo import bar` in `./foo/baz.py`, we'll mark that as first-party. (See: https://github.com/astral-sh/ruff/pull/1266.) This is often unnecessary, and arguably should be removed (though it does have some important use-cases that are otherwise unserved -- I believe Dagster uses it to ensure that all packages mark imports from within the same package as first-party, but not imports _across_ different first-party packages)... but it does exist, and it does help in cases in which the `src` field is not properly configured. This PR adds an option to turn off this behavior: ```toml [tool.ruff.isort] detect-same-package = false ``` This is being introduced to help codebases migrating over from isort that may want more consistent behavior with their current sorting. ## Test Plan `cargo test`
Author
Parents
Loading