Re:Uv format: Code Formatting Comes to uv (experimentally)
by IshKebab on Thursday August 21, 2025 @05:59PM
(#44978604)
This is obviously a great move. I don't know why so many commenters here are against making things better. "Can't you just do <this slightly worse thing> already?". Well yes. But it's slightly worse.
[ Parent
| on HN ]
Re:Uv format: Code Formatting Comes to uv (experimentally)
by Spivak on Thursday August 21, 2025 @06:09PM
(#44978702)
I think the biggest thing is that it doesn't seem to support other formatters. If my project uses black I don't get to have uv format work for me.
Re:Uv format: Code Formatting Comes to uv (experimentally)
by nmca on Thursday August 21, 2025 @08:18PM
(#44979765)
right, but you definitely shouldn’t be using any other formatter than ruff and this helps with that
Re:Uv format: Code Formatting Comes to uv (experimentally)
by nikisweeting on Thursday August 21, 2025 @06:16PM
(#44978757)
fwiw `ruff format` includes nearly all the black rules by default / supports a superset of black's options https://astral.sh/blog/the-ruff-formatter
Re:Uv format: Code Formatting Comes to uv (experimentally)
by nickserv on Friday August 22, 2025 @12:14AM
(#44980942)
Ruff pretty much follows the same rules as black, and can be made identical with some options tweaking.
So when I moved several projects from black to ruff, there were no changes made to the code.
Re:Uv format: Code Formatting Comes to uv (experimentally)
by LtWorf on Friday August 22, 2025 @12:50AM
(#44981097)
I find this hard to believe since black doesn't even have the same rules as black's next version and I never changed version without something being reformatted.
Also because of fun, if you reformat again with the older version it won't go back to as it was before :)
Re:Uv format: Code Formatting Comes to uv (experimentally)
by LtWorf on Friday August 22, 2025 @01:19PM
(#44987140)
Thanks for the downvotes. Really shows that you have no familiarity with black.
Re:Uv format: Code Formatting Comes to uv (experimentally)
by IshKebab on Friday August 22, 2025 @03:24AM
(#44981838)
That wasn't my experience. I tried it on a large project and about 1% of lines were changed. Not a big deal IMO but enough for naysayers to complain.
Re:Uv format: Code Formatting Comes to uv (experimentally)
by wasabi991011 on Thursday August 21, 2025 @08:41PM
(#44979899)
I don't think being one word longer ("uvx ruff format" vs "uv format") counts as being is worse.
I think it is much worse to create a special case that obscures the actual formatter being run and how it is being run (is ruff now preinstalled, or is it downloaded and cached in the same way as other tools?)
Re:Uv format: Code Formatting Comes to uv (experimentally)
by Feuilles_Mortes on Thursday August 21, 2025 @10:23PM
(#44980423)
But you have to know about ruff. I didn't, but I did know about uv.
Re:Uv format: Code Formatting Comes to uv (experimentally)
by wasabi991011 on Friday August 22, 2025 @02:38AM
(#44981604)
Not really. If you know about uv, you know how to use "uv tool run", so you know how to use any formatter of your choice (which you can find easily on Google, arguably easier than reading the documentation and learning about uv format).
Re:Uv format: Code Formatting Comes to uv (experimentally)
by IshKebab on Friday August 22, 2025 @05:51AM
(#44982641)
He said "you have to know about ruff". You're not really refuting that by saying "no you don't, you can just google it".
Re:Uv format: Code Formatting Comes to uv (experimentally)
by jamienicol on Friday August 22, 2025 @06:37AM
(#44982877)
But I don’t know what the formatter of choice is. Nor do I care what it is. I just want to format my code
Re:Uv format: Code Formatting Comes to uv (experimentally)
by zelphirkalt on Friday August 22, 2025 @09:27AM
(#44984427)
Well, it is arguably worse to run an unknown, not version pinned, unconfigured formatter over your code and expect it to improve things, unless the code is an utter catastrophe in terms of formatting.
Re:Uv format: Code Formatting Comes to uv (experimentally)
by wiseowise on Friday August 22, 2025 @12:59PM
(#44986899)
It is completely irrelevant.
You’re offloading responsibility to uv devs in this case.
Re:Uv format: Code Formatting Comes to uv (experimentally)
by zelphirkalt on Friday August 22, 2025 @01:02PM
(#44986942)
_You_ may find it irrelevant, but speak for yourself. I don't want dependencies, that are not version-pinned and checksummed running over my code. It is certainly not irrelevant to me.
Re:Uv format: Code Formatting Comes to uv (experimentally)
by wiseowise on Friday August 22, 2025 @01:20PM
(#44987155)
That’s for uv for decide. If you don’t like what it does - don’t use uv.