Repository guide · overview · v1
psf / black
“The uncompromising Python code formatter” — as described by its authors
- CLI Tools
- Python
- MIT · open-source license
- Original repository
- psf/black
- Source platform
- GitHub
- Repository owner / organization
- psf
- License
- MIT · open-source license
- Analyzed revision
- 20622e1259c29bda81831962ace1348ba1921c84
- Last verified
Newer revision observed; parts of this guide may be outdated. The default branch moved to 5fe7881e6e40, checked 2026-10-03. The whole guide describes revision 20622e1259c2. A revision diff found changes in 6 code regions it cites (listed below); statements about those regions may not hold at the new revision and have not been rechecked yet.
- tests/test_black.py:171-2283 · lines changed
- tests/test_black.py:2681-3202 · lines changed
- src/black/__init__.py:554-776 · lines changed
- src/black/__init__.py:779-874 · lines changed
- src/black/linegen.py:110-735 · lines changed
- src/black/linegen.py:750-885 · lines changed
psf/black Repository Overview: Python Code Formatter Structure
Terms used on this page
- Entrypoint record
- A file the analyzer marks as a place where execution can start. When it carries a __main__ guard excerpt, the file contains an if __name__ == "__main__": block and the excerpt shows what that block calls; without an excerpt, the file was flagged by its name only.
- Bounded static execution path
- A call chain reconstructed from the source code without running it, stopped after a fixed number of steps. It shows how far the code can be followed on paper, not what happens at run time.
- Unresolved boundary
- Where a static path stops because the next call goes into an external library or cannot be resolved without running the code. It marks the edge of this analysis, not a defect in the repository.
- Static relations
- Calls and imports found in the source. "External or unresolved" relations point outside the analyzed files.
- Module role
- The analyzer's label for a file, inferred from how many calls go in and out (for example core, entry/orchestration, leaf). It describes a position in the call graph, not the authors' design.
- Test-like files
- Files whose names or locations look like tests. This analysis counts them; it does not run them.
- Observed · inferred · author-claimed · unresolved
- How each statement is supported: read directly from the analyzed files; derived by the analyzer from them; stated by the repository's authors (metadata, README); or not established by this analysis.
- Verified
- Two uses on these pages. In an analyzer record ("verified provenance", "a verified entrypoint") it means the record was read directly from the analyzed files, which these guides call observed; for an entrypoint, the __main__ guard text is present. Since the analyzer fix of 2026-10-04, a file that only has an entrypoint-like name such as cli.py or main.py is recorded as inferred; guides analyzed before that still call such a file verified, and it is still only a guess about how the file is used. It does not mean the code was run or tested. "Last verified" is the date the guide last passed the lab's checks against the analysis record of the stated revision; it is not a review of the repository itself.
A Python code formatter per its GitHub description, organized into src, tests, docs, and scripts subsystems. Static analysis covered 482 files and 9,339 relations, with 326 test-like files, but 8,487 relations remain unresolved, no execution path was run, and parsed dependency records are absent.
What this repository is
GitHub metadata describes this repository as "The uncompromising Python code formatter", and lists a documentation homepage at https://black.readthedocs.io/en/stable/. Its topic tags include python, formatter, codeformatter, and pre-commit-hook. Platform metadata reports Python as the primary language, with 5,440,093 Python bytes in the recorded language breakdown. The analysis processed 482 files and names action/main.py as a detected starting point. The recorded license is MIT. Counters recorded 41,844 stars (as of 2026-09-14) and a latest release 26.5.1 published 2026-05-18. The description and homepage are author-claimed values from the GitHub API; the topic, language, license, star, and release fields are observed platform records.
How execution starts
The analyzer flags action/main.py as a likely executable entrypoint based on a filename heuristic. Bounded execution paths traced from it reach os.getenv and Path and then stop at unresolved external boundaries, so the statically visible flow from that file is shallow. The main packages carry their own __main__ guards:
src/black/__init__.pyends withif __name__ == "__main__": patched_main()src/blackd/__init__.pyuses the samepatched_main()patternsrc/blib2to3/pgen2/driver.pyexits throughsys.exit(int(not main()))under its guardscripts/generate_schema.pycallsmain();scripts/release.pycallssys.exit(main())
In total the analysis records 18 entrypoints and 176 bounded execution paths.
Layout and hub modules
Four top-level directories are flagged as likely subsystems: docs, scripts, src, and tests. The recorded relation graph holds 9,339 edges — 8,219 calls and 1,120 imports — of which 8,487 are external or unresolved and 852 resolve locally. Role candidates are computed from statically resolved call degree:
src/black/linegen.py(79 incoming / 79 outgoing) andsrc/black/trans.py(66 / 66) are service/core candidates, consistent with hub-like formatting logic.tests/util.pyshows the highest incoming degree among listed roles (118 in / 18 out);tests/test_black.pyshows the highest outgoing degree (104 in / 177 out).src/black/__init__.pyis an entry/orchestration candidate (42 / 42);comments.py,nodes.py, andfiles.pyare moderate-degree service/core candidates.
Because most relations are unresolved, these degrees describe only the resolved local subset.
Dependency evidence and test surface
The repository contains 7 build/dependency manifest files. Dependency parsing in this analysis reads only requirements-style manifests and skips pyproject.toml dependency tables, so this packet itemizes no concrete dependency records. The tests directory supplies 326 test-like files.
On the test surface:
tests/test_black.pydefines BlackTestCase (lines 171-2283) plus the TestCaching, TestFileCollection, TestDeFactoAPI, and TestASTSafety classes.tests/util.pydefines shared helpers: assert_format, all_data_cases, and read_data.scripts/fuzz.pyruns test_idempotent_any_syntactically_valid_python under its__main__guard, and its comments describe optional coverage-guided fuzzing when Atheris is available.
A short reading order
README.mdandpyproject.toml— the analyzer classifies both as project-level important files. Treat README-derived statements as author claims, since extraction is line-based.LICENSE— the recorded license is MIT.src/black/__init__.py— read main() (lines 554-776), then get_sources() (779-874) and reformat_code() (877-904).src/black/linegen.py— LineGenerator (110-735) and transform_line (750-885) live here; by call degree this is a core candidate. So issrc/black/trans.py.action/main.py— the analyzer's flagged starting entrypoint, so it is a reasonable first stop.
What this analysis cannot establish
- 8,487 of the 9,339 recorded static relations are external or unresolved.
- Reflection, runtime dependency injection, dynamic imports, monkey-patching, generated code, framework runtime wiring, and dynamic dispatch are not resolved, so plugin-style loading through such mechanisms is not traced by this analysis.
- Install, run, and build inference is partial, and installation commands are unconfirmed.
- Dependency parsing covered only requirements-style manifests, so the declared dependency set is not itemized here.
- Every bounded execution path in the packet that starts at action/main.py terminates with reason unresolved_boundary; none was executed.
- The manifest's capability fields describe the analyzer itself, not the analyzed repository, and are excluded from repository evidence.
- The packet's directory listing includes a top-level
plugindirectory, but nothing in the packet establishes how it is discovered or loaded; this stays unresolved.
What this analysis could not establish
The writing model's own notes on the analysis record. Identifiers such as lim_3, exec_* or claim_… name records of that analysis; the claims table cites the same records.
- 8,487 of 9,339 static relations are external or unresolved, so call-degree figures describe only the 852 locally resolved edges.
- No concrete dependency records were parsed (requirements-style manifests only; pyproject.toml dependency tables skipped), so the declared dependency set is unknown from this packet.
- No entrypoint or execution path was executed; install, run, and build behavior is partially inferred and unconfirmed.
- Role labels such as 'service/core candidate' are analyzer inferences from resolved call degree, not confirmed responsibilities.
- The important-file list excludes 'readme.md' as a case variant not present in the analyzed inventory, so README-derived insight may be incomplete.
- The top-level 'plugin' and 'autoload' directories appear in the directory listing, but the packet contains no evidence about how either is loaded.
Claims and evidence — 38 claims, 38 supported by an independent verifier
Every statement above is a claim that cites grounding IDs from the analysis. IDs are internal to the analysis run; the columns show what each claim rests on and how strong that ground is.
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 GitHub repository metadata states the description "The uncompromising Python code formatter"; this is an author-claimed value from the GitHub API. | author_claimed | supported | analysis_f07f1c5b3429400e:meta_description |
| c2 The GitHub metadata lists the homepage https://black.readthedocs.io/en/stable/; author-claimed, not confirmed by the analysis. | author_claimed | supported | analysis_f07f1c5b3429400e:meta_homepage |
| c3 The repository's observed topic tags include python, formatter, codeformatter, and pre-commit-hook. | observed | supported | analysis_f07f1c5b3429400e:meta_topics |
| c4 Platform metadata reports Python as the primary language, with 5,440,093 Python bytes in the recorded language breakdown. | observed | supported | analysis_f07f1c5b3429400e:meta_primary_language, analysis_f07f1c5b3429400e:meta_language_bytes |
| c5 The analysis reports 482 analyzed files and names action/main.py as a detected starting point. | observed | supported | analysis_f07f1c5b3429400e:claim_227144a415af |
| c6 The recorded license for the repository is MIT. | observed | supported | analysis_f07f1c5b3429400e:meta_license |
| c7 Platform counters recorded 41,844 stars at 2026-09-14 and a latest release 26.5.1 published 2026-05-18. | observed | supported | analysis_f07f1c5b3429400e:meta_stars, analysis_f07f1c5b3429400e:meta_latest_release |
| c8 The analyzer flags action/main.py as a likely executable entrypoint based on a filename heuristic. | observed | supported | analysis_f07f1c5b3429400e:entry_1 |
| c9 Bounded execution paths traced from action/main.py reach os.getenv and Path and terminate at unresolved external boundaries, so this statically traced flow is shallow. | inferred | supported | analysis_f07f1c5b3429400e:exec_5daffbde25d6, analysis_f07f1c5b3429400e:exec_bfd58df29904 |
| c10 src/black/__init__.py contains a __main__ execution guard whose body calls patched_main(). | observed | supported | analysis_f07f1c5b3429400e:py_entry_fce0ce2b9b79 |
| c11 src/blackd/__init__.py contains a __main__ execution guard whose body calls patched_main(). | observed | supported | analysis_f07f1c5b3429400e:py_entry_479e85cc920d |
| c12 src/blib2to3/pgen2/driver.py contains a __main__ guard that exits through sys.exit(int(not main())). | observed | supported | analysis_f07f1c5b3429400e:py_entry_fae1962d2b1e |
| c13 scripts/generate_schema.py and scripts/release.py contain __main__ guards calling main() and sys.exit(main()) respectively. | observed | supported | analysis_f07f1c5b3429400e:py_entry_2d43f7cb959d, analysis_f07f1c5b3429400e:py_entry_8be0649f8947 |
| c14 The architecture reconstruction reports 18 entrypoints and 176 bounded execution paths; treat as inference. | inferred | supported | analysis_f07f1c5b3429400e:claim_31723c5d9328 |
| c15 The top-level directories docs, scripts, src, and tests are each flagged as likely subsystems. | observed | supported | analysis_f07f1c5b3429400e:subsys_1, analysis_f07f1c5b3429400e:subsys_2, analysis_f07f1c5b3429400e:subsys_3, analysis_f07f1c5b3429400e:subsys_4 |
| c16 The relation graph records 9,339 static relations (8,219 calls, 1,120 imports); 8,487 are external or unresolved and 852 resolve locally. | observed | supported | analysis_f07f1c5b3429400e:relation_counts |
| c17 src/black/linegen.py (79 incoming / 79 outgoing) and src/black/trans.py (66 / 66) are service/core candidates by statically resolved call degree, consistent with hub-like formatting logic. | inferred | supported | analysis_f07f1c5b3429400e:role_19, analysis_f07f1c5b3429400e:role_27 |
| c18 tests/util.py has the highest incoming degree among listed roles (118 in / 18 out), and tests/test_black.py the highest outgoing degree (104 in / 177 out). | inferred | supported | analysis_f07f1c5b3429400e:role_56, analysis_f07f1c5b3429400e:role_48 |
| c19 src/black/__init__.py is an entry/orchestration candidate (42 / 42); src/black/comments.py, src/black/nodes.py, and src/black/files.py are moderate-degree service/core candidates. | inferred | supported | analysis_f07f1c5b3429400e:role_11, analysis_f07f1c5b3429400e:role_14, analysis_f07f1c5b3429400e:role_21, analysis_f07f1c5b3429400e:role_17 |
| c20 The repository contains 7 build/dependency manifest files. | observed | supported | analysis_f07f1c5b3429400e:ev_manifest_1 |
| c21 Dependency parsing in this analysis reads only requirements-style manifests and does not parse pyproject.toml dependency tables, so the packet itemizes no concrete dependency records. | observed | supported | analysis_f07f1c5b3429400e:lim_3 |
| c22 The repository contains 326 test file(s) or test-like file(s). | observed | supported | analysis_f07f1c5b3429400e:ev_tests_1 |
| c23 tests/test_black.py defines BlackTestCase (lines 171-2283) plus the TestCaching, TestFileCollection, TestDeFactoAPI, and TestASTSafety classes. | observed | supported | analysis_f07f1c5b3429400e:py_class_cc5c0d3263dd, analysis_f07f1c5b3429400e:py_class_963874ffa66c, analysis_f07f1c5b3429400e:py_class_eecb79e09b7b, analysis_f07f1c5b3429400e:py_class_d305ef435760, analysis_f07f1c5b3429400e:py_class_cf2968890552 |
| c24 tests/util.py defines the shared helpers assert_format, all_data_cases, and read_data. | observed | supported | analysis_f07f1c5b3429400e:py_func_51a64879d62b, analysis_f07f1c5b3429400e:py_func_aa7b829266dd, analysis_f07f1c5b3429400e:py_func_43cfd58bc242 |
| c25 scripts/fuzz.py's __main__ guard runs test_idempotent_any_syntactically_valid_python, and its comments describe optional coverage-guided fuzzing when Atheris is available. | observed | supported | analysis_f07f1c5b3429400e:py_entry_45e63aec2981 |
| c26 The analyzer classifies README.md and pyproject.toml as project-level important files. | observed | supported | analysis_f07f1c5b3429400e:important_1, analysis_f07f1c5b3429400e:important_3 |
| c27 LICENSE is a project-level important file and the recorded license is MIT. | observed | supported | analysis_f07f1c5b3429400e:important_4, analysis_f07f1c5b3429400e:meta_license |
| c28 In src/black/__init__.py, read main() (lines 554-776), then get_sources() (779-874) and reformat_code() (877-904). | observed | supported | analysis_f07f1c5b3429400e:py_func_e9acdca9deb3, analysis_f07f1c5b3429400e:py_func_e9c2cf3b049c, analysis_f07f1c5b3429400e:py_func_05e93ec52b24 |
| c29 src/black/linegen.py contains LineGenerator (lines 110-735) and transform_line (750-885); linegen.py and trans.py are core candidates by call degree. | inferred | supported | analysis_f07f1c5b3429400e:py_class_b0018f23e219, analysis_f07f1c5b3429400e:py_func_fbd01883b450, analysis_f07f1c5b3429400e:role_19, analysis_f07f1c5b3429400e:role_27 |
| c30 Treat README-derived statements as author claims: extraction in this analyzer is line-based and may capture code lines instead of prose. | observed | supported | analysis_f07f1c5b3429400e:lim_4 |
| c31 action/main.py is the analyzer's flagged starting entrypoint, so it is a reasonable first stop. | observed | supported | analysis_f07f1c5b3429400e:entry_1 |
| c32 8,487 of the 9,339 recorded static relations are external or unresolved. | observed | supported | analysis_f07f1c5b3429400e:relation_counts |
| c33 Because reflection, dynamic imports, monkey-patching, generated code, framework runtime wiring, dynamic dispatch, and dependency injection are not resolved, plugin-style loading through such mechanisms is not traced by this analysis. | inferred | supported | analysis_f07f1c5b3429400e:lim_1 |
| c34 Install, run, and build inference is partial, and installation commands are unconfirmed. | observed | supported | analysis_f07f1c5b3429400e:lim_2 |
| c35 Dependency parsing covered only requirements-style manifests, so the declared dependency set is not itemized in this packet. | observed | supported | analysis_f07f1c5b3429400e:lim_3 |
| c36 The bounded execution paths that start at action/main.py all terminate with reason unresolved_boundary; none was executed. | inferred | supported | analysis_f07f1c5b3429400e:exec_bfd58df29904, analysis_f07f1c5b3429400e:exec_5daffbde25d6, analysis_f07f1c5b3429400e:exec_c1026a562fe1 |
| c37 The manifest's project.actual_capabilities / non_capabilities fields describe the analyzer, not the analyzed repository, and are excluded from repository evidence. | observed | supported | analysis_f07f1c5b3429400e:lim_5 |
| c38 The packet's directory listing includes a top-level 'plugin' directory, but nothing in the packet establishes how it is discovered or loaded; this is not established. | unresolved | supported | analysis_f07f1c5b3429400e:summary_repository |
Sources, rights and disclosure · attribution-license-templates/v0.1
Rights notice. 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.
Platform notice. 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.
How this page is produced. 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-assisted analysis. Reviewed by EVEMISS Technology through human–AI collaborative review. · Report a rights concern · All repository guides