isort: Don't infer namespace packages as first-party (only subpackages of namespace packages)#12987
isort: Don't infer namespace packages as first-party (only subpackages of namespace packages)#12987AlexWaygood wants to merge 1 commit intomainfrom
Conversation
936610d to
00b20ac
Compare
|
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| I001 | 23 | 16 | 7 | 0 | 0 |
| F401 | 4 | 2 | 2 | 0 | 0 |
Linter (preview)
ℹ️ ecosystem check detected linter changes. (+18 -9 violations, +0 -0 fixes in 6 projects; 48 projects unchanged)
Snowflake-Labs/snowcli (+12 -7 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
+ scripts/cleanup.py:14:1: I001 [*] Import block is un-sorted or un-formatted - src/snowflake/cli/_plugins/connection/util.py:15:1: I001 [*] Import block is un-sorted or un-formatted + src/snowflake/cli/_plugins/git/manager.py:15:1: I001 [*] Import block is un-sorted or un-formatted + src/snowflake/cli/_plugins/nativeapp/project_model.py:15:1: I001 [*] Import block is un-sorted or un-formatted + src/snowflake/cli/_plugins/snowpark/common.py:15:1: I001 [*] Import block is un-sorted or un-formatted + src/snowflake/cli/_plugins/snowpark/manager.py:15:1: I001 [*] Import block is un-sorted or un-formatted + src/snowflake/cli/_plugins/spcs/compute_pool/manager.py:15:1: I001 [*] Import block is un-sorted or un-formatted + src/snowflake/cli/_plugins/spcs/image_repository/manager.py:15:1: I001 [*] Import block is un-sorted or un-formatted + src/snowflake/cli/_plugins/stage/diff.py:15:1: I001 [*] Import block is un-sorted or un-formatted + src/snowflake/cli/_plugins/streamlit/manager.py:15:1: I001 [*] Import block is un-sorted or un-formatted + src/snowflake/cli/api/cli_global_context.py:15:1: I001 [*] Import block is un-sorted or un-formatted + src/snowflake/cli/api/sql_execution.py:15:1: I001 [*] Import block is un-sorted or un-formatted + test_external_plugins/snowpark_hello_single_command/src/snowflakecli/test_plugins/snowpark_hello/manager.py:15:1: I001 [*] Import block is un-sorted or un-formatted - tests_integration/notebook/test_notebooks.py:15:1: I001 [*] Import block is un-sorted or un-formatted - tests_integration/spcs/testing_utils/compute_pool_utils.py:15:1: I001 [*] Import block is un-sorted or un-formatted - tests_integration/spcs/testing_utils/spcs_services_utils.py:15:1: I001 [*] Import block is un-sorted or un-formatted - tests_integration/test_config.py:15:1: I001 [*] Import block is un-sorted or un-formatted - tests_integration/test_stage.py:15:1: I001 [*] Import block is un-sorted or un-formatted - tests_integration/testing_utils/sql_utils.py:15:1: I001 [*] Import block is un-sorted or un-formatted
apache/airflow (+1 -0 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select ALL
+ dev/perf/dags/perf_dag_1.py:22:1: I001 [*] Import block is un-sorted or un-formatted
freedomofpress/securedrop (+1 -0 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
+ journalist_gui/test_gui.py:1:1: I001 [*] Import block is un-sorted or un-formatted
latchbio/latch (+2 -2 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
- latch_cli/services/init/example_conda/__init__.py:10:35: F401 [*] `latch.resources.tasks.small_task` imported but unused; consider removing, adding to `__all__`, or using a redundant alias + latch_cli/services/init/example_conda/__init__.py:10:35: F401 `latch.resources.tasks.small_task` imported but unused - latch_cli/services/init/example_r/__init__.py:10:35: F401 [*] `latch.resources.tasks.small_task` imported but unused; consider removing, adding to `__all__`, or using a redundant alias + latch_cli/services/init/example_r/__init__.py:10:35: F401 `latch.resources.tasks.small_task` imported but unused
mlflow/mlflow (+1 -0 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
+ tests/projects/utils.py:50:1: I001 [*] Import block is un-sorted or un-formatted
pytest-dev/pytest (+1 -0 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
+ testing/_py/test_local.py:2:1: I001 [*] Import block is un-sorted or un-formatted
Changes by rule (2 rules affected)
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| I001 | 23 | 16 | 7 | 0 | 0 |
| F401 | 4 | 2 | 2 | 0 | 0 |
9dd7068 to
04aecf3
Compare
04aecf3 to
42b9882
Compare
42b9882 to
aa79994
Compare
CodSpeed Performance ReportMerging #12987 will degrade performances by 7.42%Comparing Summary
Benchmarks breakdown
|
aa79994 to
8622df9
Compare
…s of namespace packages)
8622df9 to
352edbb
Compare
|
Hey, thank you for preparing this PR! I built and tested it locally and it solves the problem I discussed in #12038. Any chance to get this merged? |
|
I'll try to find some time to work on this soon and hopefully fix the perf regression! |
|
Hi Alex, do you have any update on this? Unfortunately I am not a Rust developer, otherwise I would be glad to help out! |
|
Gentle reminder. This issue is blocking us from using |
can you not use |
As discussed in #12038 this sadly does not give the right output. |
|
@ollie-bell to elaborate this a bit further: If I have a namespace package |
|
Jut to add that we are in the same boat. We are trying to move to |
|
Thanks for the updates everyone! We've been talking about this internally and are planning to have someone look into this again soon. I'm hoping to have a look this week if @dylwil3 doesn't beat me to it! |
…izing first-party (#16565) When attempting to determine whether `import foo.bar.baz` is a known first-party import relative to [user-provided source paths](https://docs.astral.sh/ruff/settings/#src), when `preview` is enabled we now check that `SRC/foo/bar/baz` is a directory or `SRC/foo/bar/baz.py` or `SRC/foo/bar/baz.pyi` exist. Previously, we just checked the analogous thing for `SRC/foo`, but this can be misleading in situations with disjoint namespace packages that share a common base name (e.g. we may be working inside the namespace package `foo.buzz` and importing `foo.bar` from elsewhere). Supersedes #12987 Closes #12984
…izing first-party (#16565) When attempting to determine whether `import foo.bar.baz` is a known first-party import relative to [user-provided source paths](https://docs.astral.sh/ruff/settings/#src), when `preview` is enabled we now check that `SRC/foo/bar/baz` is a directory or `SRC/foo/bar/baz.py` or `SRC/foo/bar/baz.pyi` exist. Previously, we just checked the analogous thing for `SRC/foo`, but this can be misleading in situations with disjoint namespace packages that share a common base name (e.g. we may be working inside the namespace package `foo.buzz` and importing `foo.bar` from elsewhere). Supersedes #12987 Closes #12984
…izing first-party (astral-sh#16565) When attempting to determine whether `import foo.bar.baz` is a known first-party import relative to [user-provided source paths](https://docs.astral.sh/ruff/settings/#src), when `preview` is enabled we now check that `SRC/foo/bar/baz` is a directory or `SRC/foo/bar/baz.py` or `SRC/foo/bar/baz.pyi` exist. Previously, we just checked the analogous thing for `SRC/foo`, but this can be misleading in situations with disjoint namespace packages that share a common base name (e.g. we may be working inside the namespace package `foo.buzz` and importing `foo.bar` from elsewhere). Supersedes astral-sh#12987 Closes astral-sh#12984
Fixes #12984 (will add docs/PR description/tests after I've seen the ecosystem report)