3 ms·
First, large Python projects are much more manageable than C++ projects, even without any tools. It's way easier to debug, much less verbose, you have 100 less
by sametmax 10y ago
First, large Python projects are much more manageable than C++ projects, even without any tools. It's way easier to debug, much less verbose, you have 100 less possible errors while stuff are easy to refactor.
Starting from here, unit tests will take you a long way. Tox + pytest + coverage.py is the defactor standard for tests now, and will give you peace of mind when editing your code. Tox can run flake8 as well so it's often done.
After that everything is a luxery. You can use mypy to get static typing, you can make sure to have a very good editor checking stuff for you such as PyCharm or Sublime Text + anaconda. You can use CI with something like Travis or buildbot.
I usually make sure to have a .editorconfig file and a clear style convention to easy team work. And I like to use sphinx to write the doc of the project, which you really, really need to do. This include docstring for modules, classes and functions (with Google style for me), comments, but also some manual rst files.
Last, but not least, experience matters a lot. You learn how to organize stuff in your dir tree. I like to split any file bigger than 500 lignes in Python because it's such an expressive language. Having one module for exceptions. Having proper unicode handling from the start. Etc.
- StavrosK 10y ago> large Python projects are much more manageable than C++ projects, even without any tools I'd probably agree, but I would love to have more mature static typing, and especially an accurate "find all usages" function. Refactoring has been major hell because you pretty much have to grep for names if you want to find all usages of a variable (or, more specifically and problematically, a model property in Django).
- olau 10y agoThere are in fact some refactoring tools available for Python, but yeah, personally I have ag (find + grep like tool) installed with the ag and wgrep-ag Emacs packages, and don't consider renaming a major hassle. There's a pyflake integration thing for Emacs too, where it underlines errors. One benefit of grep is that it lets me spot things in different languages (Python, Javascript, HTML, CSS, documentation).
- afarrell 10y ago> have to grep Have you tried out the Silver Searcher? http://geoff.greer.fm/2011/12/27/the-silver-searcher-better-than-ack/ http://geoff.greer.fm/2011/12/27/the-silver-searcher-better-...
- StavrosK 10y agoYes, it's all I use, but still, we have foreign keys on various models to the user, predictably called "user", so removing or renaming one of them is hell, and the grep tool can't tell you which lines are the one you care about with certainty... Vim-jedi is pretty good, but not perfect either, unfortunately...