Module 02: cover the underscore-prefix 'private/internal' convention

オープン 初心者向け
#40 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

評価

難易度
2/5
見積もり時間
1〜2日
初心者へのやさしさ
88/100
issue の種類
ドキュメント
明瞭さ
明確に書かれている
活発さ
静か
技術スタック
python
領域
documentation

調査の方向性

02_function_classes.qmd の命名規則のセクション付近から始め、既存の mikeio.pfs._pfssection.PfsSection の例を確認します。アンダースコア接頭辞、all、再エクスポート、ダブルアンダースコアに関する指針を追加し、その後 07_packaging.qmd の Breaking changes スライドを、公開 API であることの明記と相互参照を含むよう更新します。完了の条件は、両方のモジュールで内部名の規則とバージョニングが明確に結び付けられていることです。

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

説明

Module 02 (02_function_classes.qmd) teaches Python naming conventions but does not cover the leading-underscore convention for internal/private names. This came up in practice: a user upgraded a dependency, found that several _-prefixed functions had been removed, and was upset — not realising those were never part of the public API.

The breaking-changes slide in 07_packaging.qmd (Removing a function / Renaming / Changing signature → bump major) is the counterpart to this: removing a _private function is not a breaking change. Worth a forward reference between the two modules.

Suggested content for module 02

Add a slide near the existing naming-conventions section (around 02_function_classes.qmd:802) covering:

  • _foo signals internal — not part of the public API
  • Consumers who import underscore-prefixed names do so at their own risk
  • Maintainers may change/remove them without bumping the major version
  • __all__ in __init__.py to declare the public surface
  • Re-exporting internals into the package namespace (the existing mikeio.pfs._pfssection.PfsSection example at 02_function_classes.qmd:795 is a natural lead-in)
  • Double-underscore (__name) name mangling is a separate thing — mention briefly to avoid confusion
Cross-reference

Update the "Breaking changes" slide in 07_packaging.qmd to note that the rules apply to the public API only, with a pointer back to module 02.

See PEP 8 — Naming Conventions / Public and internal interfaces.

主要言語
Jupyter Notebook
スター
8
フォーク
1
平均マージ
4分
マージ済み PR(30日)
1

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

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

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

DHI/python-package-development のほかの issue

DHI/python-package-development の issue をすべて見る

似ている issue

Documentation の issue をもっと見る

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

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