-
-
Notifications
You must be signed in to change notification settings - Fork 308
Bump astroid to 3.0.0, update changelog #2303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #2303 +/- ##
=======================================
Coverage 92.85% 92.85%
=======================================
Files 94 94
Lines 11056 11056
=======================================
Hits 10266 10266
Misses 790 790
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
We should consider reverting #1873 as part of this. It was a good idea at the time, but we did a good job with the changelog fragments. I don't know what other content we would put in the upgrade guide. |
Should we move this near the top? |
441ec9b to
b85b5d5
Compare
b85b5d5 to
dfe9e91
Compare
|
Sorry, I had to put the date in. If it's ready today then.. I know the date 😄 |
|
@Pierre-Sassoulas do you want to wait a day or two to give @mbyrnepr2 a chance to look at #2305? |
|
Yeah, let's release a last 2.x maintenance version of astroid. |
Fix a regression in 2.15.7 for ``unsubscriptable-object``. Raise an `InferenceError` when there is a `SyntaxError` due to an invalid `TypeVar` name. This reverts commit 89dfb48. Closes #2305 Closes pylint-dev/pylint#9069 (cherry picked from commit 1f0f2f8) Co-authored-by: Mark Byrne <[email protected]>
jacobtylerwalls
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ready for a rebase
dfe9e91 to
2891daf
Compare
|
This will need a merge commit because I also merged the maintenance branch at the same time (squash or rebase won't do). |
Add support for Python 3.12, including PEP 695 type parameter syntax.
Closes Implement new nodes for PEP 695: Type Parameter Syntax #2201
Remove support for Python 3.7.
Refs Drop support for Python 3.7 #2137
Use the global inference cache when inferring, even without an explicit
InferenceContext. This is a significant performance improvement given howoften methods default to
Nonefor the context argument. (Lintingastroiditself now takes ~5% less time on Python 3.12; other projects requiring more
complex inference calculations will see greater speedups.)
Refs Improving inference caching (unnecessary context clones?) #529
Following a deprecation period starting in astroid 2.7.0, the
astroid.node_classesand
astroid.scoped_nodesmodules have been removed in favor ofastroid.nodes.node_classesand
astroid.nodes.scoped_nodes.Closes Remove deprecated
astroid.node_classesandastroid.scoped_nodes#1072Following a deprecation period starting in astroid 2.12.0, the
astroid.mixinsmodulehas been removed in favor of
astroid.nodes._base_nodes(private).Refs Move
mixins.pytoastroid.nodes._base_nodes#1633Return all existing arguments when calling
Arguments.arguments(). This also meansfind_argnamewill nowuse the whole list of arguments for its search.
Closes
.argumentsproperty ignores keyword-only args, *args, and **kwargs #2213Exclude class attributes from the
__members__container of anEnumclass when they arenodes.AnnAssignnodes with no assigned value.Refs false positive for type-hinted Enum class instance variable pylint#7402
Remove
@cachedand@cachedpropertydecorator (just use@cached_propertyfrom the stdlib).Closes Astroid is leaking memory #1780
Refs Remove cachedproperty decorator #2140
Remove the
inferencemodule. Node inference methods are now in the moduledefining the node, rather than being associated to the node afterward.
Closes Remove monkey-patching of methods onto classes #679
Move
LookupMixIntoastroid.nodes._base_nodesand make it private.Remove the shims for
OperationError,BinaryOperationError, andUnaryOperationErrorin
exceptions. They were moved toutilin astroid 1.5.0.Move
safe_infer()fromhelperstoutil. This avoids some circular imports.Reduce file system access in
ast_from_file().Reduce time to
import astroidby delayingastroid_bootstrapping()untilthe first instantiation of
AstroidBuilder.Closes Make
import astroidfaster (again) #2161Make
igetattr()idempotent. This addresses some reports of varying resultswhen running pylint with
--jobs.Closes Different results with -j4 and -j8 pylint#4356
Refs very long run time and/or stack overflow during inference #7
Fix incorrect cache keys for inference results, thereby correctly inferring types
for calls instantiating types dynamically.
Closes Wrong type inferred - inference type cache is missing context #1828
Closes pylint is confusing ExitStack() and AsyncExitStack() when both are used pylint#7464
Closes False positive
not-a-mappingwithcastandTypeVarpylint#8074Fix interrupted
InferenceContextcall chains, thereby addressing performanceproblems when linting
sqlalchemy.Closes SQLAlchemy 2.0.0 takes forever to lint pylint#8150
nodes.FunctionDefno longer inherits fromnodes.Lambda.This is a breaking change but considered a bug fix as the nodes did not share the same
API and were not interchangeable.
We have tried to minimize the amount of breaking changes caused by this change
but some are unavoidable.
infer_call_resultnow shares the same interface across all implementations. Namely:This is a breaking change for
nodes.FunctionDefwhere previouslycallerhad a default ofNone. PassingNoneagain will not create a behaviour change.The breaking change allows us to better type and re-use the method within
astroid.Improved signature of the
__init__and__postinit__methods of most nodes.This includes making
lineno,col_offset,end_lineno,end_col_offsetandparentrequired arguments for
nodes.NodeNGand its subclasses.For most other nodes, arguments of their
__postinit__methods have been made required to betterrepresent how they would normally be constructed by the standard library
astmodule.The following nodes were changed or updated:
nodes.AnnAssignnodes.Argumentsnodes.Assignnodes.AssignAttrnodes.AssignNamenodes.Attributenodes.AugAssignnodes.Awaitnodes.BaseContainernodes.BinOpnodes.Callnodes.ClassDefnodes.Comparenodes.Comprehensionnodes.Decoratorsnodes.Deletenodes.DelAttrnodes.DelNamenodes.Dictnodes.DictCompnodes.ExceptHandlernodes.Exprnodes.Fornodes.FunctionDefnodes.GeneratorExpnodes.Ifnodes.IfExpnodes.Keywordnodes.Lambdanodes.ListCompnodes.Modulenodes.Namenodes.NodeNGnodes.Raisenodes.Returnnodes.SetCompnodes.Slicenodes.Starredobjects.Super, we also added thecallparameter to its__init__method.nodes.Subscriptnodes.UnaryOpnodes.Whilenodes.YieldThese changes involve breaking changes to their API but should be considered bug fixes. We
now make arguments required when they are instead of always providing defaults.
nodes.If.self.is_orelsehas been removed as it was never set correctly and thereforeprovided a false value.
Remove dependency on
wrapt.Remove dependency on
lazy_object_proxy. This includes the removalof the associated
lazy_import,lazy_descriptorandproxy_aliasutility functions.CallSite._unpack_argsandCallSite._unpack_keywordsnow usesafe_infer()forbetter inference and fewer false positives.
Closes False positive
no-value-for-parameterdue to inference edge case pylint#8544Add
attr.Factoryto the recognized class attributes for classes decorated withattrs.Closes attrs: wrong type inferred from Factory attribute (using auto_attribs) pylint#4341
infer_property()now observes the same property-specific workaround asinfer_functiondef.Refs Audit the correctness of adding parent.name to child's locals in
ClassDef.__init__()andFunctionDef.__init__()#1490Remove unused and / or deprecated constants:
astroid.bases.BOOL_SPECIAL_METHODastroid.bases.BUILTINSastroid.const.BUILTINSastroid.const.PY38_PLUSastroid.const.Loadastroid.const.Storeastroid.const.DelRefs Remove unused constants #2141
frame()raisesParentMissingErrorandstatement()raisesStatementMissingformissing parents regardless of the value of the
futureargument (which gave this behavioralready).
The
futureargument to each method is deprecated and will be removed in astroid 4.0.Refs Add typing to
NodeNG.statement#1217Remove deprecated
Ellipsis,ExtSlice,Indexnodes.Refs Remove deprecated nodes #2152
Remove deprecated
is_sys_guardandis_typing_guardmethods.Refs Remove deprecated
is_sys_guard+is_typing_guard#2153Remove deprecated
docattribute forModule,ClassDef, andFunctionDef.Use the
doc_nodeattribute instead.Refs Remove deprecated
docattribute #2154Add new
nodes.Tryto better match Python AST. Replaces theTryExceptand
TryFinallynodes which have been removed.Publicize
NodeNG.repr_name()to facilitate finding a node's nice name.Refs Crash: AttributeError: 'Call' object has no attribute 'name' pylint#8598
Fix false positives for
no-memberandinvalid-namewhen using the_name_,_value_and_ignore_sunders in Enums.Closes Pylint complains about _ignore_ in enum classes pylint#9015