python-wcwidth
Port variant v12
Summary Measures number of terminal column cells (3.12)
BROKEN
Package version 0.2.13
Homepage https://github.com/jquast/wcwidth
Keywords python
Maintainer Python Automaton
License Not yet specified
Other variants v13
Ravenports Buildsheet | History
Ravensource Port Directory | History
Last modified 11 NOV 2024, 23:28:05 UTC
Port created 22 APR 2020, 01:22:25 UTC
Subpackage Descriptions
single |pypi_downloads| |codecov| |license| ============ Introduction ============ This library is mainly for CLI programs that carefully produce output for Terminals, or make pretend to be an emulator. **Problem Statement**: The printable length of *most* strings are equal to the number of cells they occupy on the screen ``1 character : 1 cell``. However, there are categories of characters that *occupy 2 cells* (full-wide), and others that *occupy 0* cells (zero-width). **Solution**: POSIX.1-2001 and POSIX.1-2008 conforming systems provide `wcwidth(3)`_ and `wcswidth(3)`_ C functions of which this python module's functions precisely copy. *These functions return the number of cells a unicode string is expected to occupy.* Installation ------------ The stable version of this package is maintained on pypi, install using pip:: pip install wcwidth Example ------- **Problem**: given the following phrase (Japanese), >>> text = u'コンニチハ' Python **incorrectly** uses the *string length* of 5 codepoints rather than the *printable length* of 10 cells, so that when using the `rjust` function, the output length is wrong:: >>> print(len('コンニチハ')) 5 >>> print('コンニチハ'.rjust(20, '_')) _______________コンニチハ By defining our own "rjust" function that uses wcwidth, we can correct this:: >>> def wc_rjust(text, length, padding=' '): :alt: MIT License
Configuration Switches (platform-specific settings discarded)
PY312 ON Build using Python 3.12 PY313 OFF Build using Python 3.13
Package Dependencies by Type
Build (only) python312:dev:std
python-pip:single:v12
autoselect-python:single:std
Build and Runtime python312:primary:std
Download groups
main mirror://PYPIWHL/fd/84/fd2ba7aafacbad3c4201d395674fc6348826569da3c0937e75505ead3528
Distribution File Information
3da69048e4540d84af32131829ff948f1e022c1c6bdb8d6102117aac784f6859 34166 wcwidth-0.2.13-py2.py3-none-any.whl
Ports that require python-wcwidth:v12
python-prompt-toolkit:v12 Builds powerful interactive command lines (3.12)
python-xml2rfc:v12 Request For Comment authoring with XML (3.12)