Earlier quoted context omitted.
Does ruff replace isort? Because I'm really unhappy with it, it doesn't work with tabs and conflicts with yapf all the time.
> it doesn't work with tabs What do you mean by this? Are you indenting Python with tabs?
Boring Python: Code quality
81–90 of 232 posts
Re: Boring Python: Code quality
#82Earlier quoted context omitted.
Anyone with experience of writing both dynamic typed and statically typed can tell you that. Infact, you could just try it out for yourself. But here is your internet source for this blatantly obvious fact: https://games.greggman.com/game/dynamic-typing-static-typing...
I do have such experience and I really can't tell that. Which is why I wondered if anyone else was in fact saying that. > But here is your internet source for this blatantly obvious fact: https://games.greggman.com/game/dynamic-typing-static-typing ... Ah no I meant a proper peer reviewed source. The claim that untyped code has fewer bugs is completely bonkers, so I was quite sure that no such source existed. Why do…
Correct if you misapply a tool to the wrong situation you get poor or negative results.
The right tools are unit testing, integration testing, uat and automated whole system testing.
Re: Boring Python: Code quality
#83I wish VSCode would figure out that ExampleModel.objects.first() returns ExampleModel or None or ExampleModel.objects.filter() returns an iterable of ExampleModel. Has anybody gotten this working, automatically or manually annotating?
Re: Boring Python: Code quality
#84Also, mypy has gotten really good in recent years and I can vouch that on projects that have typing I catch bugs much much sooner. Previously I would only catch bugs when unit testing, now they are much more commonly type errors.
The other thing typing does is allow for refactoring code. If anything, high code quality relates to the ability to refactor code confidently and typing helps this. Therefore I would put it at the top of the list above all the tooling presented (exception I agree with ci/cd)
Re: Boring Python: Code quality
#85Earlier quoted context omitted.
For your dependency/versioning issue, use a virtualenv per-project and pin your dependency versions in requirements.txt
Don't pin unless it's needed. I have a library… most downloaded version is 3 years old. The newer versions are massively faster but nobody uses them.
Re: Boring Python: Code quality
#86Earlier quoted context omitted.
I do have such experience and I really can't tell that. Which is why I wondered if anyone else was in fact saying that. > But here is your internet source for this blatantly obvious fact: https://games.greggman.com/game/dynamic-typing-static-typing ... Ah no I meant a proper peer reviewed source. The claim that untyped code has fewer bugs is completely bonkers, so I was quite sure that no such source existed. Why do…
"If typechecking would actually introduce bugs, it'd be better not doing it right?" Correct if you misapply a tool to the wrong situation you get poor or negative results. The right tools are unit testing, integration testing, uat and automated whole system testing.
Re: Boring Python: Code quality
#87Earlier quoted context omitted.
I do have such experience and I really can't tell that. Which is why I wondered if anyone else was in fact saying that. > But here is your internet source for this blatantly obvious fact: https://games.greggman.com/game/dynamic-typing-static-typing ... Ah no I meant a proper peer reviewed source. The claim that untyped code has fewer bugs is completely bonkers, so I was quite sure that no such source existed. Why do…
"The claim that untyped code has fewer bugs is completely bonkers" There are plenty of academic sources that will tell you that the number of bugs in a program is directly proportional to the number of lines in the program and static typing has no effect on this. https://stackoverflow.com/questions/2898571/basis-for-claim-... Additionally, statically typed code involves large amounts of boilerplate code in the form o…
> Actual Python houses typically don't use static typing.
If you had ever developed python professionally, you'd know this to be untrue.
Also your "paper" points to a 404 page.
Re: Boring Python: Code quality
#88If you aren’t happy with Flake8, Pylint, and isort (or maybe if you are!), I recommend checking out Ruff: https://github.com/charliermarsh/ruff It’s literally 100 times faster, with comparable coverage to Flake8 plus dozens of plugins, automatic fixes, and very active development.
replaced both flake8 and isort across all my projects
Re: Boring Python: Code quality
#89If you aren’t happy with Flake8, Pylint, and isort (or maybe if you are!), I recommend checking out Ruff: https://github.com/charliermarsh/ruff It’s literally 100 times faster, with comparable coverage to Flake8 plus dozens of plugins, automatic fixes, and very active development.
Does ruff replace isort? Because I'm really unhappy with it, it doesn't work with tabs and conflicts with yapf all the time.
relevant section from my pyproject.toml
[tool.ruff]
line-length = 88
# pyflakes, pycodestyle, isort
select = ["F", "E", "W", "I001"]Re: Boring Python: Code quality
#90Earlier quoted context omitted.
"If typechecking would actually introduce bugs, it'd be better not doing it right?" Correct if you misapply a tool to the wrong situation you get poor or negative results. The right tools are unit testing, integration testing, uat and automated whole system testing.
That seems to completely forget the fact that libraries exist, that A LOT of bugs can happen calling libraries, and that you're not really supposed to unit test libraries, they are supposed to have their own tests.
As does integration testing, user acceptance testing and whole system testing (QA engineers, frontend testing, etc.)
Nothing has been forgotten. Python isn't Java, nor should you develop your Python code as if it were Java. Python has it's own software development practices that take advantage of the language's strengths including dynamic typing.
It you don't know how to work with a dynamically typed language properly, that's on you. And I guarantee you will get poor results pretending it's a statically typed language.