Skip to main content

A Flake8 plugin to identify incorrect use of encodings.

Project description

A Flake8 plugin to identify incorrect use of encodings.

Docs

Documentation Build Status Docs Check Status

Tests

Linux Test Status Windows Test Status macOS Test Status Coverage

PyPI

PyPI - Package Version PyPI - Supported Python Versions PyPI - Supported Implementations PyPI - Wheel

Anaconda

Conda - Package Version Conda - Platform

Activity

GitHub last commit GitHub commits since tagged version Maintenance PyPI - Downloads

QA

CodeFactor Grade Flake8 Status mypy status

Other

License GitHub top language Requirements Status

Installation

flake8-encodings can be installed from PyPI or Anaconda.

To install with pip:

$ python -m pip install flake8-encodings

To install with conda:

  • First add the required channels

$ conda config --add channels https://conda.anaconda.org/conda-forge
$ conda config --add channels https://conda.anaconda.org/domdfcoding
  • Then install

$ conda install flake8-encodings

In version 0.5.0.post1 and above the functionality for checking classes (configparser.ConfigParser and pathlib.Path for now) requires the classes extra to be installed:

$ python3 -m pip install flake8-encodings[classes]

The checks for classes are slower and CPU intensive, so only enable them if you use the classes in question.

Motivation

Developers using macOS or Linux may forget that the default encoding is not always UTF-8.

For example, long_description = open("README.md").read() in setup.py is a common mistake. Many Windows users cannot install the package if there is at least one non-ASCII character (e.g. emoji) in the README.md file which is encoded in UTF-8.

For example, 489 packages of the 4000 most downloaded packages from PyPI used non-ASCII characters in README. And 82 packages of them cannot be installed from source package when the locale encoding is ASCII. [1] They used the default encoding to read README or TOML file.

Even Python experts assume that default encoding is UTF-8. It creates bugs that happen only on Windows. See [2], [3], [4], and [5] for example.

PEP 597 proposed adding a new EncodingWarning to Python, which can be used in conjunction with this tool to identify issues at runtime.

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_encodings-0.5.0.post1.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

flake8_encodings-0.5.0.post1-py3-none-any.whl (25.4 kB view details)

Uploaded Python 3

File details

Details for the file flake8_encodings-0.5.0.post1.tar.gz.

File metadata

  • Download URL: flake8_encodings-0.5.0.post1.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for flake8_encodings-0.5.0.post1.tar.gz
Algorithm Hash digest
SHA256 082c0163325c85b438a8106e876283b5ed3cbfc53e68d89130d70be8be4c9977
MD5 adccb82300bda43c040d13a55dcbe77d
BLAKE2b-256 12e91e26e53391aadc33f4a1a078780c40f503c163de6ebbdcb3b5f93b778633

See more details on using hashes here.

File details

Details for the file flake8_encodings-0.5.0.post1-py3-none-any.whl.

File metadata

  • Download URL: flake8_encodings-0.5.0.post1-py3-none-any.whl
  • Upload date:
  • Size: 25.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for flake8_encodings-0.5.0.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 d2fecca0e89ba09c86e5d61cf6bdb1b337f0d74746aac67bbcf0c517b4cb6cba
MD5 3f2b2f52112463f4c675dd35427e3d61
BLAKE2b-256 382a54a649cf3b7402b5c68f8dfd1c1a83763a3bcb36899a8cce72a2e2e094cd

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