Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Several `pyproject.toml settings are sensitive to trailing comma #18623

Closed
sobolevn opened this issue Feb 6, 2025 · 0 comments · Fixed by #18624
Closed

Several `pyproject.toml settings are sensitive to trailing comma #18623

sobolevn opened this issue Feb 6, 2025 · 0 comments · Fixed by #18624
Assignees
Labels
bug mypy got something wrong topic-configuration Configuration files and flags

Comments

@sobolevn
Copy link
Member

sobolevn commented Feb 6, 2025

See #18621 (comment)

Basically, all settings that use try_split are affected:

mypy/mypy/config_parser.py

Lines 192 to 217 in 5ee02cd

"packages": try_split,
"modules": try_split,
}
# Reuse the ini_config_types and overwrite the diff
toml_config_types: Final[dict[str, _INI_PARSER_CALLABLE]] = ini_config_types.copy()
toml_config_types.update(
{
"python_version": parse_version,
"mypy_path": lambda s: [expand_path(p) for p in try_split(s, "[,:]")],
"files": lambda s: split_and_match_files_list(try_split(s)),
"junit_format": lambda s: check_junit_format(str(s)),
"follow_imports": lambda s: check_follow_imports(str(s)),
"plugins": try_split,
"always_true": try_split,
"always_false": try_split,
"untyped_calls_exclude": lambda s: validate_package_allow_list(try_split(s)),
"enable_incomplete_feature": try_split,
"disable_error_code": lambda s: validate_codes(try_split(s)),
"enable_error_code": lambda s: validate_codes(try_split(s)),
"package_root": try_split,
"exclude": str_or_array_as_list,
"packages": try_split,
"modules": try_split,
}
)

I am working on a fix.

@sobolevn sobolevn added bug mypy got something wrong topic-configuration Configuration files and flags labels Feb 6, 2025
@sobolevn sobolevn self-assigned this Feb 6, 2025
x612skm pushed a commit to x612skm/mypy-dev that referenced this issue Feb 24, 2025
@sterliakov sterliakov marked this as a duplicate of #14239 Mar 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong topic-configuration Configuration files and flags
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant