https://pantsbuild.org/ logo
#welcome
Title
# welcome
b

bitter-ability-32190

10/21/2021, 8:41 PM
I'll add too, I'm strongly opinionated that Python needs more "fixers" tooling. Not saying I'm going write a framework or anything, but...
h

hundreds-father-404

10/21/2021, 8:47 PM
Can you explain this more, please? We recently added an
update-build-files
goal which is kind of like a Buildozer-lite!
b

bitter-ability-32190

10/21/2021, 8:48 PM
Yeah I just mean generically in the ecosystem. More tools like
isort
which don't just complain but also fix issues. E.g.
flake8-simplify
says "don't nest these if statements". OK, then fix it for me! ๐Ÿ˜‚
h

hundreds-father-404

10/21/2021, 8:50 PM
Ah, you may be excited that Pants 2.8 adds Autoflake and Pyupgrade into the mix! Those automate fixing semantic issues, like unused imports
We're almost always happy to add more tools if you know of any
๐Ÿ˜‚ 1
b

bitter-ability-32190

10/21/2021, 8:51 PM
I juuust ran across `eradicate`https://github.com/myint/eradicate
๐Ÿ‘€ 1
Looks like the same author as
autoflake
time to go sniff their GitHub ๐Ÿ˜‚
h

hundreds-father-404

10/21/2021, 8:53 PM
Interesting! Adding that is pretty simple to do, mostly copy pasta. @polite-garden-50641 @happy-kitchen-89482 any thoughts on adding this to core Pants? Only 100 stars and it hasn't been updated in 13 months, but still might be worth it
b

bitter-ability-32190

10/21/2021, 8:54 PM
Fair point on "fomatter" vs "fixer" ๐Ÿ˜‰
โž• 1
h

hundreds-father-404

10/21/2021, 8:56 PM
we're right now thinking about having
./pants fix
vs.
./pants fmt
. For now, Pyupgrade and Autoflake are under
fmt
and there is no
fix
goal But we realized we want to merge other fixers like
./pants tailor
(add missing target definitions) into a single goal, and that definitely should not be happening in
./pants fmt
. I think
./pants fix
makes sense Punted on the question for the upcoming Pants 2.8 release by making Pyupgrade and Autoflake be experimental backends so that we can change from
fmt
to
fix
later if we decide to
p

polite-garden-50641

10/21/2021, 8:59 PM
specifically on
eradicate
I don't think it is worth adding to be a core part of pants... this doesn't seem to be the tool you need to keep running on an ongoing bases... Not allowing commented out code is a tricky issue. I don't think this is useful. this (commented out code) is the kind of thing that should be left for humans to decide on a case by case basis. IMHO. enforcing such a policy on the repo level seems heavy handed.
๐Ÿ‘ 1
โž• 2
h

hundreds-father-404

10/21/2021, 9:00 PM
Thanks, Asher! Agreed, makes sense to me. @bitter-ability-32190 lmk if you'd be interested in developing as an internal plugin for your org, though! Happy to give some pointers on how to do that
b

bitter-ability-32190

10/21/2021, 9:00 PM
My personal hot take on format-vs-fix: If it's safe to do on save. Format is safe to do on save because ideally it isn't altering the file in a semantic way Fixing isn't safe to do on save because it does. (E.g. I add an import which I haven't used yet and hit save. I'd be really annoyed if it disappeared)
โž• 1
h

hundreds-father-404

10/21/2021, 9:01 PM
Ohhh that's a really excellent point with
./pants --loop fmt
@witty-crayon-22786 , which reruns that goal when changes to relevant files are made
w

witty-crayon-22786

10/21/2021, 10:02 PM
mm, yea: interesting. i use
./pants --loop check fmt lint
, so
fmt
doesnโ€™t happen until typechecking passesโ€ฆ that eliminates many of those concerns, but would still totally nuke an unused import, heh.
but IDE users are probably saving more frequently
โž• 1
c

curved-television-6568

10/22/2021, 5:37 AM
Iโ€™d love a tool that also would add any missing imports for me. That would eliminate the unused import nuke issue.
b

bitter-ability-32190

10/22/2021, 1:29 PM
That is simply one example. To add another one: unused variable nuking ๐Ÿ˜‰ (add a variable because I'm the human writing code, save because I'm neurotic, blammo)
๐Ÿ‘ 1