Skip to content

[Bug]: DepecrationWarning for datetime.datetime.utcfromtimestamp with Python >= 3.12 #27600

Closed as not planned

Description

@jeertmans

Bug summary

Hello,

Not really a bug, but I noticed that Python 3.12 introduced a new deprecation warning in the datetime module that affects Matplotlib users and dependent packages.

I could not find any related issue, so I wanted to point it out to you.

I actually run my tests with pytest -Werror so I had to filter out the warning with:
ignore:datetime\.datetime\.utcfromtimestamp\(\) is deprecated:DeprecationWarning to pass tests on Python 3.12 :-)

Code for reproduction

NA

Actual outcome

Deprecation warnings are raised.

Expected outcome

No deprecation warning

Additional information

No response

Operating system

No response

Matplotlib Version

3.8.2

Matplotlib Backend

No response

Python version

3.12

Jupyter version

No response

Installation

pip

Activity

  1. rcomer commented on Jan 4, 2024

    @rcomer
    Member

    From a quick search, there is no direct usage of utcfromtimestamp in Matplotlib’s current codebase. All I found was a pointer that these were removed at #25918, which was before v3.8 was released.

    Could you provide a code snippet that reproduces the warning @jeertmans?

  2. added
    status: needs clarification
    on Jan 4, 2024
  3. jeertmans commented on Jan 4, 2024

    @jeertmans
    Author

    Yes sorry @rcomer, so I created a dummy PR on my repo to show failures in CI (I don't have Python 3.12 locally installed).

    image

    Actually, the warning seems to be caused by a third-party module (dateutil), and it looks like they have already an issue open for that: dateutil/dateutil#1314.

    Should I close this one?

    Sorry for not checking that before.

  4. rcomer commented on Jan 4, 2024

    @rcomer
    Member

    Thanks for checking! Yes, it looks like there is nothing we can do for this in Matplotlib, so this issue should be closed.

  5. added and removed
    status: needs clarification
    on Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions