KotlinIsland / basedmypy

Based Python static type checker with baseline, sane default settings and based typing features
https://kotlinisland.github.io/basedmypy/
Other
145 stars 4 forks source link

Error importing plugin ... could not convert string to float #172

Closed Zeckie closed 2 years ago

Zeckie commented 2 years ago

Describe the problem, ie expected/actual result (if it's not blatantly obvious)

Attempting to use pydantic mypy plugin gives error pyproject.toml:1: error: Error importing plugin "pydantic.mypy": could not convert string to float: '1.2.2'

To reproduce

C:\Users\Zeckie\basedmypy-pydantic>poetry show -t --ansi
mypy 0.931 Optional static typing for Python
├── mypy-extensions >=0.4.3
├── tomli >=1.1.0
└── typing-extensions >=3.10
pydantic 1.9.0 Data validation and settings management using python 3.6 type hinting
└── typing-extensions >=3.7.4.3

C:\Users\Zeckie\basedmypy-pydantic>mypy .
Success: no issues found in 1 source file

CC:\Users\Zeckie\basedmypy-pydantic>poetry remove -D mypy
Updating dependencies
Resolving dependencies...

Writing lock file

Package operations: 0 installs, 0 updates, 3 removals

  • Removing mypy (0.931)
  • Removing mypy-extensions (0.4.3)
  • Removing tomli (2.0.0)

C:\Users\Zeckie\basedmypy-pydantic>poetry add -D basedmypy
Using version ^1.2.2 for basedmypy

Updating dependencies
Resolving dependencies...

Writing lock file

Package operations: 3 installs, 0 updates, 0 removals

  • Installing mypy-extensions (0.4.3)
  • Installing tomli (2.0.0)
  • Installing basedmypy (1.2.2)

C:\Users\Zeckie\basedmypy-pydantic>poetry show -t --ansi
basedmypy 1.2.2 Based static typing for Python
├── mypy-extensions >=0.4.3
├── tomli >=1.1.0
└── typing-extensions >=3.10
pydantic 1.9.0 Data validation and settings management using python 3.6 type hinting
└── typing-extensions >=3.7.4.3

C:\Users\Zeckie\basedmypy-pydantic>mypy .
pyproject.toml:1: error: Error importing plugin "pydantic.mypy": could not convert string to float: '1.2.2'  [misc]
Found 1 error in 1 file (errors prevented further checking)

C:\Users\Zeckie\basedmypy-pydantic>

Basedmypy version

basedmypy 1.2.2 Based on mypy 0.940+dev (fa16759d)

Command-line flags

No response

Configuration options from pyptoject.toml (and other config files)

[tool.poetry]
name = "example"
version = "1"
description = "Example"
authors = []

[tool.poetry.dependencies]
python = "3.10.2"
pydantic = "1.9.0"

[tool.poetry.dev-dependencies]
#mypy = "0.931"
basedmypy = "^1.2.2"

[tool.mypy]
plugins = "pydantic.mypy"

Python version used

3.10.2

Operating system and version

Windows

KotlinIsland commented 2 years ago

Thanks for the report! This is an issue with pydantic and is being addressed here. In the meantime you can use this version of pydantic where the issue is resolved.

Zeckie commented 2 years ago

But is basedmypy still reporting (to mypy plugins) that it is mypy 1.2.2 instead of 0.940+dev?

KotlinIsland commented 2 years ago

Yeah that's true. #174 has some brainstorming of how to best handle it.