From e0ddea8c67d0004337bbd9c5240459cd52a6ebd9 Mon Sep 17 00:00:00 2001 From: bn-andrew Date: Mon, 6 Oct 2025 10:17:41 +1100 Subject: [PATCH 1/5] 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 --- autoapi/_parser.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/autoapi/_parser.py b/autoapi/_parser.py index 0460e92f..8ba5300c 100644 --- a/autoapi/_parser.py +++ b/autoapi/_parser.py @@ -3,6 +3,7 @@ import astroid import astroid.builder +import astroid.manager 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 = astroid.builder.AstroidBuilder(manager.AstroidManager()).file_build(file_path, module_name) return self.parse(node) def parse_file(self, file_path): From a7c1dbf4ed4e41b9fdfeb80e52220cc3195a234f Mon Sep 17 00:00:00 2001 From: bn-andrew Date: Mon, 6 Oct 2025 10:23:04 +1100 Subject: [PATCH 2/5] Update requirements Make sure we can't grab incompatible versions of astroid --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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", From 0240cbd15703ec7f8a1c57a13588edd2d87af3dc Mon Sep 17 00:00:00 2001 From: bn-andrew Date: Mon, 6 Oct 2025 10:24:58 +1100 Subject: [PATCH 3/5] Fix imports --- autoapi/_parser.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/autoapi/_parser.py b/autoapi/_parser.py index 8ba5300c..903bf73c 100644 --- a/autoapi/_parser.py +++ b/autoapi/_parser.py @@ -2,8 +2,8 @@ import os import astroid -import astroid.builder -import astroid.manager +from astroid.builder import AstroidBuilder +from astroid.manager import AstroidBuilder import sphinx.util.docstrings from . import _astroid_utils @@ -38,7 +38,7 @@ def _parse_file(self, file_path, condition): module_parts.appendleft(module_part) module_name = ".".join(module_parts) - node = astroid.builder.AstroidBuilder(manager.AstroidManager()).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): From 251d9792db8d18881ff6b9ca22ba45e026c6223e Mon Sep 17 00:00:00 2001 From: bn-andrew Date: Mon, 6 Oct 2025 10:27:10 +1100 Subject: [PATCH 4/5] Actually fix the import --- autoapi/_parser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoapi/_parser.py b/autoapi/_parser.py index 903bf73c..be79f3e4 100644 --- a/autoapi/_parser.py +++ b/autoapi/_parser.py @@ -3,7 +3,7 @@ import astroid from astroid.builder import AstroidBuilder -from astroid.manager import AstroidBuilder +from astroid.manager import AstroidManager import sphinx.util.docstrings from . import _astroid_utils From 9125470022f6856454e2032434eeafe24d9da91f Mon Sep 17 00:00:00 2001 From: Andrew Saunder Date: Mon, 6 Oct 2025 11:23:55 +1100 Subject: [PATCH 5/5] Release notes --- docs/changes/536.bugfix.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 docs/changes/536.bugfix.rst 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