EVEMISSTechnology

Repository 指南 · 入門 · v3

psf / black · 入門

平台 metadata 描述的是一個毫不妥協的 Python 程式碼格式化工具,採用 MIT 授權,分析了 482 個檔案,最新 release 是 26.5.1。分析列出 18 筆進入點記錄,其中 17 筆帶有 __main__ 守衛,有界路徑都停在未解析的邊界。因為只解析 requirements 形式的清單檔,依賴記錄是空的;也沒有任何安裝或執行指令經過驗證。

原始 repository
psf/black
授權
MIT · 開源授權
分析的版本 · 最後驗證
20622e1259c29bda81831962ace1348ba1921c84 ·

原始專案有更新,但本指南引用的程式碼沒有變動。預設分支已前進到 5fe7881e6e40,2026-10-03 檢查。版本差異比對了 48 個變動的檔案,本指南引用的程式碼區域都沒有變動。本頁描述的仍是版本 20622e1259c2;整個 repository 的統計數字(檔案數、呼叫次數等)指的是那個版本。

本頁中文由負責的 AI 編輯依英文正式版本 v3 翻譯;程式碼名稱、路徑、行號與數字都經確定性檢查,與英文版一致。陳述與依據表保留英文原文,因為那是獨立驗證者核對過的紀錄。看英文原文

psf/black 入門:metadata、進入點與清單檔

本頁用語說明
Entrypoint record(進入點記錄)
分析器標記為「程式可能從這裡開始執行」的檔案。附有 __main__ guard 摘錄時,表示檔案裡有 if __name__ == "__main__": 區塊,摘錄顯示它呼叫了什麼;沒有摘錄時,只是依檔名判斷。
Bounded static execution path(有界靜態執行路徑)
不執行程式、直接從原始碼重建出的呼叫鏈,走到固定步數就停。它說明在紙面上能追到多遠,不代表實際執行時會發生什麼。
Unresolved boundary(未解析邊界)
靜態路徑停下的地方:下一個呼叫進入外部函式庫,或不執行就無法確定。這是本次分析的邊界,不是 repository 的缺陷。
Static relations(靜態關係)
在原始碼中找到的呼叫與 import。「external or unresolved」表示指向分析範圍以外。
Module role(模組角色)
分析器依呼叫進出次數推論的檔案標籤(例如 core、entry/orchestration、leaf)。它描述的是在呼叫圖中的位置,不是作者的設計意圖。
Test-like files(類測試檔案)
名稱或位置看起來像測試的檔案。本次分析只計數,不執行。
Observed · inferred · author-claimed · unresolved
每句話的依據:直接讀自分析的檔案;由分析器從檔案推論;repository 作者自述(metadata、README);或本次分析無法確定。
Verified(已驗證)
本頁有兩種用法。在分析器的記錄裡(「verified provenance」「verified entrypoint」),它表示這筆記錄是直接從分析的檔案讀到的,也就是本指南所說的 observed;以進入點來說,就是檔案裡確實有 __main__ guard 的文字。分析器在 2026-10-04 修正後,只有 cli.py、main.py 這類像進入點的檔名、沒有 guard 的檔案,會記為 inferred(推測);在那之前分析的指南仍把這類檔案標成 verified,它依然只是對檔案用途的推測。它不代表程式被執行或測試過。「最後驗證」是這份指南最後一次通過本實驗室檢查的日期,檢查對象是所標示版本的分析記錄,不是對 repository 本身的審查。

你在看的是什麼

metadata 也記錄了具體的事實:主要語言是 Python,追蹤到的語言位元組幾乎全是 Python(約 5.46 百萬中的 5,440,093 個),Vim Script、Jupyter Notebook 和 Dockerfile 只占一小部分。授權記錄為 MIT,來源標示為 GitHub API 和 repository 裡的一個檔案。最新 release 是 26.5.1,於 2026-05-18 發布,這個 repository 在 2026-09-14 有 41,844 個 star。分析器的成熟度訊號列出 482 個被分析的檔案、326 個類測試檔案、7 個清單檔、9,339 條靜態關係邊和 176 條有界執行路徑。

