Skip to content

Commit b4a8aae

Browse files
authored
fix: resolve dependency mismatch and Windows encoding issues (anthropics#319)
* fix: resolve dependency mismatch and Windows encoding issues Fixes anthropics#316, anthropics#317, anthropics#318 This PR addresses three bugs affecting the development environment: 1. requirements.txt outdated dependencies (anthropics#316) - Updated anthropic version from 0.39.0 to 0.71.0 to match pyproject.toml - Added missing POSIX newline at end of file 2. Windows UTF-8 encoding failures in validate_notebooks.py (anthropics#317) - Added explicit encoding='utf-8' to file operations - Configured stdout/stderr to use UTF-8 on Windows - Fixes UnicodeDecodeError and UnicodeEncodeError on older Windows systems 3. Pre-commit hook environment mismatch (anthropics#318) - Changed validate-notebooks hook to use 'language: system' - Updated entry to use 'uv run python' for consistency with uv-based dependency management Testing: All pre-commit hooks pass successfully * refactor: remove redundant requirements.txt in favor of pyproject.toml Requirements.txt was causing sync issues with pyproject.toml. Since the project uses uv for dependency management, pyproject.toml and uv.lock are sufficient for managing dependencies.
1 parent 9fadbb7 commit b4a8aae

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ repos:
1212
hooks:
1313
- id: validate-notebooks
1414
name: Validate notebook structure
15-
entry: python scripts/validate_notebooks.py
16-
language: python
15+
entry: uv run python scripts/validate_notebooks.py
16+
language: system
1717
files: '\.ipynb$'
1818
pass_filenames: true

requirements.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.

scripts/validate_notebooks.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,17 @@
55
import sys
66
from pathlib import Path
77

8+
# Ensure UTF-8 output on Windows
9+
if sys.platform == "win32":
10+
sys.stdout.reconfigure(encoding="utf-8")
11+
sys.stderr.reconfigure(encoding="utf-8")
12+
813

914
def validate_notebook(path: Path) -> list:
1015
"""Validate a single notebook."""
1116
issues = []
1217

13-
with open(path) as f:
18+
with open(path, encoding="utf-8") as f:
1419
nb = json.load(f)
1520

1621
# Check for empty cells

0 commit comments

Comments
 (0)