Skip to content

Stop using @abstractproperty which is deprecated. #2004

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/prompt_toolkit/input/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from __future__ import annotations

from abc import ABCMeta, abstractmethod, abstractproperty
from abc import ABCMeta, abstractmethod
from contextlib import contextmanager
from typing import Callable, ContextManager, Generator

Expand Down Expand Up @@ -55,7 +55,8 @@ def flush(self) -> None:
"The event loop can call this when the input has to be flushed."
pass

@abstractproperty
@property
@abstractmethod
def closed(self) -> bool:
"Should be true when the input stream is closed."
return False
Expand Down
8 changes: 5 additions & 3 deletions src/prompt_toolkit/key_binding/key_bindings.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def my_key_binding(event):

from __future__ import annotations

from abc import ABCMeta, abstractmethod, abstractproperty
from abc import ABCMeta, abstractmethod
from inspect import isawaitable
from typing import (
TYPE_CHECKING,
Expand Down Expand Up @@ -155,7 +155,8 @@ class KeyBindingsBase(metaclass=ABCMeta):
Interface for a KeyBindings.
"""

@abstractproperty
@property
@abstractmethod
def _version(self) -> Hashable:
"""
For cache invalidation. - This should increase every time that
Expand Down Expand Up @@ -186,7 +187,8 @@ def get_bindings_starting_with_keys(self, keys: KeysTuple) -> list[Binding]:
"""
return []

@abstractproperty
@property
@abstractmethod
def bindings(self) -> list[Binding]:
"""
List of `Binding` objects.
Expand Down
5 changes: 3 additions & 2 deletions src/prompt_toolkit/styles/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from __future__ import annotations

from abc import ABCMeta, abstractmethod, abstractproperty
from abc import ABCMeta, abstractmethod
from typing import Callable, Hashable, NamedTuple

__all__ = [
Expand Down Expand Up @@ -126,7 +126,8 @@ def get_attrs_for_style_str(
:param default: `Attrs` to be used if no styling was defined.
"""

@abstractproperty
@property
@abstractmethod
def style_rules(self) -> list[tuple[str, str]]:
"""
The list of style rules, used to create this style.
Expand Down