#1862·visdom

Pre-commit hook for black fails on Python 3.14 (module 'ast' has no attribute 'Str')

Author: ArnavBallinCodeCreated Sep 25, 2026Updated Sep 25, 2026

When running pre-commit on a system with Python 3.14, the black hook fails with the following error:

error: cannot format py/...: module 'ast' has no attribute 'Str'

This happens because the version of black pinned in .pre-commit-config.yaml is 23.1.0. In Python 3.14, ast.Str was completely removed (it had been deprecated since Python 3.8 in favor of ast.Constant), causing the older version of black to immediately crash when attempting to format files.

Proposed Solution: Bump the black version in .pre-commit-config.yaml to a newer version that supports Python 3.14.