⭐️ Thanks everyone who has starred the project, it means a lot!
Install from PyPI by clicking the badge above
View the source code on GitHub
Flake8 plugin that enforces corporate code style by detecting and reporting any only-english text in Python source
code.
It ensures that comments, docstrings, and string literals are written in English only, maintaining consistency across
the codebase.
- Scans Python files for only-english characters in:
- Comments (
# ...
) - Docstrings (
""" ... """
/''' ... '''
) - String literals (
"..."
/'...'
)
- Comments (
- Raises a linting error (
NL001
) when only-english text is found. - Works seamlessly with Flake8 and pre-commit hooks.
- Lightweight and dependency-minimal.
pip install flake8-only-english
Run normally via flake8
:
flake8 app
flake8 --select=NLE
flake8 --select=NLE001
flake8 --select=NLE002
Example output:
/example.py:5:10: NLE001 Non-English text in docstring
# This is a valid English comment
def hello():
"""Valid English docstring"""
msg = "Hello world"
return msg
Add to .pre-commit-config.yaml
:
repos:
- repo: https://github.com/AlgorithmAlchemy/flake8-only-english
rev: v0.1.0
hooks:
- id: flake8
additional_dependencies: [ flake8-only-english ]
Run:
pre-commit run --all-files
- NLE001 — Non-English text in docstring.
- NLE002 — Non-English text in string literal
Clone and install in editable mode:
git clone https://github.com/AlgorithmAlchemy/flake8-only-english
cd flake8-only-english
pip install -e .[dev]
pytest
MIT License © 2025 AlgorithmAlchemy