News for hackers. Stuff that matters.
Re:Black, the uncompromising Python code formatter, is stable by chrisseaton on Saturday January 29, 2022 @05:15PM (#30131124)
> that won't move imports in ways that potentially change behavior of the codebase

How can that be the case? Can't Python imports have behaviour that varies on the time of the day if they want?

An import could monkey patch a basic operation one day but not the next.

Re:Black, the uncompromising Python code formatter, is stable by jreese on Saturday January 29, 2022 @05:19PM (#30131167)
Absolutely! We're hoping that the vast majority of modules are good citizens, but we also know that the reality not perfect. That's why µsort allows you to configure a list of modules with known import-time side effects, and µsort will then treat those are barriers everywhere.

https://usort.readthedocs.io/en/stable/guide.html#side-effec...

Re:Black, the uncompromising Python code formatter, is stable by stefan_ on Saturday January 29, 2022 @05:57PM (#30131471)
Even better, you can overwrite the default importer to substitute your own with any behavior you want. Used in EVE Online to do their "hide the python code somewhere" scheme.