Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Add option to turn off adding of empty __init__.py files

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

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

評価

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

調査の方向性

この issue ではファイル名もテストも指定されていないため、まずコアライブラリの Python コード生成エントリーポイントと、空の init.py ファイルを作成するコードを特定します。要求された動作を Bazel の legacy_create_init=False オプションと比較し、その後、生成された namespace-package パスがそれらのファイルなしで機能すること、およびデフォルトの動作が変わらないことを確認します。

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

説明

enhancement
Summary

Improve compatibility in monorepo/Bazel usages, so that package path can be treated as native namespace packages

What is the feature request for?

The core library

The Problem

When using two proto files that have a similar prefix such as a.b.c and a.b.d, when these are produced as two separate artifacts consuming both of these as libraries would cause a import path collision since they both share __init__.py files in a and a/b folders.

The Ideal Solution

Add an option to skip creation of empty __init__.py files. Build tools treat the folders without __init__.py as namespace packages.

The Current Solution

I made the change as a patch and applied the patch on the library to get this capability.
I can roll the change up as a PR if there's interest in this.

Related Solution

A similar option called legacy_create_init=False was introduced on bazel to solve this exact issue with package names. See https://rules-proto-grpc.com/en/latest/lang/python.html#python-grpc-compile:~:text=legacy_create_init%3DFalse .

主要言語
Python
スター
1.8k
フォーク
235
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

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

danielgtaylor/python-betterproto のほかの issue

danielgtaylor/python-betterproto の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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