它需要什麼,以及這份分析資料看不到的

如果你的問題是要安裝什麼,這份分析資料回答不了。它沒有任何依賴記錄;依賴記錄只來自分析器 v0.10 解析的 requirements 形式清單檔,而這個 repository 一個也沒有被解析。pyproject.toml 的依賴表不會被解析,所以宣告的依賴和版本限制都沒有列出來,即使 pyproject.toml 確實存在,也被歸為專案層級的重要檔案。成熟度訊號在檔案清單中算到 7 個清單檔,但沒有任何解析過的清單記錄,所以它們的內容沒有反映在這裡。因為安裝、執行與建置的推論並不完整,安裝指令也沒有驗證,這份指南也無法指名要安裝哪些套件或版本。

它怎麼啟動

列出了十八筆進入點記錄:其中十七筆的摘錄顯示 Python __main__ 執行守衛(這些記錄的摘錄欄位,就是看得到這種守衛長什麼樣子的地方),另有一個依檔名啟發式規則找到的候選 action/main.py(分析把它標為 filename-heuristic candidate,依據的是檔名,而不是守衛摘錄)。在 src 目錄樹裡,套件的 init 檔 src/black/__init__.py 和 src/blackd/__init__.py 各自用守衛包住一個 patched_main() 呼叫。在 src/blib2to3/pgen2 底下,driver.py 以 sys.exit(int(not main())) 結尾,literals.py 和 tokenize.py 則帶有較小、偏向測試用途的守衛。在 scripts/ 裡,diff_shades_gha_helper.py、generate_schema.py 和 make_width_table.py 都用守衛包住一個 main() 呼叫;release.py 以 sys.exit(main()) 結尾,release_tests.py 呼叫 unittest.main()。scripts/fuzz.py 的守衛會執行 test_idempotent_any_syntactically_valid_python(),並在有 Atheris fuzzing 函式庫時進行 coverage-guided fuzzing。帶有守衛的記錄還包括 tests/test_tokenize.py(它的守衛讀取 stdin、做 tokenize,然後印出一個 assert_tokenizes 斷言),以及 tests/data/cases/ 底下的路徑。重建結果統計出 18 個進入點和 176 條有界執行路徑;為 action/main.py 列出的五條有界路徑就是執行路徑記錄,它們的步驟顯示都馬上停在 Path 和 os.getenv 這類未解析的外部邊界。分析的限制清單記錄了最後這個詞背後的一般原則:好幾種動態行為,這次靜態分析都沒有解析。超出這些守衛與有界路徑記錄的執行時行為,包括這個套件安裝後怎麼以指令的形式被呼叫,這次分析都無法確定。

先看哪裡

README.md、pyproject.toml 和 LICENSE 被歸為專案層級的重要檔案。分析器關於學習路徑的陳述建議:先從清單檔和重要符號開始,再追蹤有界執行路徑,並在改程式之前檢查未解析的邊界;但這份分析資料看不到這個建議所預設的清單檔內容,所以光靠這份資料無法照著做。它關於修改的陳述說,要從偵測到的進入點 action/main.py 開始分析修改,再手動確認下游的影響。依被分析的檔案數,頂層目錄樹是 tests(326)、docs(48)、src(48)、.github(22)、scripts(9)、profiling(7),根目錄有 19 個檔案,action、plugin 和 autoload 則各有一個檔案。src 裡有帶守衛的套件 init 檔 src/black/__init__.py 和 src/blackd/__init__.py,以及進入點記錄中提到的 src/blib2to3/pgen2 模組。326 個類測試檔案大約占全部 482 個被分析檔案的三分之二;光看數字無法知道這些檔案的內容。docs/ 有 48 個檔案,進入點摘錄顯示有兩支腳本會開啟 CHANGES.md,以及 docs/usage_and_configuration/the_basics.md 和 docs/integrations/source_version_control.md 這類文件檔。

