Skip to content

V2.0.0

Latest

Choose a tag to compare

@DevX-Dragon DevX-Dragon released this 16 Jul 14:49
banner

BetterQR v2.0.0 Release Log

This release focuses on critical fixes, performance enhancements, and new features for BetterQR.

Installation and Upgrade

To install or upgrade to BetterQR v2.0.0, use the following command:

pip install betterqr --upgrade

Breaking Changes

  • Payload Validation: WiFi/VCard/MeCard/SMS/etc. now use correctly-validated and escaped implementations. This means WEP passwords are now validated against real key-length rules (raising ValueError if invalid), and special characters (;, ,, \) in SSIDs/passwords are properly escaped. Code relying on previous lax validation may now encounter ValueError.

  • qr_type** Validation:** QR(data, qr_type=...) now strictly validates qr_type against ("standard", "micro"), raising ValueError for other inputs. Previously, qr_type="rmqr" crashed with a TypeError.

Critical Fixes

  • Reed-Solomon Block Table: Fixed 11 incorrect entries in the internal Reed-Solomon block table for standard QR codes at versions 30-40 and ECC level M. This resolves silent data corruption or decoding failures for large payloads. All 160 version/ECC-level combinations now match ISO/IEC 18004:2015 reference tables.

  • Micro QR Data Truncation: Corrected silent data truncation near capacity limits for Micro QR versions M1 and M3 (due to 4-bit nibble handling).

  • .logo()** KeyError:** Resolved KeyError when calling .logo() due to an internal dictionary key mismatch.

  • Duplicate Data Helper Implementations: Fixed duplicate WiFi/VCard/MeCard/SMS class definitions where less correct implementations silently shadowed properly-escaped ones.

  • Incorrect WEP Password Validator: Corrected the WEP password validator that previously rejected valid WEP keys.

  • Styled Micro QR Phantom Styling: Eliminated incorrectphantom "finder" styling in styled Micro QR codes.

  • Terminal compact Render Style: Corrected asymmetric padding and a stray extra row in the terminal compact render style.

  • qr_type="rmqr"** Implementation:** qr_type="rmqr" is now explicitly rejected with a clear error instead of crashing.

New Features

  • Micro QR Support: Introduced full support for Micro QR codes (M1-M4), including correct auto-version selection.

  • PDF and EPS Output: Added support for generating QR codes in PDF and EPS formats.

  • Kanji Mode: Introduced Kanji mode for standard QR codes, using 13 bits/character for Shift-JIS-encodable text.

  • ECI (UTF-8) Declaration: Added ECI (UTF-8) declaration for non-ASCII byte-mode payloads in standard QR codes for stricter spec compliance.

  • Structured Append: Implemented betterqr.structured_append() to split a message across up to 16 linked QR symbols (standard QR only).

  • betterqr.save()** Convenience Function:** Added betterqr.save(data, path, **style) for a one-liner save operation.

  • py.typed** Marker:** Included py.typed marker for improved type-checker support.

  • LogoECCWarning****: Added a visible warning when adding a logo silently raises the ECC level to H.

Performance Optimizations

  • Faster PNG Generation: PNG generation for common cases now builds images directly in indexed/palette mode, resulting in approximately 40% faster end-to-end generation.

  • Removed PNG optimize=True Default: Removed optimize=True from the default render path, as it doubled encode time for minimal file-size reduction.

  • Cached Mask-Pattern Grids: Mask-pattern grids are now cached, improving performance for batch generation of multiple QR codes at the same version.

  • Optimized Mask-Penalty Check: Rewrote the mask-penalty "Rule 3" pattern check using an integer rolling window for efficiency.

  • Efficient SVG Output: SVG output for plain square modules now uses integer path coordinates for whole-pixel geometry, leading to more compact files.

Enhanced Testing and Infrastructure

  • zxing-cpp** for Decode Verification:** Replaced pyzbar with zxing-cpp for decode verification, providing regression coverage for Micro QR codes.

  • Expanded Test Suite: Split the test suite into focused files (unit, generation smoke, decode round-trip, performance sanity), increasing total tests from ~56 to 172.

  • Comprehensive CI Coverage: CI now installs Ghostscript and cairosvg to decode-verify PDF/EPS/SVG output, in addition to PNG.

Full Changelog: v1.0.0...v2.0.0