GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [Bug]: Missing typing for dates.py · Issue #26942 · matplotlib/matplotlib

[Bug]: Missing typing for dates.py #26942

New issue
Copy link
New issue
Copy link
Open
Open
[Bug]: Missing typing for dates.py#26942
Copy link
Labels
topic: date handlingtopic: typing

Description

@chacabuco
chacabuco
opened on Sep 28, 2023
Issue body actions

Bug summary

with mypy, MinuteLocator results in error:

error: Call to untyped function "MinuteLocator" in typed context [no-untyped-call]

Code for reproduction

import matplotlib.dates as mdates

mdates.MinuteLocator(byminute=range(0, 60, 5))
# run mypy --strict

Actual outcome

error: Call to untyped function "MinuteLocator" in typed context [no-untyped-call]

Expected outcome

No Mypy error

Additional information

No response

Operating system

Ubuntu

Matplotlib Version

3.8.0

Matplotlib Backend

QTAgg

Python version

3.8.10

Jupyter version

No response

Installation

pip

Reacted by John Hagen

Activity

  1. oscargus
    added
    topic: date handling
    topic: typing
    on Sep 28, 2023
  2. ksunden commented on Sep 28, 2023

    @ksunden
    ksunden
    on Sep 28, 2023
    Member
    More actions

    Units handling is a second portion which was omitted from the first round of type hinting.

    While much of it should be relatively straightforward (at the very least formatters/locators/etc, as in this example) the units portions of the code have quite a bit of dynamic behavior that is not always possible to capture in a static typing context.

    We can (and should) do better where we are able, but addressing units as a whole is a relatively large typing task.

    Similar to #26941, the base class for Locators is type hinted, and so some level of benefit from type hints can be gained by using that, but it does not address the constructor call.

    In general I think that --strict is often too strict especially when it comes to the no-untyped-call check

    I would perhaps suggest adding a config for matplotlib to ignore this rule:

    https://mypy.readthedocs.io/en/stable/config_file.html#example-mypy-ini

    https://mypy.readthedocs.io/en/stable/config_file.html#example-pyproject-toml

    [[tool.mypy.overrides]]
    module = "matplotlib"
    disallow_untyped_calls = false

    because while I would welcome improving our type hints, there may well continue to be portions that are not type hinted.

  3. rcomer
    marked Missing type hints for matplotlib.dates.DateFormatter #29994 as a duplicate of this issue on Aug 4, 2025
  4. rcomer commented on Aug 4, 2025

    @rcomer
    rcomer
    on Aug 4, 2025
    Member
    More actions

    #30126 made a start (against a duplicate issue) but has possibly stalled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: date handlingtopic: typing

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.