Skip to content

[pylint] Stabilize import-outside-top-level (PLC0415) #18554

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 9, 2025

Conversation

dylwil3
Copy link
Collaborator

@dylwil3 dylwil3 commented Jun 8, 2025

No description provided.

@dylwil3 dylwil3 added this to the v0.12 milestone Jun 8, 2025
@dylwil3 dylwil3 added the rule Implementing or modifying a lint rule label Jun 8, 2025
Copy link
Contributor

github-actions bot commented Jun 8, 2025

ruff-ecosystem results

Linter (stable)

ℹ️ ecosystem check detected linter changes. (+5984 -0 violations, +0 -0 fixes in 16 projects; 39 projects unchanged)

DisnakeDev/disnake (+52 -0 violations, +0 -0 fixes)

+ disnake/abc.py:1722:13: PLC0415 `import` should be at the top-level of a file
+ disnake/abc.py:1932:9: PLC0415 `import` should be at the top-level of a file
+ disnake/appinfo.py:242:9: PLC0415 `import` should be at the top-level of a file
+ disnake/audit_logs.py:180:5: PLC0415 `import` should be at the top-level of a file
+ disnake/channel.py:1535:9: PLC0415 `import` should be at the top-level of a file
+ disnake/channel.py:1877:9: PLC0415 `import` should be at the top-level of a file
+ disnake/channel.py:1920:9: PLC0415 `import` should be at the top-level of a file
+ disnake/channel.py:2270:9: PLC0415 `import` should be at the top-level of a file
+ disnake/channel.py:2730:9: PLC0415 `import` should be at the top-level of a file
+ disnake/channel.py:2773:9: PLC0415 `import` should be at the top-level of a file
... 42 additional changes omitted for project

PlasmaPy/PlasmaPy (+14 -0 violations, +0 -0 fixes)

+ src/plasmapy/__init__.py:83:5: PLC0415 `import` should be at the top-level of a file
+ src/plasmapy/__init__.py:84:5: PLC0415 `import` should be at the top-level of a file
+ src/plasmapy/diagnostics/langmuir.py:1086:9: PLC0415 `import` should be at the top-level of a file
+ src/plasmapy/diagnostics/langmuir.py:1239:9: PLC0415 `import` should be at the top-level of a file
+ src/plasmapy/diagnostics/langmuir.py:1306:9: PLC0415 `import` should be at the top-level of a file
+ src/plasmapy/diagnostics/langmuir.py:1401:9: PLC0415 `import` should be at the top-level of a file
+ src/plasmapy/diagnostics/langmuir.py:203:9: PLC0415 `import` should be at the top-level of a file
+ src/plasmapy/diagnostics/langmuir.py:368:9: PLC0415 `import` should be at the top-level of a file
+ src/plasmapy/diagnostics/langmuir.py:978:9: PLC0415 `import` should be at the top-level of a file
+ src/plasmapy/formulary/dimensionless.py:212:5: PLC0415 `import` should be at the top-level of a file
... 4 additional changes omitted for project

