jupyter / jupyter_client

Jupyter protocol client APIs
https://jupyter-client.readthedocs.io
BSD 3-Clause "New" or "Revised" License
374 stars 279 forks source link

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

Open kLiHz opened 3 months ago

kLiHz commented 3 months ago

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
hroncok commented 2 months ago

https://github.com/jupyter/jupyter_client/blob/0a19278ed8d4090080a44760498a38ad9d4e0d99/jupyter_client/jsonutil.py#L29-L31

This seems like we could use a full date here.

hroncok commented 2 months ago

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