jupyter/jupyter_client

DeprecationWarning: Parsing dates involving a day of month without a year specified is ambiguious

kLiHz opened this issue · 2 comments

Hi, I'm using jupyter-lab with Python 3.13.0a6 and encountered with a deprecation warning.

For example when running jupyter kernelspec list:

$ jupyter kernelspec list
/home/admin/python-3.13.0a6/bin/jupyter-kernelspec:5: DeprecationWarning: Parsing dates involving a day of month without a year specified is ambiguious
and fails to parse leap day. The default behavior will change in Python 3.15
to either always raise an exception or to use a different default year (TBD).
To avoid trouble, add a specific year to the input & format.
See https://github.com/python/cpython/issues/70647.
  from jupyter_client.kernelspecapp import KernelSpecApp
Available kernels:
  deno          /home/admin/.local/share/jupyter/kernels/deno
  javascript    /home/admin/.local/share/jupyter/kernels/javascript
  python3       /home/admin/python-3.13.0a6/share/jupyter/kernels/python3

And about the jupyter-releated packages installed:

$ python3 -m pip list | grep jupyter
jupyter_client            8.6.1
jupyter_core              5.7.2
jupyter-events            0.10.0
jupyter-lsp               2.2.5
jupyter_server            2.14.0
jupyter_server_terminals  0.5.3
jupyterlab                4.1.6
jupyterlab_pygments       0.3.0
jupyterlab_server         2.26.0

# holy crap, strptime is not threadsafe.
# Calling it once at import seems to help.
datetime.strptime("1", "%d") # noqa

This seems like we could use a full date here.

E.g. replace it with datetime.strptime("2000-01-01", "%Y-%m-%d")