scy,
@scy@chaos.social avatar

So, what’s your current go-to & stack? Thinking of doing black, isort, mypy, pytest, but open for suggestions.

My main project currently uses flake8 instead of black, with flake8-quotes to enforce double quotes, but this breaks in Python 3.12 because of nested quotes in f-strings: https://github.com/zheller/flake8-quotes/issues/117

gertvdijk,
@gertvdijk@mastodon.social avatar

@scy mypy + Black + Ruff.

Ruff can replace isort + flake8 + many flake8 plugins.
Soon Ruff will have a formatter too, perhaps you can even drop Black then.

diazona,
@diazona@techhub.social avatar

@scy The last time I set this up for a project (a few months ago) I used black, ruff, and mypy as static checks, run by pre-commit; and pytest for runtime testing, run by tox. It seems like a good setup. E.g. ruff covers a lot of stuff that would otherwise be handled by other tools like isort and flake8.

FWIW I like black for two reasons: (1) I love the idea of styling that completely discards any preexisting formatting by parsing and reconstructing the code, so it is entirely deterministic, and (2) I actually like the style that black uses - with a longer line length than the default - more than that of any other Python formatter I've tried. If you don't find black's style to improve readability then it would make sense not to use it.

slackline,
@slackline@mastodon.social avatar

@scy ruff its a great alternative to flake8, much faster too and is already up-to-date with 3.12

Pylint is worth using in conjunction with both black and ruff it picks up code-smells the others don't.

https://docs.astral.sh/ruff/
https://pylint.org/

marix,
@marix@chaos.social avatar

@scy I prefer Ruff.

guerda,
@guerda@ruhr.social avatar

@scy I usually use flake8 and black with the line length adapted.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • python
  • ngwrru68w68
  • rosin
  • GTA5RPClips
  • osvaldo12
  • love
  • Youngstown
  • slotface
  • khanakhh
  • everett
  • kavyap
  • mdbf
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • megavids
  • InstantRegret
  • normalnudes
  • tacticalgear
  • cubers
  • ethstaker
  • modclub
  • cisconetworking
  • Durango
  • anitta
  • Leos
  • tester
  • provamag3
  • JUstTest
  • All magazines