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

[BUG] Editable install hangs on "Preparing editable metadata" during pip install

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

メンテナーはふだん 1 日以内に返信

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

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
76/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
静か
技術スタック
python
領域
build-system

調査の方向性

hatch_build.py から始め、initialize() と _update_flatbuffers_git_version() を読み、その後 pyproject.toml の関連する build 設定と .github/workflows/main.yml のインストールワークフローを調べます。遅延を再現するために install-dev cpy311 のみを実行し、editable メタデータの生成がすぐに完了する一方で wheel の build も引き続き機能することを確認するために build cpy311 のみを実行します。

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

説明

bug CI-CD

Problem

During editable installs (pip install -e .), the installation hangs indefinitely / for a very long time at the "Preparing editable metadata" step. This occurs in CI workflows and locally when running just install-dev.

Example from CI:
See GitHub Actions job 87389844454 - the build hangs at line 39 with no progress after several minutes.

39
==> Installing package - in editable mode - with package runtime dependencies in cpy311...
Obtaining file:///home/runner/work/autobahn-python/autobahn-python
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Checking if build backend supports build_editable: started
  Checking if build backend supports build_editable: finished with status 'done'
  Getting requirements to build editable: started
  Getting requirements to build editable: finished with status 'done'
  Installing backend dependencies: started
  Installing backend dependencies: finished with status 'done'
  Preparing editable metadata (pyproject.toml): started
  [HANGS HERE - NO TIMEOUT]

eventually, it will finish, eg in above job after 49m 11s for the complete workflow

Image

Root Cause

The issue is in hatch_build.py at the initialize() method (lines 35-93). This custom build hook calls _update_flatbuffers_git_version() unconditionally, which:

  1. Runs git describe --tags --always on the deps/flatbuffers submodule (line 354-359)
  2. Has a 10-second timeout (line 359), but pip's metadata-only phase doesn't respect this timeout properly
  3. Can hang indefinitely if the git submodule is uninitialized or network access is slow

Why this happens:

Hatchling invokes the build hook during the metadata-only phase when building editable installs. This phase should be fast and never perform expensive I/O operations. However, the git operations in _update_flatbuffers_git_version() execute during this phase, causing the hang.

The correct behavior is to skip expensive operations during metadata-only generation and only perform them during actual wheel/sdist builds.

Solution

Add a guard to skip git version capture during pip's metadata-only phase. Hatchling sets HATCHLING_BUILD_METADATA_ONLY=1 for metadata-only operations, which we can check:

Patch for hatch_build.py
def initialize(self, version, build_data):
    """
    Called before each build.

    For wheel builds, compile the CFFI modules and flatc.
    For sdist builds, just ensure source files are included.
    """
    # SKIP git version capture during editable metadata generation.
    # Metadata generation should not perform I/O or run expensive operations.
    # Only capture for actual wheel/sdist builds, not for pip's --no-build-isolation
    # editable metadata phase.
    if os.environ.get("HATCHLING_BUILD_METADATA_ONLY") == "1":
        print("Skipping FlatBuffers git version capture during metadata-only phase")
        return

    # Always capture flatbuffers git version (for both wheel and sdist)
    self._update_flatbuffers_git_version()

    if self.target_name != "wheel":
        # Only compile for wheel builds, sdist just includes source
        return

    # ... rest of the method remains unchanged

This ensures that:

  • ✅ Editable installs complete quickly without unnecessary I/O
  • ✅ Actual wheel/sdist builds still capture git version correctly
  • ✅ No timeout hangs during metadata-only phase
  • ✅ Backwards compatible with existing workflows

Testing

After applying the patch:

# Should complete quickly without hanging
just install-dev cpy311

# Wheel build should still work (and capture git version)
just build cpy311

Related

  • Workflow file: .github/workflows/main.yml (line 81-84)
  • Build hook: hatch_build.py (lines 35-93, specifically _update_flatbuffers_git_version())
  • Build config: pyproject.toml (lines 262-264)
主要言語
Python
スター
2.5k
フォーク
767
平均マージ
12時間 40分
マージ済み PR(30日)
20

環境構築

はじめの一歩

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

crossbario/autobahn-python のほかの issue

crossbario/autobahn-python の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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