python / python/mypy

provide `add_static_method_to_class` via `plugins.common`

Open
#12,521 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature topic-plugins
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

Feature

Mypy's plugin helpers provide a few common cases, like adding an attribute and adding a method. I have a working implementation of adding a static method to a class, and as far as I can tell mypy does not currently provide a way of doing this.

Pitch

If a core developer had time to review a PR to introduce add_static_method_to_class to plugins.common, I'd be happy to spend some time figuring out how to contribute my code.

My current working version can be found here: https://github.com/xoeye/typecats/blob/main/typecats/cats_mypy_plugin.py?ts=4#L160

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in mypy's plugins.common and compare the requested helper with the existing common helpers for adding attributes and methods. Review the working reference implementation in typecats/cats_mypy_plugin.py, then determine the project's expected tests and behavior for exposing add_static_method_to_class through plugins.common.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.