Repository navigation
imports_test keeps btclib free of bip32_descriptors imports (closes #2887) - #2909
Conversation
…tclib-org#2887) `tests/imports_test.py` checked that btclib imports nothing of `btclib_wallet`, but not of `bip32_descriptors`, which depends on btclib as well. `_is_btclib_or_wallet` now matches `bip32_descriptors` names too, and the slab check counts the package among its roots, so a planted `import bip32_descriptors.bip32` in `src/btclib` fails `test_the_application_slab_has_no_inbound_edge`. The scan test plants imports of both packages and is renamed `reads_every_name`, since it reads more than two names now. Signed-off-by: dodoshell <326978213+dodoshell@users.noreply.github.com>
|
Claimed: a /btclib-pr session of @pmazzocchi is reviewing this pull request locally before deciding on its approval. |
pmazzocchi
left a comment
There was a problem hiding this comment.
Thank you for this: the test change is right and meets ISS #2887's Done when, and two sentences elsewhere need to follow it before it can land.
A local review ran the test as written against a planted import bip32_descriptors.bip32 in src/btclib/alias.py: your version fails it and main's passes it, and seven other import shapes (an alias, from … import *, a TYPE_CHECKING block, a function-local import, among them) fail it too. CI is green on this head.
The diff now makes test_the_application_slab_has_no_inbound_edge hold the bip32_descriptors direction as well, but ARCHITECTURE.md still lists only the edge to btclib_wallet as held by a test (the Layers paragraph, "the edge to btclib_wallet below, each held by a test", and the bip32-descriptors bullet under What sits outside the package, which says only "It imports btclib."), and ASSURANCE_CASE.md's Layering bullet names only btclib_wallet. A reader of those files concludes nothing holds the descriptors edge. The fix is to name both packages in the three places, for example "the edges to bip32_descriptors and btclib_wallet below" and "It imports btclib, and nothing in btclib imports it: tests/imports_test.py holds that edge to one direction.", refilling each paragraph.
The two new comments in tests/imports_test.py say bip32/ and descriptors/ "have since moved on to" and "moved to" bip32_descriptors. btclib-wallet's main still ships both packages, and btclib-org/.github#1811 is open, so the move is not done; the tree's prose also avoids history. Something true before and after the move would read "bip32_descriptors publishes bip32/ and descriptors/" and "the import package that publishes bip32/ and descriptors/ (btclib-org/.github#1811)". A smaller point: _is_btclib_or_wallet now also answers for bip32_descriptors, so a name such as _is_btclib_or_slab would read better.
|
Released: the /btclib-pr session hands this back to its author, with the review above. |
…beside btclib_wallet (issue btclib-org#2887) Signed-off-by: dodoshell <326978213+dodoshell@users.noreply.github.com>
|
Thanks, all three places now name both packages, the two comments say what |
fametrano
left a comment
There was a problem hiding this comment.
Approves 7c6002b, on the maintainer's decision of 2026-11-04.
Codex, as the fresh reviewer, cleared 7c6002b with no findings, and read the added prose on the merge with main. Every point of @pmazzocchi's review is answered in 7c6002b. Every check passed; the review bot does not run on a fork's pull request, so there is no ACK. No thread is open, the diff touches nothing under .github/, and it merges cleanly with main. Not checked: a planted import against the real tree, which the pull request's body and the earlier review report.
|
Thank you, @dodoshell: this is on
Nothing was added on our side. Your second commit answered every point of the earlier review: the predicate's new name, the two test comments, and the three passages in ARCHITECTURE.md and ASSURANCE_CASE.md. One thing the test does not catch, here or on |
What this changes
tests/imports_test.pynow keeps btclib free ofbip32_descriptorsimports, as it already did forbtclib_wallet.bip32_descriptorsdepends on btclib too, so an import of it fromsrc/btclibwould be a cycle the suite let through._is_btclib_or_walletalso matchesbip32_descriptors, andtest_the_application_slab_has_no_inbound_edgecounts it among the slab roots. The scan test plantsimport bip32_descriptors.bip32andfrom bip32_descriptors import descriptorsbeside thebtclib_walletones; it reads more than two names now, so it is renamedtest_the_application_slab_scan_reads_every_name.Closes #2887
How it was verified
import bip32_descriptors.bip32appended tosrc/btclib/alias.py:test_the_application_slab_has_no_inbound_edgefails with{'alias.py': ['bip32_descriptors.bip32']}; the same plant with main'stests/imports_test.pypasses. Plant reverted.uv run pytest: 24443 passed, 102 skipped, coverage 100.00%.Checks
uv run pre-commit run --all-filesis clean (ruff, mypy strict,markdownlint, the copyright notice,
uv.lock)uv run pytestpassesanswer a review of it without the model
The pre-commit box is unticked because the hook set can't run in full on my Windows machine: the hooks that check Python files pass, and the markdown and line-ending hooks are left to CI.
Summary by CodeRabbit
btclib.