Skip to content

Small fixes and refactor document structure/length - #246

Merged
jquast merged 9 commits into
masterfrom
jq/python-improvements
Sep 15, 2026
Merged

jquast merged 9 commits into
masterfrom
jq/python-improvements

Conversation

@jquast

@jquast jquast commented Sep 15, 2026 •

Copy link
Copy Markdown
Owner

This is a collection of low-priority fixes discovered while preparing the C11 'libwcwidth' library,

  • allow for text field as 'optional' for kitty text sizing protocol
  • ambiguous_width is now clamped to range 1-2
  • wrap('..', 0) now raises ValueError, matching std lib, textwrap.wrap()
  • Adds *.so to .gitignore, so that they do not leak in any next sdist

Further, the README.rst file has been refactored into file parts:

  • docs/changelog.rst
  • docs/developing.rst
  • docs/related.rst

The kitty text sizing protocol makes the 'text' field optional, 'ESC ] 66 ;
metadata [ ; text ] BEL/ST', but our pattern required the second ';', so a
metadata-only sequence such as '\x1b]66;w=5\x07' went unrecognized.  The text
group is now optional in both TEXT_SIZING_PATTERN and _SEQUENCE_CLASSIFY.

UAX #11 defines ambiguous width as 1 or 2, but values outside that range were
honored, so ambiguous_width=5 widened every ambiguous character by five cells.
Clamp instead, in wcwidth(), wcswidth(), wcstwidth(), width() and clip().

SequenceTextWrapper now raises ValueError for a width of zero or less, matching
stdlib textwrap.  This is a behavior change: wrap('女', 0) previously returned
['女'].
The hatchling sdist allowlist includes "/wcwidth/**" and hatchling honors
.gitignore, so locally built extension modules were swept into 'python -m build
--sdist' output, taking it from 1.4M to 2.7M.  The wheel is unaffected: the
extension reaches it from build_ext compiling ext_modules, not from source file
collection.
@codecov

codecov Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (c0dc90b) to head (5b38366).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #246   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           27        27           
  Lines         1983      1999   +16     
  Branches       464       467    +3     
=========================================
+ Hits          1983      1999   +16     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@codspeed

codspeed Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 108 untouched benchmarks


Comparing jq/python-improvements (5b38366) with master (c0dc90b)

Open in CodSpeed

@jquast jquast changed the title Collection of small fixes Small fixes and refactor document structure/length Sep 15, 2026
@jquast
jquast marked this pull request as ready for review September 15, 2026 10:46
@jquast
jquast merged commit d11cbea into master Sep 15, 2026
31 checks passed
@jquast
jquast deleted the jq/python-improvements branch September 15, 2026 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant