Skip to content

Missing type hints for matplotlib.dates.DateFormatter #29994

Closed as duplicate

Description

@johnthagen

Using this code:

from matplotlib.dates import DateFormatter

date_fmt = "%H:%M:%S"
date_formatter = DateFormatter(date_fmt)

Running Mypy in strict mode results in an erorr:

$ mypy --strict main.py 
main.py:4: error: Call to untyped function "DateFormatter" in typed context  [no-untyped-call]
Found 1 error in 1 file (checked 1 source file)

We run Mypy in strict mode across all of our code base to catch programming errors and would like to use it with matplotlib without the need to suppress errors like this.

Environment

  • Python 3.11.11
  • matplotlib 3.10.1
  • mypy 1.15.0

Related References

Activity

  1. johnthagen commented on May 1, 2025

    @johnthagen
    ContributorAuthor

    This looks to be the constructor that is missing type annotations

    def __init__(self, fmt, tz=None, *, usetex=None):

  2. oscargus commented on May 1, 2025

    @oscargus
    Member

    The dates module is currently completely untyped. Matplotlib uses stub-files, .pyiin case you or someone else wants to start adding type information.

  3. bandpooja commented on Jun 1, 2025

    @bandpooja

    Added type hints in #30126.

  4. rcomer commented on Aug 4, 2025

    @rcomer
    Member

    Closing this one as a duplicate of #26942

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