Skip to main content

flake8 plugin to enforce use of `|` over `typing.Union`

Project description

flake8-pep604

flake8 plugin which forbids use of typing.Union (in favour of |), per PEP 604.

Note the | notation is a syntax error for Python < 3.10. In this case you can use the annotations feature (see PEP 563).

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.

Development

Get started by installing everything in a virtualenv

$ python -m .venv venv
$ pip install --requirement requirements-dev.txt
$ pre-commit install

Then testing:

$ pytest

And linting:

$ pre-commit run --all-files

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flake8_pep604-0.1.0.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

flake8_pep604-0.1.0-py2.py3-none-any.whl (3.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file flake8_pep604-0.1.0.tar.gz.

File metadata

  • Download URL: flake8_pep604-0.1.0.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.7.13

File hashes

Hashes for flake8_pep604-0.1.0.tar.gz
Algorithm Hash digest
SHA256 38d8852ac6a7c33a0d863841154fdc055128713f2f78d13e9664ac277374c4f2
MD5 26599b769524a7e9509d52be79bea809
BLAKE2b-256 599eb6e1ef8035c0e64902f9a6ca7fdff25c1df4a591a6daea15a470d1b658c5

See more details on using hashes here.

File details

Details for the file flake8_pep604-0.1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for flake8_pep604-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 87449930c00c50dfac4b2d3dcb847b49507a05fb8b888dc973dd338df350ca81
MD5 c8d8d283727584794992b20f34a6a43e
BLAKE2b-256 bb90414578b0acce6141c0c1fa81a46e44843ef9905831f46d0449d0a8421bfd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page