Plugin configuration for the mypy plugin and docs#141
Open
Plugin configuration for the mypy plugin and docs#141
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
IMPORTANT: This PR is marked as a draft because the branch is based on another branch: mypy-plugin.It should be rebased on dev-mypy and only merged after that branch has been merged.
This is a part of making validataclass mypy-compatible (#116).
Please note that the target branch is
dev-mypyinstead of main.This PR extends the mypy plugin introduced in #140 (not merged as of now) by a simple config system. It also adds some documentation on how to use the mypy plugin including the newly added settings.
The plugin config currently only supports the
pyproject.tomlformat, which I think is fine because that's the recommended way to configure tooling for Python projects. The plugin automatically detects the config file used by mypy and reads the same file (if it ends on.toml).The primary purpose of the plugin config is to support custom decorators and other extensions to validataclass, like those needed for the validataclass-search-queries library, or custom decorators that we have in some of our company's projects.
The PR introduces a conditional dependency to the library: For Python <3.11 (meaning 3.10), the library now requires the
tomlilibrary to parse TOML files. Since Python 3.11, the standard library contains tomllib which is fully API-compatible to tomli (I think it's literally the same library?). The tomli library itself is a simple library without any dependencies, so it stays lightweight.