Skip to content

Commit

Permalink
Deprecate fontsizes.beamer_moml in favour of fontsizes.beamer (#154)
Browse files Browse the repository at this point in the history
* Deprecate fontsizes.beamer_moml in favour of fontsizes.beamer

* Mention the deprecation in the docstring
  • Loading branch information
pnkraemer authored Sep 24, 2024
1 parent 2ca9ced commit a1e854c
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 6 deletions.
10 changes: 10 additions & 0 deletions tests/test_deprecations.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"""Test that deprecations are announced appropriately."""

import pytest

from tueplots import fontsizes


def test_fontsize_beamer_function_renamed():
with pytest.deprecated_call(match="renamed"):
_ = fontsizes.beamer_moml()
4 changes: 2 additions & 2 deletions tests/test_rc_params_cases/case_fontsizes.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,5 @@ def case_fontsizes_jmlr2001():
return fontsizes.jmlr2001()


def case_fontsizes_beamer_moml():
return fontsizes.beamer_moml()
def case_fontsizes_beamer():
return fontsizes.beamer()
4 changes: 2 additions & 2 deletions tueplots/bundles.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def beamer_moml(
axes_config_grid = axes.grid()
axes_config_color = axes.color(base=rgb.tue_dark)
cycler_config = cycler.cycler(color=palettes.tue_plot)
fontsize_config = fontsizes.beamer_moml()
fontsize_config = fontsizes.beamer()
return {
**size,
**font_config,
Expand All @@ -280,7 +280,7 @@ def beamer_moml_dark_bg(*, rel_width=1.0, rel_height=0.8):
axes_config_grid = axes.grid()
axes_config_color = axes.color(face=rgb.tue_dark, base="w")
cycler_config = cycler.cycler(color=palettes.tue_plot_dark_bg)
fontsize_config = fontsizes.beamer_moml()
fontsize_config = fontsizes.beamer()
return {
**size,
**font_config,
Expand Down
17 changes: 15 additions & 2 deletions tueplots/fontsizes.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Fontsize settings."""

import warnings


def icml2022(*, default_smaller=1):
r"""Font size for ICML 2022.
Expand Down Expand Up @@ -100,8 +102,19 @@ def tmlr2023(*, default_smaller=1):
return _from_base(base=10 - default_smaller)


def beamer_moml(*, default_smaller=1):
"""Font size for a beamer slide in aspectratio 16:9 with 10pt font."""
def beamer_moml(**kwargs):
"""Font size for a beamer slide in aspectratio 16:9 with 10pt font.
Deprecated in v0.0.16. Use 'fontsizes.beamer' instead.
"""
msg = "'fontsizes.beamer_moml' has been renamed to 'fontsizes.beamer' in v0.0.16."
msg += " The old API will be removed any time after January 1st, 2025."
warnings.warn(msg, DeprecationWarning)
return beamer(**kwargs)


def beamer(*, default_smaller=1):
"""Font size for a beamer slide (in aspectratio 16:9 with 10pt font)."""
return _from_base(base=10 - default_smaller)


Expand Down

0 comments on commit a1e854c

Please sign in to comment.