liveBook · Manning

Style guide

As explained in Data Pipelines with Apache Airflow, Second Edition

A style guide is a documented set of conventions for writing source code, including formatting, naming, and layout rules.

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

How Data Pipelines with Apache Airflow, Second Edition covers it

How deep it goes
Defines formatting and naming guidance, demonstrates corrections, and defers thorough clean-coding practices.
Examples
Uses PEP 8 before-and-after snippets, Flake8 reports, Black formatting, and consistent DAG dependency notation.
What it assumes
Assumes basic Python and DAG familiarity while introducing conventions and checking tools as practical starting points.
What you can do after
Apply it via PEP 8, Flake8, Pylint, or Black to produce and check consistent Python code.
How it connects
Connects style guides with static analysis, code formatting, and task dependencies.

Also explained in

Compare how 10 books explain style guide →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Data Pipelines with Apache Airflow, Second Edition. The section links point to the parts of the book it draws on.