Skip to content

Plugin configuration for the mypy plugin and docs#141

Open
binaryDiv wants to merge 6 commits intodev-mypyfrom
mypy-plugin-config
Open

Plugin configuration for the mypy plugin and docs#141
binaryDiv wants to merge 6 commits intodev-mypyfrom
mypy-plugin-config

Conversation

@binaryDiv
Copy link
Copy Markdown
Contributor

@binaryDiv binaryDiv commented Mar 12, 2026

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-mypy instead 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.toml format, 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 tomli library 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.

@binaryDiv binaryDiv self-assigned this Mar 12, 2026
@binaryDiv binaryDiv added the new feature New feature that is not (only) a validator class label Mar 12, 2026
Base automatically changed from mypy-plugin to dev-mypy March 26, 2026 13:32
@binaryDiv binaryDiv marked this pull request as ready for review March 26, 2026 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new feature New feature that is not (only) a validator class

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant