A style guide is a documented set of conventions for writing readable, consistent source code. It can define indentation, line length, naming, formatting, and layout rules. Applying one consistently makes shared code easier to understand, including Airflow DAGs. section 12.1.1
Practical conventions include:
- Adopt a recognized guide such as PEP 8 or the Google Python Style Guide. section 12.1.1
- Use static checkers such as Flake8 or Pylint to report convention and code-quality problems. section 12.1.1
- Choose one notation consistently when defining DAGs and task dependencies rather than mixing equivalent styles. section 12.1.1
Listing 12.2 Making the examples in listing 12.1 PEP 8 compliant
spam(ham[1], {eggs: 2}) #1
i = i + 1 #2
submitted += 1 #2
my_list = [ #3
1, 2, 3,
4, 5, 6,
]
Compare noncompliant Python with a PEP 8-compliant version, including spacing, indentation, and trailing-comma changes. section 12.1.1









