Ben Chuanlong Du's Blog

It is never too late to learn.

Useful Tools for Python Developing

vulture finds unused code in Python programs. It is useful for cleaning up and finding errors in large code bases.

Lint Python Scripts

ruff

ruff is an extremely fast Python linter, written in Rust.

pylint

pylint

flake8

flake8

  1. Flake8 focus on logical errors rather than stylistic errors. It strives to reduce false positives.

  2. pylint performs deeper analysis and thus is slower.

Formatting

The Python package black is the best formatting tool for Python currently.

  1. yapf

    yapf -d yourscript.py
    
  2. black

Please refer to Auto formatters for Python for detailed comparison between yapf and black.

Debugging, Unit Testing and CICD

Reference

https://cjolowicz.github.io/posts/hypermodern-python-01-setup/

https://cjolowicz.github.io/posts/hypermodern-python-02-testing/

https://cjolowicz.github.io/posts/hypermodern-python-03-linting/#managing-dependencies-in-nox-sessions-with-poetry

https://cjolowicz.github.io/posts/hypermodern-python-02-testing/#code-coverage-with-coveragepy

Comments