Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://gitlab.com/matthewhughes/flake-pep604

`flake8` plugin to enforce PEP-604
https://gitlab.com/matthewhughes/flake-pep604

Last synced: 3 months ago
JSON representation

`flake8` plugin to enforce PEP-604

Awesome Lists containing this project

README

        

# flake8-pep604

flake8 plugin which forbids use of `typing.Union` (in favour of `|`), per [PEP
604](https://www.python.org/dev/peps/pep-0604/).

Note the `|` notation is a syntax error for Python \< 3.10. In this case you can
use the `annotations` feature (see [PEP 563](https://peps.python.org/pep-0563/)).

## flake8 Codes

| Code | Description |
|--------|--------------------------------------------------|
| UNT001 | Use `\|` in place of `typing.Union`. See PEP-604 |

## Motivation

Motivated by just wanting to make a codebase consistent in usage between
`typing.Union` and union types.

Note you could also automate this via
[`pyupgrade`](https://github.com/asottile/pyupgrade#pep-604-typing-rewrites)