Repository navigation
Conversation
bitstring 5.0.0 (2026-10-11) removed the old stream classes, and the unpinned `bitstring>=4.3.0` dependency resolves to 5.x on fresh installs, breaking `from bitstring import BitStream` in pdf_creater.py at import time. pdf_creater.py only relies on the write-side `.append()` semantics (no pos/read usage), and in 4.x BitStream is a subclass of BitArray (MRO: BitStream -> ConstBitStream -> BitArray -> Bits), so swapping to BitArray is behavior-identical on 4.x and forward-compatible with 5.x. Fixes funstory-ai#626 Co-Authored-By: Claude Code <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #626
bitstring 5.0.0 (released 2026-10-11) removed the old stream classes (
BitStream/ConstBitStream). The dependency is declared asbitstring>=4.3.0with no upper bound, so every fresh install now resolves to 5.x and crashes at import:Repo CI didn't catch this because it installs from
uv.lock(still pinned to 4.x).Fix
BitStream→BitArrayinpdf_creater.py(17 references, single file):.append()semantics — nopos/read/peekread-position API anywhere.BitStreamis a subclass ofBitArray(MRO:BitStream → ConstBitStream → BitArray → Bits), so the swap is behavior-identical there.BitArrayis the mutable class, i.e. the forward-compatible spelling.No version pin needed; compatible with both 4.x and 5.x.
Verification
Editable install of this branch, then the exact no-secret E2E from
checks.yml:test.zh.dual.pdf/test.zh.mono.pdfgeneratedruff checkon the changed file: clean🤖 Generated with Claude Code
Summary by cubic
Fixes the import crash on fresh installs caused by
bitstring5.0.0 removingBitStream. The filed only uses.append()write semantics, and since 4.xBitStreamis a subclass ofBitArray, the swap is behavior-identical on both versions. CI didn't catch this becauseuv.lockstill pins 4.x.Written for commit 2dfae1c. Summary will update on new commits.