autobahn-python icon indicating copy to clipboard operation
autobahn-python copied to clipboard

Switch to log.warning instead of log.warn

Open Jenselme opened this issue 1 year ago • 4 comments

log.warn is removed in Python 3.13

Close #1098

Jenselme avatar Aug 22 '24 07:08 Jenselme

From what I understand of the error, I may be completely wrong on how to solve this: I seem to have modified calls to twited Logger class which does use warn. So the issue about warn being deprecated may come from a dependency and not this packages directly (nor txaio).

Testing this properly is made harder by the fact that pyunormalize cannot be installed on Python 3.13 yet

Any insights no this?

Jenselme avatar Aug 22 '24 20:08 Jenselme

thanks for taking care of such things .. pls lemme comment ..

log.warn is removed in Python 3.13

if so, then

  • the CI in Autobahn should first be upgraded to 3.13 in an independent PR
  • this should then run red (fail), because the function is removed

once that is done, this PR can continue ..


right now, 3.13 is not yet released

grafik


currently, the CI uses CPython 3.11 and PyPy 3.9

https://github.com/crossbario/autobahn-python/blob/7bc85b34e200640ab98a41cfddb38267f39bc92e/.github/workflows/main.yml#L60

and PyPy is now at 3.10

https://pypy.org/download.html

for the CI upgrade PR, we should first define the exact version goals for CPython and for PyPy ..

oberstet avatar Aug 23 '24 06:08 oberstet

Sounds good to me. I started looking into it because fedora is starting to switch to 3.13 in its dev version and it seemed easy to do (sadly I was proven wrong).

But, yes, we can wait for Python 3.13 to be officially release and migrate the CI first.

Jenselme avatar Aug 23 '24 08:08 Jenselme

But, yes, we can wait for Python 3.13 to be officially release and migrate the CI first.

I'm confident this ordering will support Autobahn's goal of improving robustness & production stability.

if there is an issue in Autobahn triggered by a dependency upgrade, the issue should first be proven to actually exist and be valid

this requires the CI to first not touch any code, but only upgrade the dependency, and then demoonstrate at least one failing test (which previously worked).

if no such test currently exists which can demonstrate the issue, a new test case should be added

once the issue is confirmed (by a test that transitioned from GREEN to RED), the issue can be fixed in another PR

this allows to exactly follow the sequence of events with proof at each step, and the option for relatively easy rollback should something go wrong. as there will more often than not in reality;)

like ripples in a subsequent, dependent project like Crossbar.io (which obviously uses Autobahn a lot) ..

oberstet avatar Aug 23 '24 09:08 oberstet

Python 3.13 is out. Time to move on?

yan12125 avatar Nov 03 '24 09:11 yan12125

@yan12125 wau. you are quick;) I also saw that flying by. so yes: +1!

maybe worth: I think it would be good to first (and only that) switch from 3.11 to 3.13 everywhere in CI etc, e.g.

https://github.com/crossbario/autobahn-python/blob/7bc85b34e200640ab98a41cfddb38267f39bc92e/.github/workflows/main.yml#L28

and once that runs, only then move on to the log issue (the original itch of this issue), and this PR

in other words, what I am saying is: it might be worth doing the 3.11 to 3.13 switch (and only that) in a (new) separate PR

this latter (new) PR should be all green immediately. in theory. I don't believe it. sadly.

then this PR can simply catch up with / merge main to have 3.13

it will then run as is right away, and we'll see what is yet missing then ...

sounds like a good / workable plan?

oberstet avatar Nov 03 '24 11:11 oberstet

Sounds good. I can work on 3.11 -> 3.13 switch if you wish.

yan12125 avatar Nov 03 '24 11:11 yan12125

Sounds good. I can work on 3.11 -> 3.13 switch if you wish.

I started a work-in-progress: https://github.com/yan12125/autobahn-python/commits/python-3.13/

yan12125 avatar Nov 04 '24 14:11 yan12125

The linked issue https://github.com/crossbario/autobahn-python/issues/1098 mentions:

FYI, logger.warn is removed in Python 3.13: https://docs.python.org/3.13/whatsnew/3.13.html#logging

That page on Python official website actually places logging.warn in the section "Pending Removal in Future Versions", so that function is still in Python 3.13. Also, Python 3.13 unit tests passed without changes in this pull request: https://github.com/yan12125/autobahn-python/actions/runs/11666669688.

@Jenselme could you check how to make deprecation warnings visible in unit tests?

yan12125 avatar Nov 05 '24 14:11 yan12125

@yan12125 I’m already seeing the warnings:

.tox/py3.11-asyncio/lib64/python3.11/site-packages/websockets/legacy/__init__.py:6
  /home/jenselme/Projects/_Clones/autobahn-python/.tox/py3.11-asyncio/lib64/python3.11/site-packages/websockets/legacy/__init__.py:6: DeprecationWarning: websockets.legacy is deprecated; see https://websockets.readthedocs.io/en/stable/howto/upgrade.html for upgrade instructions
    warnings.warn(  # deprecated in 14.0

It’s still not easy to spot where the issue comes from though.

Jenselme avatar Nov 11 '24 13:11 Jenselme

@yan12125 I’m already seeing the warnings:

.tox/py3.11-asyncio/lib64/python3.11/site-packages/websockets/legacy/__init__.py:6
  /home/jenselme/Projects/_Clones/autobahn-python/.tox/py3.11-asyncio/lib64/python3.11/site-packages/websockets/legacy/__init__.py:6: DeprecationWarning: websockets.legacy is deprecated; see https://websockets.readthedocs.io/en/stable/howto/upgrade.html for upgrade instructions
    warnings.warn(  # deprecated in 14.0

Thanks, but the warning is about warnings.warn, not log.warning .

It’s still not easy to spot where the issue comes from though.

You may check it by running export PYTHONWARNINGS=error first.

yan12125 avatar Nov 11 '24 14:11 yan12125

Currently, the test suite fails to run with Python 3.13 because of https://github.com/jnwatson/py-lmdb/issues/362 Will try to monitor this issue and come back to this once it’s solved.

Jenselme avatar Nov 17 '24 12:11 Jenselme

ah, right. thanks for digging! the PR https://github.com/jnwatson/py-lmdb/pull/368 claims to solve that, so let's wait and see, yeah.

oberstet avatar Nov 17 '24 12:11 oberstet

https://github.com/jnwatson/py-lmdb/pull/368 was merged and I know of no issue with log.warn. Closing. Sorry for the noise.

Jenselme avatar Jun 12 '25 19:06 Jenselme