#Python: linting vs formattingIMHO

1 messages ยท Page 1 of 1 (latest)

spark badger
#

In practice, the python community makes a distinction between linting and formatting.

Black is a popular formatter because it is extremely opinionated. Some scenarios are not well suited for running Black.
If you decide that the situation does not require forced conformity to Black's rules, you might consider
https://astral.sh/ruff
Ruffs is a linter with the option of enforcing formatting.

A high-performance Python linter written in Rust. Ruff can replace dozens of static analysis tools, all while executing 10-100x faster.

crimson vale
#

It's in the sdk's readme: hatch run fmt, but I suspect this is due to a new thing from black which was updated recently. I'll need to configure it out.

mortal vigil
#

what's a hatch ๐Ÿ˜…

#

any way we could add a sdk:python:fmt target?

#

or maybe run it after generate?

spark badger
#

hatch is the build tool

crimson vale
#

I plan on converting the hatch run commands to python modules. fmt does run after generate but only for the generated client file, not the whole library.

spark badger
#

If you like, I have a python user group meeting in an hour and I can ask for examples of different hatch targets.

#

(btw, it is a public group, everyone is invited to join the office hours)

mortal vigil
#

that's OK, really just trying to get my PR green ๐Ÿ˜…

spark badger
#

LOL, in that case, let Black make the changes.

crimson vale