這次分析無法告訴你的事

這是靜態分析,分析資料本身也記錄了它的邊界。安裝、建置和執行指令都沒有驗證,安裝/執行/建置的推論也不完整,這就是為什麼這份指南沒有任何指令。只有 requirements 形式的清單檔會產生依賴記錄,pyproject.toml 的依賴表不會被解析,所以這裡的依賴樣貌是空的。來自 README 的陳述是逐行擷取的,可能抓到程式碼行而不是說明文字,所以任何 README 的陳述最多只算 author_claimed。反射、執行期依賴注入、動態 import、monkey-patching、產生的程式碼、框架在執行期的接線和動態分派都沒有解析。在 9,339 條靜態關係邊中,重建結果只算到 813 條已解析的呼叫關係,所以大多數的邊仍是未解析或外部的。分析資料也自相矛盾:有一條教學陳述說沒有可用的有界靜態執行路徑,但 action/main.py 列出了五條有界路徑,總數更有 176 條;而且摘要文字把 scripts/check_pre_commit_rev_in_example.py 稱為主要起點,教學陳述卻指向 action/main.py。這個專案平常應該怎麼被呼叫使用,無法確定。

專案怎麼介紹自己

repository metadata 把這個專案描述為「The uncompromising Python code formatter」;請把它當作作者的自我描述,不是分析的發現。首頁欄位指向 Read the Docs 上 Black 文件網站的 stable 頻道。附加的 topics 包括 formatter、codeformatter、python、pre-commit-hook、autopep8、yapf、gofmt、hacktoberfest 和 code。

這次分析無法確定的事

這些是撰寫模型對分析記錄自己的說明。lim_3、exec_* 或 claim_… 這類識別碼指的是那次分析裡的記錄;陳述與依據表引用的也是同一批記錄。

  • dependency_records 和 dependency_manifests_parsed 都是空的;依 lim_3,只有 requirements 形式的清單檔會被解析,所以本指南不知道這個 repository 宣告了哪些依賴。
  • 教學陳述 claim_4d30ade3e21e 說沒有可用的有界靜態執行路徑,但分析資料為 action/main.py 列出了五條有界路徑(exec_*),總數算到 176 條:這是內部不一致。
  • repository_summary 推論的用途把 scripts/check_pre_commit_rev_in_example.py 當作主要起點,而 claim_227144a415af 指的是 action/main.py:這是內部不一致。
  • 教學陳述 claim_31723c5d9328 引用了 architecture_reconstruction,但它在這份分析資料裡不是一筆記錄;18 個進入點和 813 條關係的統計只依據這條陳述。
  • 有三筆進入點記錄指向 tests/data/cases/;它們的 __main__ 守衛是可以執行的腳本,還是 fixture 內容,這些記錄沒有分清楚。
陳述與依據 — 38 條陳述,38 條經獨立驗證者確認(英文原文)

Every substantive statement above is a claim bound to grounding IDs of the analyzed revision. Global grounding IDs are namespaced by the analysis run.

