A Flake8 plugin to identify incorrect use of encodings.
Project description
A Flake8 plugin to identify incorrect use of encodings.
Docs |
|
---|---|
Tests |
|
PyPI |
|
Anaconda |
|
Activity |
|
QA |
|
Other |
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 http://conda.anaconda.org/conda-forge $ conda config --add channels http://conda.anaconda.org/domdfcoding
Then install
$ conda install flake8-encodings
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for flake8_encodings-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa661132522dcebc49e8454ed6136fc487c1da9c20ee99742c356a53f3f283e1 |
|
MD5 | 4d09649c0cd12c7af1cf4c3d4b35bc49 |
|
BLAKE2b-256 | fae341473d13606839d3f746523e7f6eeaabe078f3410cf2a3c165f4f7830273 |