<@UHVF9QEPP> Hi, I thought I would run pyupgrade o...
# development
c
@polite-garden-50641 Hi, I thought I would run pyupgrade on the docker backend. Is it as easy as just
./pants fmt src/…
from your pyupgrade branch?
p
Yep. But you have to run “fmt” twice since because pyupgrade will change the type annotation syntax and will make some imports unnecessary another run is required so autoflake can get rid of those.
I think there is probably a way to work around it by sorting the backends differently, but I didn't look into it
c
Cool, thanks. Will give it a go 🙂
h
Yes, the ordering does matter in pants.toml. I recommend pyupgrade first, then Autoflake, then the rest
h
Should document that when we document pyupgrade?
1
👍 1
h
and probably write a better test to guarantee we don't break this. Iirc we were talking about ordering of rule registration last month and it was only Stu who remembered it does matter. We could have easily broken that feature
🤭 1
c
OK, tried it, and came out with no changes 🎉 However, just to make sure I used it right, tried it on another source file, and noticed the fact it ran last
Copy code
$ ./pants --backend-packages=pants.backend.python.lint.pyupgrade fmt src/python/pants/option/arg_splitter_test.py
Could there perhaps be a way (or is there, and I just don’t know about it?) to have the packages listed on the command line added to the front, rather than the end of the list?