{"id":13733522,"url":"https://github.com/python-formate/flake8-encodings","last_synced_at":"2025-04-14T07:06:19.215Z","repository":{"id":38189990,"uuid":"337722579","full_name":"python-formate/flake8-encodings","owner":"python-formate","description":"A Flake8 plugin to identify incorrect use of encodings.","archived":false,"fork":false,"pushed_at":"2025-04-10T14:00:16.000Z","size":314,"stargazers_count":7,"open_issues_count":3,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-14T07:06:08.400Z","etag":null,"topics":["encodings","flake8","pep597","python","unicode"],"latest_commit_sha":null,"homepage":"https://flake8-encodings.readthedocs.io/en/latest","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/python-formate.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["domdfcoding"]}},"created_at":"2021-02-10T12:49:57.000Z","updated_at":"2025-04-10T14:00:19.000Z","dependencies_parsed_at":"2024-01-06T09:53:39.581Z","dependency_job_id":"962bdd3d-3921-4d87-b006-f31d6a2e64f9","html_url":"https://github.com/python-formate/flake8-encodings","commit_stats":{"total_commits":95,"total_committers":3,"mean_commits":"31.666666666666668","dds":0.3157894736842105,"last_synced_commit":"bd8c7db60cbdb108c7c9fb222e4dd6068bddc8ea"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-formate%2Fflake8-encodings","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-formate%2Fflake8-encodings/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-formate%2Fflake8-encodings/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-formate%2Fflake8-encodings/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/python-formate","download_url":"https://codeload.github.com/python-formate/flake8-encodings/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248837281,"owners_count":21169374,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["encodings","flake8","pep597","python","unicode"],"created_at":"2024-08-03T03:00:44.743Z","updated_at":"2025-04-14T07:06:19.200Z","avatar_url":"https://github.com/python-formate.png","language":"Python","funding_links":["https://github.com/sponsors/domdfcoding"],"categories":["Bugs"],"sub_categories":[],"readme":"#################\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\u0026logoColor=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/2025\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 \u003chttps://www.python.org/dev/peps/pep-0597\u003e`_ 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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpython-formate%2Fflake8-encodings","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpython-formate%2Fflake8-encodings","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpython-formate%2Fflake8-encodings/lists"}