python-lsp / pylsp-mypy

Mypy plugin for the Python LSP Server.
MIT License
118 stars 35 forks source link

`toml` unable to parse value of `overrides` option #58

Closed lxnn closed 1 year ago

lxnn commented 1 year ago

Issue

The overrides option uses the boolean value True to indicate where the default arguments should be slotted in to the overridden arguments list.

However, pyproject.toml is parsed by the toml package, which implements v0.5.0 of the TOML specification, which does not allow mixing types in an array. So the following will not be able to be parsed, as the array contains a mixture of strings and booleans:

[tool.pylsp-mypy]
overrides = ["--python-executable", "/home/me/bin/python", True]

Suggested fixes

Use a different TOML parser -- one that implements TOML v1.0.0, which allows mixed-type arrays -- such as tomli.

Alternatively, deprecate the overrides option and add three new options:

Richardk2n commented 1 year ago

Switched to tomli (see master). Do you need a release? Booleans need to be lower case in TOML (the tomli error message is a lot less helpful in that regard than toml)

lxnn commented 1 year ago

Booleans need to be lower case in TOML

Oh yes. Sorry, that was a typo. When I tested it, I did use a lowercase boolean literal, resulting in TomlDecodeError: Not a homogeneous array

Do you need a release?

Up to you. I'm personally happy installing from the GitHub repository.

Richardk2n commented 1 year ago

Ok. I will try to fix some other issues and aim for a release by the end of the weekend.