contrib: Convert check-deps.sh to Python #37023

Open
jeanpablojp wants to merge 4 commits from check-deps-python into master AGit
jeanpablojp commented 2026-11-30 22:55:36 +00:00 (Migrated from github.com)

This picks up #35167.

check-deps.py reads the allowed library dependencies from the mermaid graph in doc/design/libraries.md and follows them transitively, so the graph can drop its transitive edges and the script no longer keeps its own copy of the list. Compared to check-deps.sh, it also checks data symbols, and it runs on macOS, where the shell script needs bash 4.

Changes compared to #35167, most of them from ryanofsky's review and the branch he shared there.

  • The edges #35167 added to the graph, from consensus to util and from qt to cli, node and wallet, are gone.
  • init/common.cpp stays in common, and interface_ui moves there from node. It's the same move as in #30437.
  • Build output is shown, and a target that fails to build or a library archive that is missing is an error instead of a warning.
  • The script fails when it reads no symbols from a library or can't parse a line of the graph, instead of reporting success.
  • On macOS, the script reads the symbols nm reports as type S and drops the extra leading underscore of Mach-O names before matching suppressions.

On whether libraries.md can be the source of truth (https://github.com/bitcoin/bitcoin/pull/35167#issuecomment-4337200918), check-deps.sh already took its list from that file. Where the build doesn't match the graph yet, check-deps.py skips the library or suppresses the symbols, and says why in a comment.

This picks up #35167. `check-deps.py` reads the allowed library dependencies from the mermaid graph in `doc/design/libraries.md` and follows them transitively, so the graph can drop its transitive edges and the script no longer keeps its own copy of the list. Compared to `check-deps.sh`, it also checks data symbols, and it runs on macOS, where the shell script needs bash 4. Changes compared to #35167, most of them from ryanofsky's review and the branch he shared there. - The edges #35167 added to the graph, from consensus to util and from qt to cli, node and wallet, are gone. - `init/common.cpp` stays in common, and `interface_ui` moves there from node. It's the same move as in #30437. - Build output is shown, and a target that fails to build or a library archive that is missing is an error instead of a warning. - The script fails when it reads no symbols from a library or can't parse a line of the graph, instead of reporting success. - On macOS, the script reads the symbols `nm` reports as type `S` and drops the extra leading underscore of Mach-O names before matching suppressions. On whether `libraries.md` can be the source of truth (https://github.com/bitcoin/bitcoin/pull/35167#issuecomment-4337200918), `check-deps.sh` already took its list from that file. Where the build doesn't match the graph yet, `check-deps.py` skips the library or suppresses the symbols, and says why in a comment.
DrahtBot commented 2026-11-30 22:55:47 +00:00 (Migrated from github.com)

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

External sites

Reviews

See the guideline and AI policy for information on the review process.
A summary of reviews will appear here.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #37094 (validation: validate assumeutxo snapshots with a single chainstate by fjahr)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

<!--e57a25ab6845829454e8d69fc972939a--> The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. <!--006a51241073e994b41acfe9ec718e94--> ### External sites * Code coverage & benchmarks: https://corecheck.dev/bitcoin/bitcoin/pulls/37023 * Ralph review <img src=https://review.fish.foo/assets/bitcoin/bitcoin/37023.png alt="Ralph review status"> https://git.fish.foo/bitcoin/bitcoin/pulls/37023#author-ralph <!--021abf342d371248e50ceaed478a90ca--> ### Reviews See [the guideline](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#code-review) and [AI policy](https://github.com/bitcoin/bitcoin/blob/master/doc/AI_POLICY.md) for information on the review process. A summary of reviews will appear here. <!--174a7506f384e20aa4161008e828411d--> ### Conflicts Reviewers, this pull request conflicts with the following ones: * [#37094](https://github.com/bitcoin/bitcoin/pull/37094) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/37094.svg"></sub> (validation: validate assumeutxo snapshots with a single chainstate by fjahr) If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. <!--5faf32d7da4f0f540f40219e4f7537a3-->
First-time contributor

🔵 Suggestion · Missing negative tests leave import-parsing failures undetected

No test checks that check-deps.py rejects a forbidden dependency when parsing imports; no current platform is known to drop U lines.

Location: contrib/devtools/check-deps.py:208 (head).

🔵 Suggestion · Fail-fast guards are separated from the checker conversion

The final tree has both guards, but the conversion commit must be reviewed without its checks for unparsed library edges and empty symbol results.

Location: contrib/devtools/check-deps.py:71 (commit).

🔵 Suggestion · Stale documentation creates a temporary wallet_tool exclusion

Removing the obsolete libbitcoin_wallet_tool documentation before the conversion would avoid a temporary checker exception and separate that correction from the transitive-edge cleanup.

Location: contrib/devtools/check-deps.py:60 (commit).

Review coverage was incomplete.


Reviewed: f86744cdd7b9 · Review report · Previous reports

permalink

<!-- forgejo-review-bot:bitcoin/bitcoin --> <!-- ralph-engine:current:312ddb2095238aa2ca395a9cc39b05ab5a38a7177afbdb0d69098df9c3e0bef9:9a7f127b15c6116c267953d38288a9f17ec7c7bcd3a975fb71a2db8bfd974dbf --> <!-- ralph-base:1ea904d983f8841c28cb8240c576e46ac2efe529 --> <!-- ralph-head:f86744cdd7b9c9e4cd4b18714ebb2c8687144925 --> <!-- ralph-case:13818db8d951d65c214bcba0a1a54fc500abfc0e6153783c6323ae9be8606c51 --> **🔵 Suggestion · Missing negative tests leave import-parsing failures undetected** No test checks that `check-deps.py` rejects a forbidden dependency when parsing imports; no current platform is known to drop `U` lines. Location: [`contrib/devtools/check-deps.py:208`](<https://git.fish.foo/bitcoin/bitcoin/src/commit/f86744cdd7b9c9e4cd4b18714ebb2c8687144925/contrib/devtools/check-deps.py#L208>) (head). **🔵 Suggestion · Fail-fast guards are separated from the checker conversion** The final tree has both guards, but the conversion commit must be reviewed without its checks for unparsed library edges and empty symbol results. Location: contrib/devtools/check-deps.py:71 (commit). **🔵 Suggestion · Stale documentation creates a temporary `wallet_tool` exclusion** Removing the obsolete `libbitcoin_wallet_tool` documentation before the conversion would avoid a temporary checker exception and separate that correction from the transitive-edge cleanup. Location: contrib/devtools/check-deps.py:60 (commit). Review coverage was incomplete. <!-- Review tier: standard --> --- Reviewed: [`f86744cdd7b9`](<https://git.fish.foo/bitcoin/bitcoin/commit/f86744cdd7b9c9e4cd4b18714ebb2c8687144925>) · [Review report](<https://review.fish.foo/report/37023-f86744cdd7b9c9e4cd4b18714ebb2c8687144925-3367-1.html>) · [Previous reports](<https://review.fish.foo/traces/37023/>) [permalink](<https://review.fish.foo/report/37023-f86744cdd7b9c9e4cd4b18714ebb2c8687144925-3367-1.html>)
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
bitcoin/bitcoin!37023
No description provided.