Claim Epistemic status Verifier Grounding (global IDs)
c1 The metadata's primary-language field says Python. observed supported analysis_f07f1c5b3429400e:meta_primary_language
c2 Tracked language bytes are almost entirely Python (5,440,093 of about 5.46 million), with small Vim Script, Jupyter Notebook and Dockerfile shares. observed supported analysis_f07f1c5b3429400e:meta_language_bytes
c3 The license is recorded as MIT, with origin given as both the GitHub API and a repository file. observed supported analysis_f07f1c5b3429400e:meta_license
c4 The latest recorded release is 26.5.1, published 2026-05-18. observed supported analysis_f07f1c5b3429400e:meta_latest_release
c5 The repository counted 41,844 stargazers on 2026-09-14. observed supported analysis_f07f1c5b3429400e:meta_stars
c6 Maturity signals list 482 analyzed files, 326 test-like files, 7 manifest files, 9,339 static relation edges and 176 bounded execution paths. inferred supported analysis_f07f1c5b3429400e:summary_repository
c7 This packet contains no dependency records; dependency records come only from requirements-style manifests parsed by analyzer v0.10, and none were parsed for this repository. observed supported analysis_f07f1c5b3429400e:lim_3
c8 pyproject.toml dependency tables are not parsed, so declared dependencies and version constraints cannot be listed from this packet. observed supported analysis_f07f1c5b3429400e:lim_3
c9 pyproject.toml is present and classified as a project-level important file. observed supported analysis_f07f1c5b3429400e:important_3
c10 Maturity signals count 7 manifest files in the inventory, but the analysis lists no parsed manifests, so their contents are not reflected here. inferred supported analysis_f07f1c5b3429400e:summary_repository, analysis_f07f1c5b3429400e:lim_3
c11 Install, run and build inference is partial, and installation commands are not verified by this analysis. observed supported analysis_f07f1c5b3429400e:lim_2
c12 The packet lists 18 entrypoint records: 17 whose excerpts show a Python __main__ execution guard, plus one filename-heuristic candidate, action/main.py. observed supported analysis_f07f1c5b3429400e:py_entry_6375211a42e2, analysis_f07f1c5b3429400e:py_entry_49b6285f03c4, analysis_f07f1c5b3429400e:py_entry_a7be1b170db3, analysis_f07f1c5b3429400e:py_entry_45e63aec2981, analysis_f07f1c5b3429400e:py_entry_2d43f7cb959d, analysis_f07f1c5b3429400e:py_entry_078791731a33, analysis_f07f1c5b3429400e:py_entry_8be0649f8947, analysis_f07f1c5b3429400e:py_entry_f86a7886b9b8, analysis_f07f1c5b3429400e:py_entry_0ad4d7a9c321, analysis_f07f1c5b3429400e:py_entry_fce0ce2b9b79, analysis_f07f1c5b3429400e:py_entry_479e85cc920d, analysis_f07f1c5b3429400e:py_entry_fae1962d2b1e, analysis_f07f1c5b3429400e:py_entry_2525738168fe, analysis_f07f1c5b3429400e:py_entry_bde361c6e00a, analysis_f07f1c5b3429400e:py_entry_b93757a7ff5d, analysis_f07f1c5b3429400e:py_entry_ae3dafb0586c, analysis_f07f1c5b3429400e:py_entry_7a35d8e2430b, analysis_f07f1c5b3429400e:entry_1
c13 The package inits src/black/__init__.py and src/blackd/__init__.py each carry a __main__ guard whose body calls patched_main(). observed supported analysis_f07f1c5b3429400e:py_entry_fce0ce2b9b79, analysis_f07f1c5b3429400e:py_entry_479e85cc920d
c14 src/blib2to3/pgen2/driver.py's guard ends with sys.exit(int(not main())), src/blib2to3/pgen2/literals.py guards a call to test(), and src/blib2to3/pgen2/tokenize.py's guard, marked as testing, tokenizes stdin or a file named in argv. observed supported analysis_f07f1c5b3429400e:py_entry_fae1962d2b1e, analysis_f07f1c5b3429400e:py_entry_2525738168fe, analysis_f07f1c5b3429400e:py_entry_bde361c6e00a
c15 In scripts/, diff_shades_gha_helper.py, generate_schema.py and make_width_table.py guard a call to main(); release.py's guard ends with sys.exit(main()) and release_tests.py's calls unittest.main(). observed supported analysis_f07f1c5b3429400e:py_entry_a7be1b170db3, analysis_f07f1c5b3429400e:py_entry_2d43f7cb959d, analysis_f07f1c5b3429400e:py_entry_078791731a33, analysis_f07f1c5b3429400e:py_entry_8be0649f8947, analysis_f07f1c5b3429400e:py_entry_f86a7886b9b8
c16 scripts/fuzz.py's guard runs test_idempotent_any_syntactically_valid_python() and, when the Atheris fuzzing library is available, coverage-guided fuzzing. observed supported analysis_f07f1c5b3429400e:py_entry_45e63aec2981
c17 Guard-bearing records also include tests/test_tokenize.py, whose guard reads stdin, tokenizes it and prints an assert_tokenizes assertion, and paths under tests/data/cases/. observed supported analysis_f07f1c5b3429400e:py_entry_0ad4d7a9c321, analysis_f07f1c5b3429400e:py_entry_b93757a7ff5d, analysis_f07f1c5b3429400e:py_entry_ae3dafb0586c, analysis_f07f1c5b3429400e:py_entry_7a35d8e2430b
c18 The analyzer's reconstruction tallies 18 entrypoints and 176 bounded execution paths. inferred supported analysis_f07f1c5b3429400e:claim_31723c5d9328, analysis_f07f1c5b3429400e:summary_repository
c19 All five bounded static paths listed for action/main.py terminate immediately at unresolved external boundaries such as Path and os.getenv. inferred supported analysis_f07f1c5b3429400e:exec_bfd58df29904, analysis_f07f1c5b3429400e:exec_5daffbde25d6, analysis_f07f1c5b3429400e:exec_12046e1e9958, analysis_f07f1c5b3429400e:exec_dbb7510ec43e, analysis_f07f1c5b3429400e:exec_73307b610151
c20 Runtime behaviour beyond these guard and bounded-path records, including how the package is invoked as an installed command, is not established by this analysis. unresolved supported analysis_f07f1c5b3429400e:lim_1, analysis_f07f1c5b3429400e:lim_2
c21 README.md, pyproject.toml and LICENSE are classified as project-level important files. observed supported analysis_f07f1c5b3429400e:important_1, analysis_f07f1c5b3429400e:important_3, analysis_f07f1c5b3429400e:important_4
c22 The analyzer's learning-path claim advises starting from manifests and important symbols, then tracing the bounded execution path and inspecting unresolved boundaries before changing code; this packet cannot show the manifest contents that advice presupposes, so the advice is not actionable from this packet alone. inferred supported analysis_f07f1c5b3429400e:claim_e56db45165bf
c23 The modify-guide claim says to begin modification analysis at the detected entrypoint action/main.py, then verify downstream effects manually. inferred supported analysis_f07f1c5b3429400e:claim_c3ece21fa115
c24 Top-level directories by analyzed file count: tests (326), docs (48), src (48), .github (22), scripts (9), profiling (7), 19 at the root, and action, plugin and autoload with one file each. inferred supported analysis_f07f1c5b3429400e:summary_repository
c25 src holds the guard-bearing package inits src/black/__init__.py and src/blackd/__init__.py and the src/blib2to3/pgen2 modules named in the entrypoint records. observed supported analysis_f07f1c5b3429400e:py_entry_fce0ce2b9b79, analysis_f07f1c5b3429400e:py_entry_479e85cc920d, analysis_f07f1c5b3429400e:py_entry_fae1962d2b1e, analysis_f07f1c5b3429400e:py_entry_2525738168fe, analysis_f07f1c5b3429400e:py_entry_bde361c6e00a
c26 The 326 test-like files are roughly two thirds of all 482 analyzed files; the counts alone do not show what those files contain. inferred supported analysis_f07f1c5b3429400e:summary_repository
c27 Entrypoint excerpts show scripts/check_version_in_basics_example.py and scripts/check_pre_commit_rev_in_example.py opening CHANGES.md and docs files such as docs/usage_and_configuration/the_basics.md and docs/integrations/source_version_control.md. observed supported analysis_f07f1c5b3429400e:py_entry_49b6285f03c4, analysis_f07f1c5b3429400e:py_entry_6375211a42e2
c28 Installation, build and run commands are not verified by this analysis; install/run/build inference is partial. observed supported analysis_f07f1c5b3429400e:lim_2
c29 Only requirements-style manifests feed dependency records and pyproject.toml dependency tables are not parsed, so the dependency picture here is empty. observed supported analysis_f07f1c5b3429400e:lim_3
c30 README claim extraction is line-based and may capture code lines instead of prose, so any README claim is author_claimed at best. observed supported analysis_f07f1c5b3429400e:lim_4
c31 The analysis is static only: reflection, runtime dependency injection, dynamic imports, monkey-patching, generated code, framework runtime wiring and dynamic dispatch are not resolved. observed supported analysis_f07f1c5b3429400e:lim_1
c32 The reconstruction counts 813 resolved static call relations against 9,339 static relation edges, so most edges remain unresolved or external. inferred supported analysis_f07f1c5b3429400e:claim_31723c5d9328, analysis_f07f1c5b3429400e:summary_repository
c33 The packet contradicts itself on runtime flow: one teaching claim says no bounded static execution path is available, yet the packet lists five bounded paths for action/main.py and counts 176 overall. inferred supported analysis_f07f1c5b3429400e:claim_4d30ade3e21e, analysis_f07f1c5b3429400e:exec_bfd58df29904, analysis_f07f1c5b3429400e:summary_repository
c34 The summary prose names scripts/check_pre_commit_rev_in_example.py as the main starting place, while the teaching claims and entrypoint candidate point to action/main.py — a second internal inconsistency. inferred supported analysis_f07f1c5b3429400e:claim_227144a415af, analysis_f07f1c5b3429400e:summary_repository
c35 How the project is meant to be invoked day-to-day is not established by this packet. unresolved supported analysis_f07f1c5b3429400e:lim_1, analysis_f07f1c5b3429400e:lim_2
c36 The repository metadata describes the project as 'The uncompromising Python code formatter'. author_claimed supported analysis_f07f1c5b3429400e:meta_description
c37 The metadata homepage points to a Black documentation site on Read the Docs, stable channel. author_claimed supported analysis_f07f1c5b3429400e:meta_homepage
c38 Repository topics include formatter, codeformatter, python, pre-commit-hook, autopep8, yapf, gofmt, hacktoberfest and code. author_claimed supported analysis_f07f1c5b3429400e:meta_topics

