Skip to main content

A flake8 plugin to check typing import style

Project description

flake8-typing-as-t

PyPI - Version PyPI - Python Version


Table of Contents

Overview

This is a flake8 plugin which ensures that imports from the typing library must be written using import typing as t.

Installation

pip install flake8-typing-as-t

Checks

  • TYT01: Bare import typing usage
  • TYT02: import typing as X where X is not literal t
  • TYT03: from typing import X usage

Handling typing-extensions

A common pattern for compatibility is to do a sys.version_info-guarded dispatch over typing_extensions. e.g.

if sys.version_info < (3, 8):
    from typing_extensions import Literal
else:
    from typing import Literal

flake8-typing-as-t allows for this usage by checking if the import is inside of a test on sys.version_info against a tuple.

License

flake8-typing-as-t is distributed under the terms of the MIT license.

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_typing_as_t-0.0.3.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

flake8_typing_as_t-0.0.3-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file flake8_typing_as_t-0.0.3.tar.gz.

File metadata

  • Download URL: flake8_typing_as_t-0.0.3.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.23.0

File hashes

Hashes for flake8_typing_as_t-0.0.3.tar.gz
Algorithm Hash digest
SHA256 9f2de98da76439d7013df646ff027cf16bc65d74b36345ae6cd6fac8d81a3df3
MD5 6a1380c80ce14c8319ae71c3e518cd65
BLAKE2b-256 65dc1dc6874c5e2d96183d6850a346f081f3d2d62726055e5ca9c14ff056bf9e

See more details on using hashes here.

Provenance

File details

Details for the file flake8_typing_as_t-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for flake8_typing_as_t-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 be3b1320bd7d712b2eb9f3a1a27924e291a3cb54df5fce78ae69f0a48b0671b6
MD5 f3086319f9a72fa48f3cdc1b6bcea608
BLAKE2b-256 00857d5b2506182c97903c3cc63427b852e941ca36a6c5283256771f6304b6fc

See more details on using hashes here.

Provenance

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