apache/airflow (+2537 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --no-preview --select ALL

+ airflow-core/hatch_build.py:91:13: PLC0415 `import` should be at the top-level of a file
+ airflow-core/src/airflow/__init__.py:113:5: PLC0415 `import` should be at the top-level of a file
+ airflow-core/src/airflow/__main__.py:52:9: PLC0415 `import` should be at the top-level of a file
+ airflow-core/src/airflow/api_fastapi/app.py:171:5: PLC0415 `import` should be at the top-level of a file
+ airflow-core/src/airflow/api_fastapi/auth/managers/simple/simple_auth_manager.py:281:9: PLC0415 `import` should be at the top-level of a file
+ airflow-core/src/airflow/api_fastapi/auth/tokens.py:227:9: PLC0415 `import` should be at the top-level of a file
+ airflow-core/src/airflow/api_fastapi/auth/tokens.py:246:9: PLC0415 `import` should be at the top-level of a file
+ airflow-core/src/airflow/api_fastapi/auth/tokens.py:364:5: PLC0415 `import` should be at the top-level of a file
+ airflow-core/src/airflow/api_fastapi/auth/tokens.py:473:5: PLC0415 `import` should be at the top-level of a file
+ airflow-core/src/airflow/api_fastapi/auth/tokens.py:485:5: PLC0415 `import` should be at the top-level of a file
+ airflow-core/src/airflow/api_fastapi/auth/tokens.py:522:5: PLC0415 `import` should be at the top-level of a file
+ airflow-core/src/airflow/api_fastapi/auth/tokens.py:561:5: PLC0415 `import` should be at the top-level of a file
+ airflow-core/src/airflow/api_fastapi/auth/tokens.py:67:5: PLC0415 `import` should be at the top-level of a file
+ airflow-core/src/airflow/api_fastapi/auth/tokens.py:68:5: PLC0415 `import` should be at the top-level of a file
+ airflow-core/src/airflow/api_fastapi/auth/tokens.py:69:5: PLC0415 `import` should be at the top-level of a file
+ airflow-core/src/airflow/api_fastapi/auth/tokens.py:91:5: PLC0415 `import` should be at the top-level of a file
+ airflow-core/src/airflow/api_fastapi/auth/tokens.py:92:5: PLC0415 `import` should be at the top-level of a file
+ airflow-core/src/airflow/api_fastapi/core_api/app.py:104:5: PLC0415 `import` should be at the top-level of a file
+ airflow-core/src/airflow/api_fastapi/core_api/app.py:116:5: PLC0415 `import` should be at the top-level of a file
+ airflow-core/src/airflow/api_fastapi/core_api/app.py:119:9: PLC0415 `import` should be at the top-level of a file
+ airflow-core/src/airflow/api_fastapi/core_api/app.py:138:5: PLC0415 `import` should be at the top-level of a file
... 2516 additional changes omitted for project

apache/superset (+1008 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --no-preview --select ALL

+ scripts/erd/erd.py:203:5: PLC0415 `import` should be at the top-level of a file
+ superset/async_events/async_query_manager.py:154:9: PLC0415 `import` should be at the top-level of a file
+ superset/async_events/async_query_manager.py:224:9: PLC0415 `import` should be at the top-level of a file
+ superset/async_events/async_query_manager.py:244:9: PLC0415 `import` should be at the top-level of a file
+ superset/charts/schemas.py:1395:13: PLC0415 `import` should be at the top-level of a file
+ superset/cli/examples.py:41:5: PLC0415 `import` should be at the top-level of a file
+ superset/cli/importexport.py:106:5: PLC0415 `import` should be at the top-level of a file
+ superset/cli/importexport.py:107:5: PLC0415 `import` should be at the top-level of a file
+ superset/cli/importexport.py:146:5: PLC0415 `import` should be at the top-level of a file
+ superset/cli/importexport.py:147:5: PLC0415 `import` should be at the top-level of a file
... 998 additional changes omitted for project

aws/aws-sam-cli (+160 -0 violations, +0 -0 fixes)

+ samcli/cli/context.py:208:9: PLC0415 `import` should be at the top-level of a file
+ samcli/cli/context.py:209:9: PLC0415 `import` should be at the top-level of a file
+ samcli/cli/main.py:134:5: PLC0415 `import` should be at the top-level of a file
+ samcli/cli/main.py:136:5: PLC0415 `import` should be at the top-level of a file
+ samcli/cli/main.py:143:9: PLC0415 `import` should be at the top-level of a file
+ samcli/cli/options.py:43:9: PLC0415 `import` should be at the top-level of a file
+ samcli/cli/options.py:45:9: PLC0415 `import` should be at the top-level of a file
+ samcli/commands/_utils/options.py:728:5: PLC0415 `import` should be at the top-level of a file
+ samcli/commands/build/command.py:228:5: PLC0415 `import` should be at the top-level of a file
+ samcli/commands/delete/command.py:102:5: PLC0415 `import` should be at the top-level of a file
... 150 additional changes omitted for project

bokeh/bokeh (+291 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --no-preview --select ALL

+ examples/output/apis/autoload_static_flask.py:10:5: PLC0415 `import` should be at the top-level of a file
+ examples/output/apis/autoload_static_flask.py:11:5: PLC0415 `import` should be at the top-level of a file
+ examples/output/apis/autoload_static_flask.py:7:5: PLC0415 `import` should be at the top-level of a file
+ examples/output/apis/autoload_static_flask.py:9:5: PLC0415 `import` should be at the top-level of a file
+ examples/server/app/gapminder/data.py:5:5: PLC0415 `import` should be at the top-level of a file
+ src/bokeh/__init__.py:103:5: PLC0415 `import` should be at the top-level of a file
+ src/bokeh/__init__.py:69:5: PLC0415 `import` should be at the top-level of a file
+ src/bokeh/__main__.py:54:5: PLC0415 `import` should be at the top-level of a file
+ src/bokeh/__main__.py:56:5: PLC0415 `import` should be at the top-level of a file
+ src/bokeh/application/handlers/code.py:195:5: PLC0415 `import` should be at the top-level of a file
... 281 additional changes omitted for project

freedomofpress/securedrop (+12 -0 violations, +0 -0 fixes)

+ securedrop/tests/functional/conftest.py:292:5: PLC0415 `import` should be at the top-level of a file
+ securedrop/tests/functional/conftest.py:293:5: PLC0415 `import` should be at the top-level of a file
+ securedrop/tests/functional/conftest.py:294:5: PLC0415 `import` should be at the top-level of a file
+ securedrop/tests/functional/conftest.py:295:5: PLC0415 `import` should be at the top-level of a file
+ securedrop/tests/functional/conftest.py:296:5: PLC0415 `import` should be at the top-level of a file
+ securedrop/tests/functional/conftest.py:59:5: PLC0415 `import` should be at the top-level of a file
+ securedrop/tests/functional/conftest.py:60:5: PLC0415 `import` should be at the top-level of a file
+ securedrop/tests/functional/conftest.py:76:5: PLC0415 `import` should be at the top-level of a file
+ securedrop/tests/functional/conftest.py:77:5: PLC0415 `import` should be at the top-level of a file
+ securedrop/tests/functional/pageslayout/test_journalist_col.py:33:5: PLC0415 `import` should be at the top-level of a file
... 2 additional changes omitted for project

ibis-project/ibis (+351 -0 violations, +0 -0 fixes)

+ ci/release/bump_version.py:5:5: PLC0415 `import` should be at the top-level of a file
+ ibis/__init__.py:76:5: PLC0415 `import` should be at the top-level of a file
+ ibis/__init__.py:78:5: PLC0415 `import` should be at the top-level of a file
+ ibis/backends/__init__.py:102:13: PLC0415 `import` should be at the top-level of a file
+ ibis/backends/__init__.py:1404:9: PLC0415 `import` should be at the top-level of a file
+ ibis/backends/__init__.py:1473:9: PLC0415 `import` should be at the top-level of a file
+ ibis/backends/__init__.py:1474:9: PLC0415 `import` should be at the top-level of a file
+ ibis/backends/__init__.py:1507:9: PLC0415 `import` should be at the top-level of a file
+ ibis/backends/__init__.py:1508:9: PLC0415 `import` should be at the top-level of a file
+ ibis/backends/__init__.py:1519:9: PLC0415 `import` should be at the top-level of a file
... 341 additional changes omitted for project

... Truncated remaining completed project reports due to GitHub comment length restrictions

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
PLC0415 5984 5984 0 0 0

Linter (preview)

✅ ecosystem check detected no linter changes.

@ntBre ntBre force-pushed the brent/release-0.12.0 branch from 0370d8a to 040fb6b Compare June 8, 2025 19:55
@ntBre ntBre requested a review from AlexWaygood as a code owner June 8, 2025 19:55
@ntBre ntBre force-pushed the brent/release-0.12.0 branch from 040fb6b to 9252447 Compare June 8, 2025 20:18
@AlexWaygood AlexWaygood removed their request for review June 8, 2025 20:30
@ntBre ntBre force-pushed the brent/release-0.12.0 branch from 9252447 to 829acf4 Compare June 9, 2025 00:22
@dylwil3 dylwil3 force-pushed the dylan/stabilize-plc0415 branch from 88d1715 to efb8bf4 Compare June 9, 2025 13:04
Copy link
Contributor

@ntBre ntBre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ntBre
Copy link
Contributor

ntBre commented Jun 9, 2025

Oh I also meant to say, based on the ecosystem results, that this seems like a pretty opinionated rule that people are likely to disable, but I think that's okay. The cases I checked looked like true positives but also potentially valid for the reasons we mention in the rule docs, which seems like a good case for noqa or per-file-ignores.

@dylwil3 dylwil3 merged commit 2eceaa8 into brent/release-0.12.0 Jun 9, 2025
34 checks passed
@dylwil3 dylwil3 deleted the dylan/stabilize-plc0415 branch June 9, 2025 17:51
@dylwil3 dylwil3 mentioned this pull request Jun 9, 2025
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants