flake8-encodings


Nameflake8-encodings JSON
Version 0.5.1 PyPI version JSON
download
home_pagehttps://github.com/python-formate/flake8-encodings
SummaryA Flake8 plugin to identify incorrect use of encodings.
upload_time2023-11-20 15:27:09
maintainer
docs_urlNone
author
requires_python>=3.6
licenseMIT
keywords encodings flake8 pep597 unicode
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
#################
flake8-encodings
#################

.. start short_desc

**A Flake8 plugin to identify incorrect use of encodings.**

.. end short_desc


.. start shields

.. list-table::
	:stub-columns: 1
	:widths: 10 90

	* - Docs
	  - |docs| |docs_check|
	* - Tests
	  - |actions_linux| |actions_windows| |actions_macos| |coveralls|
	* - PyPI
	  - |pypi-version| |supported-versions| |supported-implementations| |wheel|
	* - Anaconda
	  - |conda-version| |conda-platform|
	* - Activity
	  - |commits-latest| |commits-since| |maintained| |pypi-downloads|
	* - QA
	  - |codefactor| |actions_flake8| |actions_mypy|
	* - Other
	  - |license| |language| |requires|

.. |docs| image:: https://img.shields.io/readthedocs/flake8-encodings/latest?logo=read-the-docs
	:target: https://flake8-encodings.readthedocs.io/en/latest
	:alt: Documentation Build Status

.. |docs_check| image:: https://github.com/python-formate/flake8-encodings/workflows/Docs%20Check/badge.svg
	:target: https://github.com/python-formate/flake8-encodings/actions?query=workflow%3A%22Docs+Check%22
	:alt: Docs Check Status

.. |actions_linux| image:: https://github.com/python-formate/flake8-encodings/workflows/Linux/badge.svg
	:target: https://github.com/python-formate/flake8-encodings/actions?query=workflow%3A%22Linux%22
	:alt: Linux Test Status

.. |actions_windows| image:: https://github.com/python-formate/flake8-encodings/workflows/Windows/badge.svg
	:target: https://github.com/python-formate/flake8-encodings/actions?query=workflow%3A%22Windows%22
	:alt: Windows Test Status

.. |actions_macos| image:: https://github.com/python-formate/flake8-encodings/workflows/macOS/badge.svg
	:target: https://github.com/python-formate/flake8-encodings/actions?query=workflow%3A%22macOS%22
	:alt: macOS Test Status

.. |actions_flake8| image:: https://github.com/python-formate/flake8-encodings/workflows/Flake8/badge.svg
	:target: https://github.com/python-formate/flake8-encodings/actions?query=workflow%3A%22Flake8%22
	:alt: Flake8 Status

.. |actions_mypy| image:: https://github.com/python-formate/flake8-encodings/workflows/mypy/badge.svg
	:target: https://github.com/python-formate/flake8-encodings/actions?query=workflow%3A%22mypy%22
	:alt: mypy status

.. |requires| image:: https://dependency-dash.repo-helper.uk/github/python-formate/flake8-encodings/badge.svg
	:target: https://dependency-dash.repo-helper.uk/github/python-formate/flake8-encodings/
	:alt: Requirements Status

.. |coveralls| image:: https://img.shields.io/coveralls/github/python-formate/flake8-encodings/master?logo=coveralls
	:target: https://coveralls.io/github/python-formate/flake8-encodings?branch=master
	:alt: Coverage

.. |codefactor| image:: https://img.shields.io/codefactor/grade/github/python-formate/flake8-encodings?logo=codefactor
	:target: https://www.codefactor.io/repository/github/python-formate/flake8-encodings
	:alt: CodeFactor Grade

.. |pypi-version| image:: https://img.shields.io/pypi/v/flake8-encodings
	:target: https://pypi.org/project/flake8-encodings/
	:alt: PyPI - Package Version

.. |supported-versions| image:: https://img.shields.io/pypi/pyversions/flake8-encodings?logo=python&logoColor=white
	:target: https://pypi.org/project/flake8-encodings/
	:alt: PyPI - Supported Python Versions

.. |supported-implementations| image:: https://img.shields.io/pypi/implementation/flake8-encodings
	:target: https://pypi.org/project/flake8-encodings/
	:alt: PyPI - Supported Implementations

.. |wheel| image:: https://img.shields.io/pypi/wheel/flake8-encodings
	:target: https://pypi.org/project/flake8-encodings/
	:alt: PyPI - Wheel

.. |conda-version| image:: https://img.shields.io/conda/v/domdfcoding/flake8-encodings?logo=anaconda
	:target: https://anaconda.org/domdfcoding/flake8-encodings
	:alt: Conda - Package Version

.. |conda-platform| image:: https://img.shields.io/conda/pn/domdfcoding/flake8-encodings?label=conda%7Cplatform
	:target: https://anaconda.org/domdfcoding/flake8-encodings
	:alt: Conda - Platform

.. |license| image:: https://img.shields.io/github/license/python-formate/flake8-encodings
	:target: https://github.com/python-formate/flake8-encodings/blob/master/LICENSE
	:alt: License

.. |language| image:: https://img.shields.io/github/languages/top/python-formate/flake8-encodings
	:alt: GitHub top language

.. |commits-since| image:: https://img.shields.io/github/commits-since/python-formate/flake8-encodings/v0.5.1
	:target: https://github.com/python-formate/flake8-encodings/pulse
	:alt: GitHub commits since tagged version

.. |commits-latest| image:: https://img.shields.io/github/last-commit/python-formate/flake8-encodings
	:target: https://github.com/python-formate/flake8-encodings/commit/master
	:alt: GitHub last commit

.. |maintained| image:: https://img.shields.io/maintenance/yes/2023
	:alt: Maintenance

.. |pypi-downloads| image:: https://img.shields.io/pypi/dm/flake8-encodings
	:target: https://pypi.org/project/flake8-encodings/
	:alt: PyPI - Downloads

.. end shields

Installation
--------------

.. start installation

``flake8-encodings`` can be installed from PyPI or Anaconda.

To install with ``pip``:

.. code-block:: bash

	$ python -m pip install flake8-encodings

To install with ``conda``:

	* First add the required channels

	.. code-block:: bash

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

	* Then install

	.. code-block:: bash

		$ conda install flake8-encodings

.. end installation


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:

.. code-block:: bash

	$ 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 <https://www.python.org/dev/peps/pep-0597>`_ proposed adding a new ``EncodingWarning`` to Python,
which can be used in conjunction with this tool to identify issues at runtime.


