Open thejcannon opened 4 months ago
Hm. Is this always going to be set for all users of Ruff with your code? Otherwise it seems like we could flip-flop behaviors here depending on the local environment which seems less than ideal.
Yeah, we would set it as part of machine bringup
After some internal discussion, we need to decide how best to support this use-case. We might want to use a dedicated setting instead of reading runtime Python variables.
(Not that you needed me to be, but) I'm cool with that as well 👍
I think that's the most reasonable option and addresses my concern. Not entirely sure this is doable with our current module resolution handling, I'd need to look at it to refresh my understanding. If someone is interested in doing a proof of concept pull request, I'd review.
The issue I'm trying to solve is that sometimes folks have empty directories lying around and they get confused why their editor is reformatting in a way that CI then complains about and they don't know how to fix it (admittedly implicit namespace packages are not intuitive)
Sort of hacky but we could check if foo
is non-empty for this purpose, perhaps?
I honestly wonder if this might be made more general with a "never assume I use implicit namespace packages" config?
That's really what we want (but Python doesn't expose that, hence the env var about "safe"ty)
Docs links:
Reproducer with
ruff
(notefoo
is an implicit namespace package in vanilla Python-speak, but totally not something we expected to import)keeps
foo
with 1p.but: