Style Guide¶
Formatting¶
Code should generally conform to the PEP8 style guidelines.
Flake8 is a linter to help check that code is aligned with these formatting requirements
Black is a formatter that can be used to automatically reformat code to resolve many (but not all) formatting issues
For details on using these tools, see the dev tasks guide
Structure¶
Classes with methods should be avoided in favor of simple dataclasses and functions
Types (i.e.
dataclass
es) should be within the_types
package. Separating types and functions into different packages helps keep type resolution simple so that all of our tools (mypy
,sphinx
,pytest
) run correctly.
Google-style docstrings¶
All functions and class definitions should use Google-style docstrings and be annotated with type hints.
Internal Imports¶
When importing from within tamr-client
:
Use import statements for modules, classes, and exceptions
Never import functions directly. Instead import the containing module and use
module.function
Use
from foo import bar
instead ofimport foo.bar as bar