Skip to content

Commit 21a53c7

Browse files
authored
Fix change in astroid api (#538)
* Update AstroidBuilder setup AstroidManager now needs to be directly imported in version 4.0.0 Unsure if there are any other breaking changes in 4.0.0 * Update requirements Make sure we can't grab incompatible versions of astroid * Fix imports * Actually fix the import * Release notes
1 parent 4433b17 commit 21a53c7

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

autoapi/_parser.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
import os
33

44
import astroid
5-
import astroid.builder
5+
from astroid.builder import AstroidBuilder
6+
from astroid.manager import AstroidManager
67
import sphinx.util.docstrings
78

89
from . import _astroid_utils
@@ -37,7 +38,7 @@ def _parse_file(self, file_path, condition):
3738
module_parts.appendleft(module_part)
3839

3940
module_name = ".".join(module_parts)
40-
node = astroid.builder.AstroidBuilder().file_build(file_path, module_name)
41+
node = AstroidBuilder(AstroidManager()).file_build(file_path, module_name)
4142
return self.parse(node)
4243

4344
def parse_file(self, file_path):

docs/changes/536.bugfix.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Update the supported versions of astroid.
2+
Fix the breaking change to Import and pass in the AstroidManager to the AstroidBuilder

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ classifiers = [
2525
]
2626
requires-python = ">=3.9"
2727
dependencies = [
28-
'astroid>=2.7;python_version<"3.12"',
29-
'astroid>=3;python_version>="3.12"',
28+
'astroid~=3.0;python_version<"3.12"',
29+
'astroid~=4.0;python_version>="3.12"',
3030
"Jinja2",
3131
"PyYAML",
3232
"sphinx>=7.4.0",

0 commit comments

Comments
 (0)