來源、權利與說明 · attribution-license-templates/v0.1

權利聲明。原始 repository 託管於 GitHub。其原始碼、文件、名稱、媒體與相關素材的權利,仍屬各自的作者、貢獻者與其他權利人所有,並受該 repository 的授權條款約束。

Original repository hosted on GitHub. Repository source code, documentation, names, media, and related project materials remain subject to the rights of their respective authors, contributors, and other rights holders and to applicable repository license terms.

平台聲明。GitHub 是所連結 repository 的來源託管平台。GitHub 與相關標誌為 GitHub, Inc. 的商標。除非另有明確說明,EVEMISS Technology 與 GitHub 之間沒有隸屬或背書關係。

GitHub is the source hosting platform for the linked repository. GitHub and related marks are trademarks of GitHub, Inc. EVEMISS Technology is not affiliated with or endorsed by GitHub unless explicitly stated otherwise.

這一頁怎麼來的。本頁由對應版本的 repository 分析與 AI 輔助的編輯工具產生。技術陳述綁定所分析的版本;原始 repository 更新後,可能重新驗證。

This page was produced using revision-aware repository analysis and AI-assisted editorial tooling. Technical claims are tied to the analyzed repository revision and may be revalidated when the source repository changes.

本頁包含 AI 輔助分析,並經 EVEMISS Technology 人工與 AI 協力審閱。 · 回報權利疑慮 · 回到概覽