Skip to content

TYP: np.arrange with datetime str #30628

@ghaarsma

Description

@ghaarsma

Describe the issue:

After upgrade numpy (2.3.5 -> 2.4.1) & numpy-typing-compat (20251206.2.3 -> 20251206.2.4): np.arange gives mypy errors with datetime str arguments

np_typing.py

Reproduce the code example:

import numpy as np

days = np.arange("2025-12-20", "2025-12-23", dtype="datetime64[D]")

Error message:

(venv) PS C:\Users\Python\site> mypy .\np_typing.py
Success: no issues found in 1 source file
(venv) PS C:\Users\Python\site> poetry update
Updating dependencies
Resolving dependencies... (51.4s)

Package operations: 0 installs, 2 updates, 0 removals

  - Updating numpy (2.3.5 -> 2.4.1)
  - Updating numpy-typing-compat (20251206.2.3 -> 20251206.2.4)

Writing lock file
(venv) PS C:\Users\Python\site> mypy .\np_typing.py
dwsc\np_typing.py:3: error: No overload variant of "arange" matches argument types "str", "str", "str"  [call-overload]

Python and NumPy Versions:

Python 3.13

  • Updating numpy (2.3.5 -> 2.4.1)
  • Updating numpy-typing-compat (20251206.2.3 -> 20251206.2.4)

Type-checker version and settings:

mypy 1.19.1

Additional typing packages.

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions