You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, turns out this is super easy with ruff. PEP8 and the default ruff and flake-8 rules allow for simple (same folder) relative imports, so that
# This is considered okfrom .benchmark_baseimportBenchmark, BenchmarkStudy# rather thanfromspikeinterface.benchmark.benchmark_baseimportBenchmark, BenchmarkStudy# This is considered confusingfrom ..preprocessing.astypeimportastype# and would be changed tofromspikeinterface.preprocessing.astypeimportastype
Note: we have 1279 same-level relative import and only 194 deeper-than-one-level.
I agree with Alessio, but my only thought is if we can convince Sam to allow us to use ruff (see my PR #3756 for how easy linting is to add and how quick it is), then I would use whatever default is convenient so that it is all done in the pre-commit/commit action. In that case I would sacrifice the full consistency in order to have the automaticity. :)
Okay that sounds like the best then to help new developers find their way around the library so I'm good with that. Thanks for playing around with it. I'm good with going all in on absolute then!
Activity
chrishalcrow commentedon Mar 12, 2025
Hello, turns out this is super easy with ruff.
PEP8and the defaultruffandflake-8rules allow for simple (same folder) relative imports, so thatNote: we have 1279 same-level relative import and only 194 deeper-than-one-level.
Should we keep the "simple" same-level relative imports? Opinions? @samuelgarcia @h-mayorquin @zm711 @JoeZiminski @yger ?
alejoe91 commentedon Mar 12, 2025
Mmm, not sure here. I would vote for all absolute, but I agree that same level imports are less confusing!
zm711 commentedon Mar 12, 2025
I agree with Alessio, but my only thought is if we can convince Sam to allow us to use ruff (see my PR #3756 for how easy linting is to add and how quick it is), then I would use whatever default is convenient so that it is all done in the pre-commit/commit action. In that case I would sacrifice the full consistency in order to have the automaticity. :)
chrishalcrow commentedon Mar 12, 2025
The Ruff pre-commit can handle both options with ease; the default is to allow for same-level relative imports.
zm711 commentedon Mar 12, 2025
Okay that sounds like the best then to help new developers find their way around the library so I'm good with that. Thanks for playing around with it. I'm good with going all in on absolute then!
h-mayorquin commentedon Mar 12, 2025
I am fine with same-level relative imports. I am +1 on whatever gets this through, both options are better than what we have for me.
chrishalcrow commentedon Mar 13, 2025
Done in #3766