code quality in python
play

Code quality in Python A reasonable approach to measuring code - PowerPoint PPT Presentation

Code quality in Python A reasonable approach to measuring code quality in your projects Radosaw Ganczarek - 2019 Hi! Its me again! Radosaw Ganczarek (Rad) EuroPython 2015 (Bilbao) Reasonable approach? Made with by PGS Software Made


  1. Code quality in Python A reasonable approach to measuring code quality in your projects Radosław Ganczarek - 2019

  2. Hi! It’s me again! Radosław Ganczarek (Rad) EuroPython 2015 (Bilbao) Reasonable approach? Made with by PGS Software Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software ·

  3. This talk will be NOT ABOUT ABOUT Python 2 Python 3 IDEs Up to date tools Framework-specific tools Tools only for Python Tools not connected to code itself (e.g. pyaroma) Code quality checking Packages not published in PYPI (e.g. pyright) A bit about testing Made with by PGS Software Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software ·

  4. Meet my friends! Made with by PGS Software Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software ·

  5. Meet the Hobgoblin! PEP-0008 “hobgoblins of little minds” What would a Hobgoblin do? narrow minded lacks business perspective extreme rules above value Made with by PGS Software Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software ·

  6. Meet Timmy! Another Python developer Your colleague in a project Very skilled Afraid of changes Made with by PGS Software Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software ·

  7. Meet the Zen of Python PEP-0020 Errors should never pass silently. Beautiful is better than ugly. Unless explicitly silenced. Explicit is better than implicit. Simple is better than complex. In the face of ambiguity, refuse the temptation to guess. There should be one and preferably only one obvious way to do it. Complex is better than complicated. Although that way may not be obvious at first unless you're Dutch. Flat is better than nested. Now is better than never. Sparse is better than dense. Readability counts. Although never is often better than *right* now. If the implementation is hard to explain, it's a bad idea. Special cases aren't special enough to break the rules. If the implementation is easy to explain, it may be a good idea. Although practicality beats purity. Namespaces are one honking great idea let's do more of those! Made with by PGS Software Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software ·

  8. Zen of Python Made with by PGS Software Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software ·

  9. Beautiful is better than ugly Code quality starts from good-looking code Elegant line breaks Space Made with by PGS Software Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software ·

  10. Formatters Black Yapf pre-picked formatting rules formatting styles isort support many configuration options no configuration Made with by PGS Software Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software ·

  11. Explicit is better than implicit PEP-0484 PEP-0526 mypy vs pyre Made with by PGS Software Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software ·

  12. Simple is better than complex bellybutton DeprecatedFnCall: description: `deprecated_fn` will be deprecated in v9.1.2. Please use `new_fn` instead. expr: //Call[func/Name/@id='deprecated_fn'] example: "deprecated_fn(*values)" instead: "new_fn(values)" Made with by PGS Software Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software ·

  13. Complex is better than complicated pylint vs 100 flake8 plugins Made with by PGS Software Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software ·

  14. Flat is better than nested Tools and plugins Outdated tools Deprecated/unsupported tools Runtime errors Pre-set toolset One configuration file Made with by PGS Software Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software ·

  15. Sparse is better than dense diff-cover diff-quality See only what you broke Test coverage trap Made with by PGS Software Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software ·

  16. Readability counts vulture Made with by PGS Software Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software ·

  17. Special cases aren’t special enough to break the rules File discovery regex Bash find Line regex Is special case so special? Made with by PGS Software Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software ·

  18. Although practicality beats purity pydiatra Made with by PGS Software Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software ·

  19. Errors should never pass silently Code-checking CI tox Jenkins CI output Made with by PGS Software Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software ·

  20. Unless explicity silenced # noqa # pylint: disable=missing-docstring # nofmt Made with by PGS Software Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software ·

  21. In the face of ambiguity, refuse the temptation to guess pytype Made with by PGS Software Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software ·

  22. There should be one - and preferably only one - obvious way to do it bandit (no dodgy) Optional: mypy OR pyre OR pytype pydiatra pycodestyle vulture pydocstyle OR sphinx docstring check bellybutton pyflakes+mccabe OR pylint autoflake isort autopep8 black OR yapf Made with by PGS Software Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software ·

  23. Although that way may not be obvious at first - unless you’re Dutch Made with by PGS Software Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software ·

  24. Now is better than never How to start? autopep8 autoflake isort pycodestyle pylint Made with by PGS Software Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software ·

  25. Although never is often better than *right* now You vs the team Business perspective Agreeing on rules Made with by PGS Software Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software · Made with by PGS Software ·

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend