top | item 34590929

(no title)

somada141 | 3 years ago

Currently working on a 7-8yr old Python monolith with 500k LOC and overall it’s been far less painful than it would be if it hadn’t been for the gradual adoption of typing and strict mypy configuration. The introduction of types has supercharged PyCharm which is already rather powerful at inference so refactoring and exploration has been rather easy. The villain of the story here was not dynamic typing as much as it was the usage of Python dictionaries as a data interchange format where no amount of typing or IDE smartness can untangle that mess. We’ve been slowly replacing dictionaries with models, eg pydantic, which brings a massive quality of life improvement but it’s been arduous and error-prone. All in all Python gives you all the tools needed to create a coherent codebase regardless of size but that requires disciplined engineering and a commitment to incremental improvements.

discuss

order

jostiniane|3 years ago

Agree very much with this. I work with 50k per repository and around 10 repositories for the last 4 years. Strict mypy rules do the trick, linting flake, pylint do wonders to the quality, no re-using the same variable for different things, no generic types in the interfaces (dicts, pandas dataframe).. There's no additional pain compared to our go code bases except not accounting for the compiling part.

somada141|3 years ago

Thank you for that, it’s encouraging to hear others can get statically-typed-like quality of life following sound practices