python / python/mypy

Render @property-@name.setter pattern for rw properties in stubgenc

オープン
#15,315 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

feature topic-descriptors topic-stubgen
主要言語
Python
スター
20.6k
フォーク
3.3k
平均マージ
1日 18時間
マージ済み PR(30日)
54

説明

Feature

Currently, stubgen renders the readwrite properties as a plain class field with inferred type. e.g.

in a pybind11 module

cls.def_property("my_property", &MyClass::GetProperty, &MyClass::SetProperty);

will result in

class MyClass:
    my_property: int

Could it be possible to render a @property-@name.setter pair instead, like:

class MyClass:
    @property
    def my_property(self) -> int: ...
    @my_property.setter
    def my_property(self, val: int) -> None: ...

Pitch

This way can more clearly reflect the fact that it is a property. I'm happy to help create a PR for this.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、stubgenc における readwrite プロパティの現在の処理を特定し、推論されたクラスフィールドがどのように出力されるかを確認します。生成されたスタブが要求された @property と @name.setter の組み合わせを使用し、issue に示されている getter と setter のアノテーションが付くようになれば、作業は完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
tooling
issue の種類
機能追加
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
42/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。