Skip to main content

flake8-encodings

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.1 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.

Metadata

Release files for flake8-encodings 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flake8-encodings 0.5.1
File Size Uploaded
flake8_encodings-0.5.1.tar.gz 8.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flake8-encodings 0.5.1
File Interpreter ABI Platform
flake8_encodings-0.5.1-py3-none-any.whl Python 3 none any Details

Total release size: 33.9 kB

Release files / flake8_encodings-0.5.1.tar.gz

Download URL flake8_encodings-0.5.1.tar.gz
Size 8.3 kB
Tags Source
SHA-256 checksum
How to use checksums
f42bb26d6b46f298affff247d57b0578812120c838b4f299fb07b41285c82b4e
BLAKE2b-256 checksum
How to use checksums
21e2ed163bcf489b10ac406606074680bb25db748c4f6b97a86472f057235010
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release files / flake8_encodings-0.5.1-py3-none-any.whl

Download URL flake8_encodings-0.5.1-py3-none-any.whl
Size 25.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
78b0a65083511c177c910484477b692fc4c0b4ba100714cdaa88be1cf095f816
BLAKE2b-256 checksum
How to use checksums
2ae8424b68e14d6d31b635c84ab829f1df998d45ea2f1bdee7404cd4726f7a13
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release history Release notifications | RSS feed

This release

0.5.1 This release

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page