Files should end with a newline.

Anti-pattern

Imagine the example below is an entire file.

import os

BASE_DIR = os.path.dirname(os.path.abspath(__file__))

Best practice

Imagine the example below is an entire file.

import os

BASE_DIR = os.path.dirname(os.path.abspath(__file__))
# This is a new line that ends the file.