nbQA icon indicating copy to clipboard operation
nbQA copied to clipboard

Issue with `ast` in Python3.14

Open rossbar opened this issue 1 month ago • 1 comments

We've encountered an issue with nbqa with Python3.14; specifically an AttributeError with ast:

nbQA failed to process content/algorithms/assortativity/correlation.md
with exception "AttributeError("module 'ast' has no attribute 'Str'")"

Reproduce

git clone https://github.com/networkx/nx-guides
python3.14 -m venv test-env
source test-env/bin/activate
pip install -r requirements.txt 
pip install pre-commit
pre-commit install
pre-commit run --all-files

which gives

nbqa-pyupgrade...........................................................Failed
- hook id: nbqa-pyupgrade
- exit code: 123

nbQA failed to process content/algorithms/assortativity/correlation.md with exception "AttributeError("module 'ast' has no attribute 'Str'")"
nbQA failed to process content/algorithms/dag/index.md with exception "AttributeError("module 'ast' has no attribute 'Str'")"
nbQA failed to process content/exploratory_notebooks/facebook_notebook.md with exception "AttributeError("module 'ast' has no attribute 'Str'")"
nbQA failed to process content/generators/geometric.md with exception "AttributeError("module 'ast' has no attribute 'Str'")"

If you believe the notebook(s) to be valid, please report a bug at https://github.com/nbQA-dev/nbQA/issues 

nbqa-black...............................................................Failed
- hook id: nbqa-black
- exit code: 123

All done! ✨ 🍰 ✨
8 files left unchanged.

nbQA failed to process content/algorithms/assortativity/correlation.md with exception "AttributeError("module 'ast' has no attribute 'Str'")"
nbQA failed to process content/algorithms/dag/index.md with exception "AttributeError("module 'ast' has no attribute 'Str'")"
nbQA failed to process content/exploratory_notebooks/facebook_notebook.md with exception "AttributeError("module 'ast' has no attribute 'Str'")"
nbQA failed to process content/generators/geometric.md with exception "AttributeError("module 'ast' has no attribute 'Str'")"

If you believe the notebook(s) to be valid, please report a bug at https://github.com/nbQA-dev/nbQA/issues 

Additional context

Runs fine with python3.13

rossbar avatar Nov 05 '25 10:11 rossbar

thanks @rossbar for the report - we should update it with whatever the replacement is (ast.Constant?) fancy making a PR?

MarcoGorelli avatar Nov 05 '25 10:11 MarcoGorelli