.. [1] "Packages can't be installed when encoding is not UTF-8"
       (https://github.com/methane/pep597-pypi-ascii)

.. [2] Packaging tutorial in packaging.python.org didn't specify
       encoding to read a ``README.md``
       (https://github.com/pypa/packaging.python.org/pull/682)

.. [3] ``json.tool`` had used locale encoding to read JSON files.
       (https://bugs.python.org/issue33684)

.. [4] site: Potential UnicodeDecodeError when handling pth file
       (https://bugs.python.org/issue33684)

.. [5] pypa/pip: "Installing packages fails if Python 3 installed
       into path with non-ASCII characters"
       (https://github.com/pypa/pip/issues/9054)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/python-formate/flake8-encodings",
    "name": "flake8-encodings",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "encodings,flake8,pep597,unicode",
    "author": "",
    "author_email": "Dominic Davis-Foster <dominic@davis-foster.co.uk>",
    "download_url": "https://files.pythonhosted.org/packages/21/e2/ed163bcf489b10ac406606074680bb25db748c4f6b97a86472f057235010/flake8_encodings-0.5.1.tar.gz",
    "platform": "Windows",
    "description": "\n#################\nflake8-encodings\n#################\n\n.. start short_desc\n\n**A Flake8 plugin to identify incorrect use of encodings.**\n\n.. end short_desc\n\n\n.. start shields\n\n.. list-table::\n\t:stub-columns: 1\n\t:widths: 10 90\n\n\t* - Docs\n\t  - |docs| |docs_check|\n\t* - Tests\n\t  - |actions_linux| |actions_windows| |actions_macos| |coveralls|\n\t* - PyPI\n\t  - |pypi-version| |supported-versions| |supported-implementations| |wheel|\n\t* - Anaconda\n\t  - |conda-version| |conda-platform|\n\t* - Activity\n\t  - |commits-latest| |commits-since| |maintained| |pypi-downloads|\n\t* - QA\n\t  - |codefactor| |actions_flake8| |actions_mypy|\n\t* - Other\n\t  - |license| |language| |requires|\n\n.. |docs| image:: https://img.shields.io/readthedocs/flake8-encodings/latest?logo=read-the-docs\n\t:target: https://flake8-encodings.readthedocs.io/en/latest\n\t:alt: Documentation Build Status\n\n.. |docs_check| image:: https://github.com/python-formate/flake8-encodings/workflows/Docs%20Check/badge.svg\n\t:target: https://github.com/python-formate/flake8-encodings/actions?query=workflow%3A%22Docs+Check%22\n\t:alt: Docs Check Status\n\n.. |actions_linux| image:: https://github.com/python-formate/flake8-encodings/workflows/Linux/badge.svg\n\t:target: https://github.com/python-formate/flake8-encodings/actions?query=workflow%3A%22Linux%22\n\t:alt: Linux Test Status\n\n.. |actions_windows| image:: https://github.com/python-formate/flake8-encodings/workflows/Windows/badge.svg\n\t:target: https://github.com/python-formate/flake8-encodings/actions?query=workflow%3A%22Windows%22\n\t:alt: Windows Test Status\n\n.. |actions_macos| image:: https://github.com/python-formate/flake8-encodings/workflows/macOS/badge.svg\n\t:target: https://github.com/python-formate/flake8-encodings/actions?query=workflow%3A%22macOS%22\n\t:alt: macOS Test Status\n\n.. |actions_flake8| image:: https://github.com/python-formate/flake8-encodings/workflows/Flake8/badge.svg\n\t:target: https://github.com/python-formate/flake8-encodings/actions?query=workflow%3A%22Flake8%22\n\t:alt: Flake8 Status\n\n.. |actions_mypy| image:: https://github.com/python-formate/flake8-encodings/workflows/mypy/badge.svg\n\t:target: https://github.com/python-formate/flake8-encodings/actions?query=workflow%3A%22mypy%22\n\t:alt: mypy status\n\n.. |requires| image:: https://dependency-dash.repo-helper.uk/github/python-formate/flake8-encodings/badge.svg\n\t:target: https://dependency-dash.repo-helper.uk/github/python-formate/flake8-encodings/\n\t:alt: Requirements Status\n\n.. |coveralls| image:: https://img.shields.io/coveralls/github/python-formate/flake8-encodings/master?logo=coveralls\n\t:target: https://coveralls.io/github/python-formate/flake8-encodings?branch=master\n\t:alt: Coverage\n\n.. |codefactor| image:: https://img.shields.io/codefactor/grade/github/python-formate/flake8-encodings?logo=codefactor\n\t:target: https://www.codefactor.io/repository/github/python-formate/flake8-encodings\n\t:alt: CodeFactor Grade\n\n.. |pypi-version| image:: https://img.shields.io/pypi/v/flake8-encodings\n\t:target: https://pypi.org/project/flake8-encodings/\n\t:alt: PyPI - Package Version\n\n.. |supported-versions| image:: https://img.shields.io/pypi/pyversions/flake8-encodings?logo=python&logoColor=white\n\t:target: https://pypi.org/project/flake8-encodings/\n\t:alt: PyPI - Supported Python Versions\n\n.. |supported-implementations| image:: https://img.shields.io/pypi/implementation/flake8-encodings\n\t:target: https://pypi.org/project/flake8-encodings/\n\t:alt: PyPI - Supported Implementations\n\n.. |wheel| image:: https://img.shields.io/pypi/wheel/flake8-encodings\n\t:target: https://pypi.org/project/flake8-encodings/\n\t:alt: PyPI - Wheel\n\n.. |conda-version| image:: https://img.shields.io/conda/v/domdfcoding/flake8-encodings?logo=anaconda\n\t:target: https://anaconda.org/domdfcoding/flake8-encodings\n\t:alt: Conda - Package Version\n\n.. |conda-platform| image:: https://img.shields.io/conda/pn/domdfcoding/flake8-encodings?label=conda%7Cplatform\n\t:target: https://anaconda.org/domdfcoding/flake8-encodings\n\t:alt: Conda - Platform\n\n.. |license| image:: https://img.shields.io/github/license/python-formate/flake8-encodings\n\t:target: https://github.com/python-formate/flake8-encodings/blob/master/LICENSE\n\t:alt: License\n\n.. |language| image:: https://img.shields.io/github/languages/top/python-formate/flake8-encodings\n\t:alt: GitHub top language\n\n.. |commits-since| image:: https://img.shields.io/github/commits-since/python-formate/flake8-encodings/v0.5.1\n\t:target: https://github.com/python-formate/flake8-encodings/pulse\n\t:alt: GitHub commits since tagged version\n\n.. |commits-latest| image:: https://img.shields.io/github/last-commit/python-formate/flake8-encodings\n\t:target: https://github.com/python-formate/flake8-encodings/commit/master\n\t:alt: GitHub last commit\n\n.. |maintained| image:: https://img.shields.io/maintenance/yes/2023\n\t:alt: Maintenance\n\n.. |pypi-downloads| image:: https://img.shields.io/pypi/dm/flake8-encodings\n\t:target: https://pypi.org/project/flake8-encodings/\n\t:alt: PyPI - Downloads\n\n.. end shields\n\nInstallation\n--------------\n\n.. start installation\n\n``flake8-encodings`` can be installed from PyPI or Anaconda.\n\nTo install with ``pip``:\n\n.. code-block:: bash\n\n\t$ python -m pip install flake8-encodings\n\nTo install with ``conda``:\n\n\t* First add the required channels\n\n\t.. code-block:: bash\n\n\t\t$ conda config --add channels https://conda.anaconda.org/conda-forge\n\t\t$ conda config --add channels https://conda.anaconda.org/domdfcoding\n\n\t* Then install\n\n\t.. code-block:: bash\n\n\t\t$ conda install flake8-encodings\n\n.. end installation\n\n\nIn version 0.5.1 and above the functionality for checking classes\n(``configparser.ConfigParser`` and ``pathlib.Path`` for now)\nrequires the ``classes`` extra to be installed:\n\n.. code-block:: bash\n\n\t$ python3 -m pip install flake8-encodings[classes]\n\nThe checks for classes are slower and CPU intensive,\nso only enable them if you use the classes in question.\n\n\n\nMotivation\n-------------\n\nDevelopers using macOS or Linux may forget that the default encoding\nis not always UTF-8.\n\nFor example, ``long_description = open(\"README.md\").read()`` in\n``setup.py`` is a common mistake. Many Windows users cannot install\nthe package if there is at least one non-ASCII character (e.g. emoji)\nin the ``README.md`` file which is encoded in UTF-8.\n\nFor example, 489 packages of the 4000 most downloaded packages from\nPyPI used non-ASCII characters in README. And 82 packages of them\ncannot be installed from source package when the locale encoding is\nASCII. [1]_ They used the default encoding to read README or TOML\nfile.\n\nEven Python experts assume that default encoding is UTF-8.\nIt creates bugs that happen only on Windows. See [2]_, [3]_, [4]_,\nand [5]_ for example.\n\n`PEP 597 <https://www.python.org/dev/peps/pep-0597>`_ proposed adding a new ``EncodingWarning`` to Python,\nwhich can be used in conjunction with this tool to identify issues at runtime.\n\n\n.. [1] \"Packages can't be installed when encoding is not UTF-8\"\n       (https://github.com/methane/pep597-pypi-ascii)\n\n.. [2] Packaging tutorial in packaging.python.org didn't specify\n       encoding to read a ``README.md``\n       (https://github.com/pypa/packaging.python.org/pull/682)\n\n.. [3] ``json.tool`` had used locale encoding to read JSON files.\n       (https://bugs.python.org/issue33684)\n\n.. [4] site: Potential UnicodeDecodeError when handling pth file\n       (https://bugs.python.org/issue33684)\n\n.. [5] pypa/pip: \"Installing packages fails if Python 3 installed\n       into path with non-ASCII characters\"\n       (https://github.com/pypa/pip/issues/9054)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A Flake8 plugin to identify incorrect use of encodings.",
    "version": "0.5.1",
    "project_urls": {
        "Documentation": "https://flake8-encodings.readthedocs.io/en/latest",
        "Homepage": "https://github.com/python-formate/flake8-encodings",
        "Issue Tracker": "https://github.com/python-formate/flake8-encodings/issues",
        "Source Code": "https://github.com/python-formate/flake8-encodings"
    },
    "split_keywords": [
        "encodings",
        "flake8",
        "pep597",
        "unicode"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2ae8424b68e14d6d31b635c84ab829f1df998d45ea2f1bdee7404cd4726f7a13",
                "md5": "7f15c715547d11fcdf090276444c8936",
                "sha256": "78b0a65083511c177c910484477b692fc4c0b4ba100714cdaa88be1cf095f816"
            },
            "downloads": -1,
            "filename": "flake8_encodings-0.5.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7f15c715547d11fcdf090276444c8936",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 25573,
            "upload_time": "2023-11-20T15:27:08",
            "upload_time_iso_8601": "2023-11-20T15:27:08.332933Z",
            "url": "https://files.pythonhosted.org/packages/2a/e8/424b68e14d6d31b635c84ab829f1df998d45ea2f1bdee7404cd4726f7a13/flake8_encodings-0.5.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "21e2ed163bcf489b10ac406606074680bb25db748c4f6b97a86472f057235010",
                "md5": "b6bb332309afce60838b74c4817c4180",
                "sha256": "f42bb26d6b46f298affff247d57b0578812120c838b4f299fb07b41285c82b4e"
            },
            "downloads": -1,
            "filename": "flake8_encodings-0.5.1.tar.gz",
            "has_sig": false,
            "md5_digest": "b6bb332309afce60838b74c4817c4180",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 8290,
            "upload_time": "2023-11-20T15:27:09",
            "upload_time_iso_8601": "2023-11-20T15:27:09.974745Z",
            "url": "https://files.pythonhosted.org/packages/21/e2/ed163bcf489b10ac406606074680bb25db748c4f6b97a86472f057235010/flake8_encodings-0.5.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-20 15:27:09",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "python-formate",
    "github_project": "flake8-encodings",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "tox": true,
    "lcname": "flake8-encodings"
}
        
Elapsed time: 0.26645s