Skip to content

Latest commit

 

History

History
57 lines (41 loc) · 2.31 KB

File metadata and controls

57 lines (41 loc) · 2.31 KB

Useful commands

  • make pep8 — lint check
  • make isort — fix import ordering issues
  • make format — fix other Python source code formatting issues
  • mypy — type check (no arguments; checks only files configured in .mypy.ini)

Guidelines

  • In addition to the directives in this document, also respect those contained in CONTRIBUTING.rst

  • After making any code changes, always verify them with make pep8 and mypy

  • Don't worry about manually ordering imports. Instead, just run make isort

  • When extracting code out of a module covered by mypy into a new module, remember to add the new module to .mypy.ini. Ask for confirmation before making changes that would reduce mypy coverage

  • Remember that in .mypy.ini, there are two ways to configure a Python module for coverage by mypy: explicitly, by listing its fully qualified module path in the modules section of that file, or implicitly, by listing its parent or ancestor package in the packages section

  • When adding a module to the modules list in .mypy.ini, always append it at the end of the list

  • Prefer to use git mv when renaming or moving files

  • Do not commit any changes unless explicitly asked to do so. However, it's OK to propose committing changes. When committing changes, include a trailer in the commit message that attributes the change to you

  • You can usually disregard any files under attic/, except for reference. Never modify the attic, except when instructed to move files there.

  • Passing --config-file .mypy.ini to mypy is unnecessary; since .mypy.ini is the default config

  • Do not quote type hints in annotations. The project uses Python 3.14, which defers evaluation of annotations by default (PEP 649), so forward references and TYPE_CHECKING-guarded imports work without quotes

  • When using assert with R() and at least one assertion in the function needs line wrapping, wrap all of them consistently. The convention is:

    assert condition, R(
        'message', value)

    R( goes at the end of the assert line, the closing ) at the end of the following line

  • For pairs of symmetric assignments like a = foo(x) and b = foo(y), use tuple assignment: a, b = foo(x), foo(y). Do not apply this when it would require wrapping the line