pylint-dev / pylint-dev/astroid

Circular dependencies between ``astroid.nodes`` and ``astroid.bases``

Open
#2,155 0 comments 0 reactions 0 assignees View on GitHub
High effort 🏋
Dominant language
Python
Stars
582
Forks
357
Avg merge
1d 1h
Merged PRs (30d)
23

Description

In order to remove the deprecated ``astroid.nodes_classes`` and ``astroid.scoped_nodes`` we're going to have to resolve this circular dependencies.

``bases.py``:
```python
from astroid.nodes.node_classes import Name, Const, NodeNG, Call, Attribute, EmptyNode, const_factory
from astroid.nodes.scoped_nodes import ClassDef, FunctionDef
```
``astroid.nodes.nodes_classes.py``:
```python
from astroid.bases import Instance, _infer_stmts
```

``astroid.nodes.scoped_nodes .py``:
```python
from astroid.bases import BoundMethod, _infer_stmts, Instance
```

To be totally honest I'm under the impression that the import by full namespace (``from astroid import bases``) permitted to hide the circular dependencies under the lazy import rug for a long time, and the current situation is a mess that I despair of being able to fix.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading astroid/bases.py, astroid/nodes/node_classes.py, and astroid/nodes/scoped_nodes.py, tracing the imports shown in the issue. Map the dependency cycle and determine how the deprecated astroid.nodes_classes and astroid.scoped_nodes modules can be removed; done means those dependencies are resolved without the circular imports.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers, devtools
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.