Discussion about this post

User's avatar
Clayton's avatar

So very close to how I set things up. I hadn't really considered extending line-length from 88...but I might, now! Lots of little things I hadn't seen, like half the ruff configs.

A few things I do differently:

- install all those tools with `--group dev`; I don't want pytest, ruff etc. in production builds, even if they don't add much

- with pre-commit in the environment, you don't need `poetry run` in the commit-hooks

- does your ruff hook work as intended? does the hook fail if it finds an error it can't autofix? I ended up needing `ruff check --force-exclude --fix --exit-non-zero-on-fix` as well as `require_serial: true` though I can't remember why I needed force-exclude or require_serial

- let unittest stay dead. I still use classes with pytest, but I don't need to inherit a special class, and I can use plan `assert`s instead of the weird unittest functions

Expand full comment
Moe's avatar

You can replace "black" with "ruff-format", as it's built in to ruff (can configure in pyproject.toml):

https://docs.astral.sh/ruff/formatter/#black-compatibility

Then you can replace the black pre-commit hook with this one:

```

- id: ruff-format

```

Expand full comment
2 more comments...

No posts