libtcod / python-tcod

A high-performance Python port of libtcod. Includes the libtcodpy module for backwards compatibility with older projects.
BSD 2-Clause "Simplified" License
404 stars 37 forks source link

TCOD throws a deprecation warning #117

Closed djhenderson closed 2 years ago

djhenderson commented 2 years ago

The following statement

    with tcod.context.new_terminal(
        columns=screen_width,
        rows=screen_height,
        tileset=tileset,
        title="Yet Another Roguelike Tutorial",
        vsync=True,
    ) as context:

Raises these warning in DEV mode

> py main.py
.\main.py:21: PendingDeprecationWarning: Call tcod.context.new with columns and rows as keyword parameters.
  with tcod.context.new_terminal(

> py -Werror main.py
Traceback (most recent call last):
  File ".\main.py", line 50, in <module>
    main()
  File ".\main.py", line 21, in main
    with tcod.context.new_terminal(
  File "C:\Users\USER\AppData\Local\Programs\Python\Python310\lib\site-packages\tcod\_internal.py", line 28, in wrapper
    warnings.warn(message, category, stacklevel=stacklevel + 2)
PendingDeprecationWarning: Call tcod.context.new with columns and rows as keyword parameters.

running on

> ver
Microsoft Windows [Version 10.0.19043.1706]

> py -V
Python 3.10.4

with these env variables

> set py
PYTHONDEVMODE=1
PYTHONUTF8=1
PYTHONWARNDEFAULTENCODING=1
HexDecimal commented 2 years ago

Thanks for a thorough report.

Unless the python-tcod docs are using tcod.context.new_terminal in a code example then this is intended. That function and tcod.context_new_window were replaced by tcod.context.new which the warning text currently suggests to do.

The deprecation isn't critical enough for me to use DeperationWarning or FutureWarning. Plus it's hard to deprecate things used in the latest tutorials or else the warnings confuse new developers.

For now there isn't much to be done, but feel free to ask any other questions.