Skip to content

Conversation

@cdce8p
Copy link
Member

@cdce8p cdce8p commented Sep 29, 2025

Description

Followup to #2833

Deprecate the import of node classes from toplevel astroid.
Import them from astroid.nodes instead.

@cdce8p cdce8p added this to the 4.0.0 milestone Sep 29, 2025

from astroid.util import Uninferable

__all__ = [
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added __all__ to not expose the _DEPRECATED_* classes here.

@cdce8p cdce8p force-pushed the deprecate-nodes-import branch from df34d94 to 921e924 Compare September 29, 2025 10:42
@codecov
Copy link

codecov bot commented Sep 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.37%. Comparing base (166f444) to head (b1e551e).
⚠️ Report is 76 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2837   +/-   ##
=======================================
  Coverage   93.36%   93.37%           
=======================================
  Files          92       92           
  Lines       11139    11148    +9     
=======================================
+ Hits        10400    10409    +9     
  Misses        739      739           
Flag Coverage Δ
linux 93.23% <100.00%> (+<0.01%) ⬆️
pypy 93.37% <100.00%> (+<0.01%) ⬆️
windows 93.35% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
astroid/__init__.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good, clever trick.

@cdce8p cdce8p merged commit 61aa567 into pylint-dev:main Sep 29, 2025
19 checks passed
@cdce8p cdce8p deleted the deprecate-nodes-import branch September 29, 2025 11:46
luketainton pushed a commit to luketainton/repos_webexmemebot that referenced this pull request Jan 5, 2026
This PR contains the following updates:

| Package | Change | Age | Confidence |
|---|---|---|---|
| [astroid](https://github.com/pylint-dev/astroid) | `<=3.3.11` -> `<=4.0.0` | [![age](https://developer.mend.io/api/mc/badges/age/pypi/astroid/4.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/astroid/3.3.11/4.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>pylint-dev/astroid (astroid)</summary>

### [`v4.0.0`](https://github.com/pylint-dev/astroid/blob/HEAD/ChangeLog#Whats-New-in-astroid-400)

[Compare Source](pylint-dev/astroid@v3.3.11...v4.0.0)

\============================
Release date: 2025-10-05

- Support constraints from ternary expressions in inference.

  Closes [pylint-dev/pylint#9729](pylint-dev/pylint#9729)

- Handle deprecated `bool(NotImplemented)` cast in const nodes.

- Add support for boolean truthiness constraints (`x`, `not x`) in inference.

  Closes [pylint-dev/pylint#9515](pylint-dev/pylint#9515)

- Fix false positive `invalid-name` on `attrs` classes with `ClassVar` annotated variables.

  Closes [pylint-dev/pylint#10525](pylint-dev/pylint#10525)

- Prevent crash when parsing deeply nested parentheses causing MemoryError in python's built-in ast.

  Closes [#&#8203;2643](pylint-dev/astroid#2643)

- Fix crash when inferring namedtuple with invalid field name looking like f-string formatting.

  Closes [#&#8203;2519](pylint-dev/astroid#2519)

- Fix false positive no-member in except \* handler.

  Closes [pylint-dev/pylint#9056](pylint-dev/pylint#9056)

- Fix crash when comparing invalid dict literal

  Closes [#&#8203;2522](pylint-dev/astroid#2522)

- Removed internal functions `infer_numpy_member`, `name_looks_like_numpy_member`, and
  `attribute_looks_like_numpy_member` from `astroid.brain.brain_numpy_utils`.

- To alleviate circular imports, the `manager` argument to `AstroidBuilder()` is now required.

- Constants now have a parent of `nodes.SYNTHETIC_ROOT`.

- Fix crashes with large positive and negative list multipliers.

  Closes [#&#8203;2521](pylint-dev/astroid#2521)
  Closes [#&#8203;2523](pylint-dev/astroid#2523)

- Fix precedence of `path` arg in `modpath_from_file_with_callback` to be higher than `sys.path`

- Following a deprecation period, the `future` argument was removed from `statement()` and `frame()`.

- Improve consistency of `JoinedStr` inference by not raising `InferenceError` and
  returning either `Uninferable` or a fully resolved `Const`.

  Closes [#&#8203;2621](pylint-dev/astroid#2621)

- Fix crash when typing.\_alias() call is missing arguments.

  Closes [#&#8203;2513](pylint-dev/astroid#2513)

- Remove support for Python 3.9 (and constant `PY310_PLUS`).

- Include subclasses of standard property classes as `property` decorators

  Closes [#&#8203;10377](https://github.com/pylint-dev/astroid/issues/10377)

- Modify `astroid.bases` and `tests.test_nodes` to reflect that `enum.property` was added in Python 3.11, not 3.10

- Fix incorrect result in `_get_relative_base_path` when the target directory name starts with the base path

  Closes [#&#8203;2608](pylint-dev/astroid#2608)

- The brain for nose was dropped. nose has been deprecated for 10 years and the brain required some maintenance.

  Refs [#&#8203;2765](pylint-dev/astroid#2765)

- Fix a crash when the root of a node is not a module but is unknown.

  Closes [#&#8203;2672](pylint-dev/astroid#2672)

- Add basic support for `ast.TemplateStr` and `ast.Interpolation`added in Python 3.14.

  Refs [#&#8203;2789](pylint-dev/astroid#2789)

- Add support for type parameter defaults added in Python 3.13.

- Improve `as_string()` representation for `TypeVar`, `ParamSpec` and `TypeVarTuple` nodes, as well as
  type parameter in `ClassDef`, `FuncDef` and `TypeAlias` nodes (PEP 695).

- Astroid now correctly supports the `exceptions` attribute of `ExceptionGroup`.

  Closes [pylint-dev/pylint#8985](pylint-dev/pylint#8985)
  Closes [pylint-dev/pylint#10558](pylint-dev/pylint#10558)

- Deprecate importing node classes from `astroid` directly. This will be removed in v5.
  It's recommended to import them from `astroid.nodes` instead.

  Refs [#&#8203;2837](pylint-dev/astroid#2837)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xMzUuNCIsInVwZGF0ZWRJblZlciI6IjQxLjEzNS40IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJ0eXBlL2RlcGVuZGVuY2llcyJdfQ==-->

Reviewed-on: https://git.tainton.uk/repos/webexmemebot/pulls/511
Co-authored-by: renovate[bot] <renovate-bot@git.tainton.uk>
Co-committed-by: renovate[bot] <renovate-bot@git.tainton.uk>
luketainton pushed a commit to luketainton/repos_webexmemebot that referenced this pull request Jan 5, 2026
This PR contains the following updates:

| Package | Change | Age | Confidence |
|---|---|---|---|
| [astroid](https://github.com/pylint-dev/astroid) | `<=4.0.0` -> `<=4.0.1` | [![age](https://developer.mend.io/api/mc/badges/age/pypi/astroid/4.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/astroid/3.3.11/4.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>pylint-dev/astroid (astroid)</summary>

### [`v4.0.1`](https://github.com/pylint-dev/astroid/blob/HEAD/ChangeLog#Whats-New-in-astroid-401)

[Compare Source](pylint-dev/astroid@v4.0.0...v4.0.1)

\============================
Release date: 2025-10-11

- Suppress `SyntaxWarning` for invalid escape sequences and return in finally on
  Python 3.14 when parsing modules.

- Assign `Import` and `ImportFrom` nodes to module locals if used with `global`.

  Closes [pylint-dev/pylint#10632](pylint-dev/pylint#10632)

### [`v4.0.0`](https://github.com/pylint-dev/astroid/blob/HEAD/ChangeLog#Whats-New-in-astroid-400)

[Compare Source](pylint-dev/astroid@v3.3.11...v4.0.0)

\============================
Release date: 2025-10-05

- Support constraints from ternary expressions in inference.

  Closes [pylint-dev/pylint#9729](pylint-dev/pylint#9729)

- Handle deprecated `bool(NotImplemented)` cast in const nodes.

- Add support for boolean truthiness constraints (`x`, `not x`) in inference.

  Closes [pylint-dev/pylint#9515](pylint-dev/pylint#9515)

- Fix false positive `invalid-name` on `attrs` classes with `ClassVar` annotated variables.

  Closes [pylint-dev/pylint#10525](pylint-dev/pylint#10525)

- Prevent crash when parsing deeply nested parentheses causing MemoryError in python's built-in ast.

  Closes [#&#8203;2643](pylint-dev/astroid#2643)

- Fix crash when inferring namedtuple with invalid field name looking like f-string formatting.

  Closes [#&#8203;2519](pylint-dev/astroid#2519)

- Fix false positive no-member in except \* handler.

  Closes [pylint-dev/pylint#9056](pylint-dev/pylint#9056)

- Fix crash when comparing invalid dict literal

  Closes [#&#8203;2522](pylint-dev/astroid#2522)

- Removed internal functions `infer_numpy_member`, `name_looks_like_numpy_member`, and
  `attribute_looks_like_numpy_member` from `astroid.brain.brain_numpy_utils`.

- To alleviate circular imports, the `manager` argument to `AstroidBuilder()` is now required.

- Constants now have a parent of `nodes.SYNTHETIC_ROOT`.

- Fix crashes with large positive and negative list multipliers.

  Closes [#&#8203;2521](pylint-dev/astroid#2521)
  Closes [#&#8203;2523](pylint-dev/astroid#2523)

- Fix precedence of `path` arg in `modpath_from_file_with_callback` to be higher than `sys.path`

- Following a deprecation period, the `future` argument was removed from `statement()` and `frame()`.

- Improve consistency of `JoinedStr` inference by not raising `InferenceError` and
  returning either `Uninferable` or a fully resolved `Const`.

  Closes [#&#8203;2621](pylint-dev/astroid#2621)

- Fix crash when typing.\_alias() call is missing arguments.

  Closes [#&#8203;2513](pylint-dev/astroid#2513)

- Remove support for Python 3.9 (and constant `PY310_PLUS`).

- Include subclasses of standard property classes as `property` decorators

  Closes [#&#8203;10377](https://github.com/pylint-dev/astroid/issues/10377)

- Modify `astroid.bases` and `tests.test_nodes` to reflect that `enum.property` was added in Python 3.11, not 3.10

- Fix incorrect result in `_get_relative_base_path` when the target directory name starts with the base path

  Closes [#&#8203;2608](pylint-dev/astroid#2608)

- The brain for nose was dropped. nose has been deprecated for 10 years and the brain required some maintenance.

  Refs [#&#8203;2765](pylint-dev/astroid#2765)

- Fix a crash when the root of a node is not a module but is unknown.

  Closes [#&#8203;2672](pylint-dev/astroid#2672)

- Add basic support for `ast.TemplateStr` and `ast.Interpolation`added in Python 3.14.

  Refs [#&#8203;2789](pylint-dev/astroid#2789)

- Add support for type parameter defaults added in Python 3.13.

- Improve `as_string()` representation for `TypeVar`, `ParamSpec` and `TypeVarTuple` nodes, as well as
  type parameter in `ClassDef`, `FuncDef` and `TypeAlias` nodes (PEP 695).

- Astroid now correctly supports the `exceptions` attribute of `ExceptionGroup`.

  Closes [pylint-dev/pylint#8985](pylint-dev/pylint#8985)
  Closes [pylint-dev/pylint#10558](pylint-dev/pylint#10558)

- Deprecate importing node classes from `astroid` directly. This will be removed in v5.
  It's recommended to import them from `astroid.nodes` instead.

  Refs [#&#8203;2837](pylint-dev/astroid#2837)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xNDYuMCIsInVwZGF0ZWRJblZlciI6IjQxLjE0Ni4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJ0eXBlL2RlcGVuZGVuY2llcyJdfQ==-->

Reviewed-on: https://git.tainton.uk/repos/webexmemebot/pulls/515
Co-authored-by: renovate[bot] <renovate-bot@git.tainton.uk>
Co-committed-by: renovate[bot] <renovate-bot@git.tainton.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants