Preferences

I don't think there is any solution for that but "fix your broken linter".

It isn't just one though. Every linter I've used has warned about that.

Probably because PEP 8 says

> Imports are always put at the top of the file, just after any module comments and docstrings, and before module globals and constants

Ruff doesn't do this, and in fact even lets you specify modules that _must_ not be imported at the top level (banned-module-level-imports = [...])

I banished the worst/heaviest libraries to this list at my workplace and it's been really helpful at keeping startup times from regressing.

This item has no comments currently.

Keyboard Shortcuts

Story Lists

j
Next story
k
Previous story
Shift+j
Last story
Shift+k
First story
o Enter
Go to story URL
c
Go to comments
u
Go to author

Navigation

Shift+t
Go to top stories
Shift+n
Go to new stories
Shift+b
Go to best stories
Shift+a
Go to Ask HN
Shift+s
Go to Show HN

Miscellaneous

?
Show this modal