Skip to content

Commit 68ebc08

Browse files
fsecada01claude
andcommitted
Fix CI type checking and lxml build failures
- Add loguru to dev dependencies to ensure consistent type checking environment across local and CI (with/without --all-extras) - Remove now-unused type: ignore comments in logger.py, conftest.py, and test_word_loader.py since loguru is always present in dev - Restore type: ignore[assignment] in logger.py for the logging fallback - Add libxml2-dev and libxslt-dev system packages for Python 3.14 CI to support lxml source builds (no pre-built wheel exists for 3.14) Fixes ty type check errors that occurred when loguru was installed (CI with --all-extras) but not locally (dev without extras). Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
1 parent b03f972 commit 68ebc08

8 files changed

Lines changed: 50 additions & 7 deletions

File tree

.claude/settings.local.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(git add:*)",
5+
"Bash(git commit:*)",
6+
"WebSearch",
7+
"Bash(uv sync:*)",
8+
"Bash(pre-commit uninstall:*)",
9+
"Bash(uv run:*)",
10+
"Bash(git push:*)",
11+
"Bash(gh run list:*)",
12+
"Bash(gh run view:*)",
13+
"Bash(git check-ignore:*)",
14+
"Bash(rtk git add:*)",
15+
"Bash(rtk git:*)",
16+
"Bash(gh api:*)",
17+
"WebFetch(domain:github.com)",
18+
"Bash(git rm:*)",
19+
"WebFetch(domain:pdoc.dev)",
20+
"WebFetch(domain:raw.githubusercontent.com)",
21+
"WebFetch(domain:api.github.com)",
22+
"Bash(echo:*)",
23+
"Bash(dir:*)",
24+
"Bash(git -C \"C:/dev/python/modules/TextSpitter\" status --short)",
25+
"Bash(git -C \"C:/dev/python/modules/TextSpitter\" rm tests/txt_test.py)",
26+
"Bash(git -C \"C:/dev/python/modules/TextSpitter\" add core_requirements.in core_requirements.txt dev_requirements.in dev_requirements.txt requirements.txt .pre-commit-config.yaml TextSpitter/__init__.py TextSpitter/main.py TextSpitter/core.py tests/test_cli.py tests/test_txt.py CONTRIBUTING.md CHANGELOG.md README.md uv.lock)",
27+
"Bash(python -m pytest:*)",
28+
"Bash(findstr:*)",
29+
"Bash(git -C \"C:/dev/python/modules/TextSpitter\" add TextSpitter/cli.py tests/test_csv.py pyproject.toml .github/workflows/tests.yml uv.lock)",
30+
"Bash(git -C:*)",
31+
"Bash(uv:*)",
32+
"Bash(.venv/Scripts/ty.exe check:*)",
33+
"Bash(\".venv/Scripts/ty.exe\" --version)"
34+
]
35+
}
36+
}

.coverage

52 KB
Binary file not shown.

.github/workflows/tests.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ jobs:
2323
- name: Set up Python ${{ matrix.python-version }}
2424
run: uv python install ${{ matrix.python-version }}
2525

26+
- name: Install system dependencies (lxml build deps for Python 3.14)
27+
if: matrix.python-version == '3.14'
28+
run: sudo apt-get install -y libxml2-dev libxslt-dev
29+
2630
- name: Install dependencies
2731
run: uv sync --all-extras --dev
2832

TextSpitter/logger.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"""
77

88
try:
9-
from loguru import logger # type: ignore[import]
9+
from loguru import logger
1010
except ImportError:
1111
import logging
1212

13-
logger = logging.getLogger("textspitter")
13+
logger = logging.getLogger("textspitter") # type: ignore[assignment]

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ dev = [
109109
"isort",
110110
"jupyterlab",
111111
"jupyterlab-code-formatter",
112+
"loguru",
112113
"pdoc",
113114
"prek",
114115
"pytest",

tests/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ def test_something(log_capture):
3131
def _sink(message):
3232
messages.append(message.record["message"])
3333

34-
handler_id = logger.add(_sink, level="DEBUG", format="{message}") # type: ignore[call-non-callable]
34+
handler_id = logger.add(_sink, level="DEBUG", format="{message}")
3535
yield messages
36-
logger.remove(handler_id) # type: ignore[union-attr]
36+
logger.remove(handler_id)
3737
else:
3838
# stdlib logging fallback
3939
class _ListHandler(logging.Handler):

tests/test_word_loader.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
try:
88
from TextSpitter.logger import logger as word_loader_logger_instance
99
except ImportError:
10-
from loguru import logger as word_loader_logger_instance # type: ignore[import]
10+
from loguru import logger as word_loader_logger_instance
1111

1212
from TextSpitter.core import FileExtractor
1313
from TextSpitter.main import WordLoader
@@ -32,13 +32,13 @@ def loguru_test_sink(request): # request is a pytest fixture
3232
def sink_function(message):
3333
log_messages.append(message.record["message"])
3434

35-
handler_id = word_loader_logger_instance.add( # type: ignore[call-non-callable]
35+
handler_id = word_loader_logger_instance.add(
3636
sink_function, format="{message}"
3737
)
3838
yield log_messages
3939

4040
try:
41-
word_loader_logger_instance.remove(handler_id) # type: ignore[call-non-callable]
41+
word_loader_logger_instance.remove(handler_id)
4242
except ValueError:
4343
pass # Handler already removed or never added
4444

uv.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)