Skip to content

Astroid 2.12 breaks sphinx autoapi (at least for Airflow) #1708

Closed
@potiuk

Description

@potiuk

Steps to reproduce

  1. Checkout apache airlfow (https://github.com/apache/airflow)
  2. Install airflow with doc extras pip install ".[doc]"
  3. Make sure to use latest astroid version pip install --upgrade astroid (2.12.1 should be installed)
  4. export PYTHONPATH=$(pwd)
  5. ./docs/build_docs.py --package-filter apache-airflow --one-pass-only --docs-only
  6. docs build fails with 111 errors similar to:
------------------------------ Error  95 --------------------
  File "/usr/local/lib/python3.7/site-packages/astroid/nodes/node_ng.py", line 182, in infer
------------------------------ Error  96 --------------------
  File "/usr/local/lib/python3.7/site-packages/astroid/nodes/scoped_nodes/scoped_nodes.py", line 1842, in _is_metaclass
  1. downgrade astroid to 2.11.7: pip install astroid==2.11.7
  2. ./docs/build_docs.py --package-filter apache-airflow --one-pass-only --docs-only
  3. Observe the build succeeds.

NOTE. The above might fail because of libenchant could not be installed (especially on MacOS silicon)
You can reproduce it easily using our CI docker image - with all dependencies needed installed:

  1. docker run -it ghcr.io/apache/airflow/main/ci/python3.7:2af19f16a4d94e749bbf6c7c4704e02aac35fc11
  2. ./docs/build_docs.py --package-filter apache-airflow --one-pass-only --docs-only
  3. docs build fails with 111 errors similar to:
------------------------------ Error  95 --------------------
  File "/usr/local/lib/python3.7/site-packages/astroid/nodes/node_ng.py", line 182, in infer
------------------------------ Error  96 --------------------
  File "/usr/local/lib/python3.7/site-packages/astroid/nodes/scoped_nodes/scoped_nodes.py", line 1842, in _is_metaclass
  1. downgrade astroid to 2.11.7: pip install astroid==2.11.7
  2. ./docs/build_docs.py --package-filter apache-airflow --one-pass-only --docs-only
  3. Observe the build succeeds.

Also downgrading to 2.12.0 leads to failures.
Example failure in CI: https://github.com/apache/airflow/runs/7291353339?check_suite_focus=true#step:9:6115

Current behavior

Version 2.12.* of astroid causes sphinx autoapi to fail
Version 2.11.7 of astroid and before works.

Expected behavior

  • Version 2.12.* of astroid should work with sphinx autoapi
python -c "from astroid import __pkginfo__; print(__pkginfo__.version)"
2.12.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions