Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ jobs:
os:
- "ubuntu-24.04-arm"
include:
- python-version: "3.10"
kind: "old"
os: "ubuntu-24.04-arm"
- python-version: "3.10"
kind: "no-toml"
os: "ubuntu-24.04-arm"
Expand Down Expand Up @@ -58,6 +61,8 @@ jobs:
pip install -e ".[dev]" # install the codespell dev packages
- run: pip install aspell-python-py3
if: startsWith(matrix.os, 'ubuntu')
- run: pip install "chardet<7"
if: ${{ matrix.kind == 'old' }}
- run: codespell --help
- run: codespell --version
- run: make check
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ codespell.egg-info
codespell_lib/_version.py
junit-results.xml
*.egg-info/
.DS_Store
10 changes: 7 additions & 3 deletions codespell_lib/_codespell.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,14 +223,18 @@ def __init__(

def init_chardet(self) -> None:
try:
from chardet.universaldetector import UniversalDetector
except ImportError as e:
import chardet # noqa: F401
except ImportError:
msg = (
"There's no chardet installed to import from. "
"Please, install it and check your PYTHONPATH "
"environment variable"
)
raise ImportError(msg) from e
raise ImportError(msg)
try:
from chardet import UniversalDetector
except ImportError: # chardet < 7
from chardet.universaldetector import UniversalDetector

self.encdetector = UniversalDetector()

Expand Down
Loading