Repository navigation
Conversation
Python 3.14 removed the deprecated ast.Str and ast.Ellipsis aliases, so py2pyi raised AttributeError for any function with a docstring. Check for ast.Constant with a str or Ellipsis value instead, which is what the aliases matched. Also drop the stale DeprecationWarning outputs from the notebook.
maoxor
force-pushed
the
py2pyi-python-3.14
branch
from
October 29, 2026 16:01
8a9b6ef to
1789913
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Python 3.14 removed the deprecated
ast.Strandast.Ellipsisaliases, andpy2pyistill uses them in_is_empty_classand_body_ellip. As a result,py2pyifails on 3.14 for any module with a function docstring:This checks for
ast.Constantwith astr(or...) value instead. That's exactly what the aliases'isinstancematched on 3.8 to 3.13. The change is in the notebook, andfastcore/py2pyi.pyis regenerated withnbdev-export; only those two lines change. I also removed the cell outputs that contained only theast.Str is deprecated/ast.Ellipsis is deprecatedwarnings, since they no longer happen.Tests: the existing cells in
10_py2pyi.ipynbalready catch this, but only on 3.14, which CI doesn't run (3.10 to 3.13).nbdev-test nbs/10_py2pyi.ipynbon 3.14: fails onmainwithAttributeError: module 'ast' has no attribute 'Ellipsis', and passes with this change. On 3.13 it passes both ways.06_script.ipynb, which mentionspy2pyi, passes on 3.14 too...., int,None, bytes and bool constants, aName, an f-string, a call, and the same parsed from source. They agree on all of them.py2pyion a small module with a docstring-only class, aclass X: ..., a class with a documented method and a@patched method. The.pyifrom this branch on 3.13 and 3.14 is byte-identical tomain's on 3.13.