[BUG] Editable install hangs on "Preparing editable metadata" during pip install
メンテナーはふだん 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 の本文から書いたものです。
説明
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
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:
- Runs
git describe --tags --alwayson thedeps/flatbufferssubmodule (line 354-359) - Has a 10-second timeout (line 359), but pip's metadata-only phase doesn't respect this timeout properly
- 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
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
crossbario/autobahn-python のほかの issue
-
CI-CD enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
crossbario/autobahn-python#1945 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
CI-CD enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
crossbario/autobahn-python#1829 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug CI-CD
難易度 4/5 3〜5日 初心者へのやさしさ 52/100
crossbario/autobahn-python#2013 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
crossbario/autobahn-python#1963 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 68/100
crossbario/autobahn-python#1962 ·
メンテナーはふだん 1 日以内に返信
crossbario/autobahn-python の issue をすべて見る
似ている issue
-
test-failure
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
teramoby/speedle-plus#129 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
btclib-org/btclib-ecc#404 ·
-
verify: just verify runs tools/verify_agents_imports.py (the recipe line was only read, not run)オープンneeds-verification
難易度 1/5 1時間未満 初心者へのやさしさ 76/100
EchoTools/nevr-runtime#1322 ·
メンテナーはふだん 1 日以内に返信
-
changelog investigate
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
ramnes/notion-sdk-py#430 ·
-
bug good first issue
難易度 1/5 1時間未満 初心者へのやさしさ 91/100
hyeonjoong/debussy#56 ·