Skip to content

Commit

Permalink
DOC/MNT: make clear that depr plot API is incompatible with 2025 (#696)
Browse files Browse the repository at this point in the history
  • Loading branch information
theOehrly authored Mar 1, 2025
1 parent 744269e commit bc3f9e9
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 14 deletions.
24 changes: 17 additions & 7 deletions fastf1/plotting/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@
def __getattr__(name):
if name in ('COMPOUND_COLORS', 'DRIVER_TRANSLATE', 'DRIVER_COLORS',
'TEAM_COLORS', 'TEAM_TRANSLATE', 'COLOR_PALETTE'):
warnings.warn(f"{name} is deprecated and will be removed in a future "
f"version.", FutureWarning)
warnings.warn(f"INCOMPATIBLE with 2025 season! {name} is deprecated "
f"and will be removed in a future version.",
FutureWarning)

return globals()[f"_DEPR_{name}"]

Expand Down Expand Up @@ -111,8 +112,9 @@ def __getattr__(name):
Mapping of driver names to driver colors (hex color codes).
.. warning::
This dictionary will no longer be updated to include new drivers. Use
the new API instead.
This dictionary is incompatible with the 2025 season. Use the new API
instead.
.. deprecated:: 3.4.0
The ``DRIVER_COLORS`` dictionary is deprecated and will ber removed in a
Expand All @@ -127,8 +129,8 @@ def __getattr__(name):
Mapping of driver names to theirs respective abbreviations.
.. warning::
This dictionary will no longer be updated to include new drivers. Use
the new API instead.
This dictionary is incompatible with the 2025 season. Use the new API
instead.
.. deprecated:: 3.4.0
Expand All @@ -140,7 +142,11 @@ def __getattr__(name):
TEAM_COLORS: dict[str, str]
"""
Mapping of team names to team colors (hex color codes).
(current season only)
(2024 season only)
.. warning::
This dictionary is incompatible with the 2025 season. Use the new API
instead.
.. deprecated:: 3.4.0
The ``TEAM_COLORS`` dictionary is deprecated and will be removed in a
Expand All @@ -152,6 +158,10 @@ def __getattr__(name):
"""
Mapping of team names to theirs respective abbreviations.
.. warning::
This dictionary is incompatible with the 2025 season. Use the new API
instead.
.. deprecated:: 3.4.0
The ``TEAM_TRANSLATE`` dictionary is deprecated and will be removed in a
future version. Use :func:`~fastf1.plotting.get_team_name` instead.
Expand Down
20 changes: 13 additions & 7 deletions fastf1/plotting/_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ def driver_color(identifier: str) -> str:
"""
Get a driver's color from a driver name or abbreviation.
.. warning::
This function is incompatible with the 2025 season.
.. deprecated:: 3.4.0
This function is deprecated and will be removed in a future version.
Use :func:`~fastf1.plotting.get_driver_color` instead.
Expand Down Expand Up @@ -148,9 +151,9 @@ def driver_color(identifier: str) -> str:
Returns:
str: hex color code
"""
warnings.warn("The function `driver_color` is deprecated and will be "
"removed in a future version. Use "
"`fastf1.plotting.get_driver_color` instead.",
warnings.warn("INCOMPATIBLE with 2025 season! The function `driver_color` "
"is deprecated and will be removed in a future version. "
"Use `fastf1.plotting.get_driver_color` instead.",
FutureWarning)

if identifier.upper() in LEGACY_DRIVER_TRANSLATE:
Expand Down Expand Up @@ -201,6 +204,10 @@ def team_color(identifier: str) -> str:
"""
Get a team's color from a team name or abbreviation.
.. warning::
This function is incompatible with the 2025 season.
.. deprecated:: 3.4.0
This function is deprecated and will be removed in a future version.
Use :func:`~fastf1.plotting.get_team_color` instead.
Expand Down Expand Up @@ -239,10 +246,9 @@ def team_color(identifier: str) -> str:
Returns:
str: hex color code
"""
warnings.warn("The function `team_color` is deprecated and will be "
"removed in a future version. Use "
"`fastf1.plotting.get_team_color` instead.",
FutureWarning)
warnings.warn("INCOMPATIBLE with 2025 season!The function `team_color` "
"is deprecated and will be removed in a future version. Use "
"`fastf1.plotting.get_team_color` instead.", FutureWarning)

if identifier.upper() in LEGACY_TEAM_TRANSLATE:
# try short team abbreviations first
Expand Down

0 comments on commit bc3f9e9

Please sign in to comment.