Parameters in the
config.py (which are accessible via the Flask app.config dictionary) are assumed to always be defined and thus should be accessed directly via,
blueprints = app.config["BLUEPRINTS"]
blueprints = app.config.get("BLUEPRINTS")
or similar as the later will cause typing issues. The former is of type
List[Callable] whereas the later is of type
To ensure clarity, consistency, all readability, all new functions should use type hints and include a docstring.
Note per PEP-484 no syntax for listing explicitly raised exceptions is proposed and thus the recommendation is to put this information in a docstring, i.e.,
from typing import Union
def sqrt(x: Union[float, int]) -> Union[float, int]:
Return the square root of x.
:param x: A number
:returns: The square root of the given number
:raises ValueError: If the number is negative
TypeScript is fully supported and is the recommended language for writing all new frontend components. When modifying existing functions/components, migrating to TypeScript is appreciated, but not required. Examples of migrating functions/components to TypeScript can be found in #9162 and #9180.