diff --git a/autoapi/_parser.py b/autoapi/_parser.py index 0460e92f..be79f3e4 100644 --- a/autoapi/_parser.py +++ b/autoapi/_parser.py @@ -2,7 +2,8 @@ import os import astroid -import astroid.builder +from astroid.builder import AstroidBuilder +from astroid.manager import AstroidManager import sphinx.util.docstrings from . import _astroid_utils @@ -37,7 +38,7 @@ def _parse_file(self, file_path, condition): module_parts.appendleft(module_part) module_name = ".".join(module_parts) - node = astroid.builder.AstroidBuilder().file_build(file_path, module_name) + node = AstroidBuilder(AstroidManager()).file_build(file_path, module_name) return self.parse(node) def parse_file(self, file_path): diff --git a/docs/changes/536.bugfix.rst b/docs/changes/536.bugfix.rst new file mode 100644 index 00000000..c362ef69 --- /dev/null +++ b/docs/changes/536.bugfix.rst @@ -0,0 +1,2 @@ +Update the supported versions of astroid. +Fix the breaking change to Import and pass in the AstroidManager to the AstroidBuilder \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index b05576e4..0585658d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,8 +25,8 @@ classifiers = [ ] requires-python = ">=3.9" dependencies = [ - 'astroid>=2.7;python_version<"3.12"', - 'astroid>=3;python_version>="3.12"', + 'astroid~=3.0;python_version<"3.12"', + 'astroid~=4.0;python_version>="3.12"', "Jinja2", "PyYAML", "sphinx>=7.4.0",