Provide the full parsed config file to each plugin
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
Feature
Provide the full parsed config file to each plugin
Pitch
Currently, Mypy plugins are passed only the Options object in their constructor, which captures Mypy options but not Mypy plugin options. Consequently, each plugins has to re-parse the file. This is a waste of time, may add to the necessary dependencies for a plugin with configuration, and requires re-implementing the logic for parsing different file types (TOML vs config). Here's an example of the pydantic plugin doing just this:
The neatest solution would be to pass the full config object to the constructor. Unfortunately, this would be a breaking change to the constructor signature, so probably the more palatable option would be to store the config options within each Plugin instance (in the constructor), which the subclasses can use if they want:
class SomeMypyPlugin(Plugin):
def __init__(self, options: Options) -> None:
super().__init__(options)
my_config_option = self.raw_config["tools"]["some_mypy_plugin"]
# use my_config_option
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Plugin constructor and the configuration-loading path, then compare the pydantic plugin example linked in the issue. Trace how Options and plugin configuration are currently parsed, and define completion as making the full parsed configuration available to plugin instances without requiring each plugin to re-parse TOML or config files.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100