# Buildsheet autogenerated by ravenadm tool -- Do not edit. NAMEBASE= python-wcwidth VERSION= 0.2.6 KEYWORDS= python VARIANTS= py310 py311 SDESC[py310]= Measures number of terminal column cells (3.10) SDESC[py311]= Measures number of terminal column cells (3.11) HOMEPAGE= https://github.com/jquast/wcwidth CONTACT= Python_Automaton[python@ironwolf.systems] DOWNLOAD_GROUPS= main SITES[main]= PYPIWHL/20/f4/c0584a25144ce20bfcf1aecd041768b8c762c1eb0aa77502a3f0baa83f11 DISTFILE[1]= wcwidth-0.2.6-py2.py3-none-any.whl:main DF_INDEX= 1 SPKGS[py310]= single SPKGS[py311]= single OPTIONS_AVAILABLE= PY310 PY311 OPTIONS_STANDARD= none VOPTS[py310]= PY310=ON PY311=OFF VOPTS[py311]= PY310=OFF PY311=ON DISTNAME= wcwidth-0.2.6.dist-info GENERATED= yes [PY310].USES_ON= python:py310,wheel [PY311].USES_ON= python:py311,wheel [FILE:1433:descriptions/desc.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 *printible 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 [FILE:113:distinfo] 795b138f6875577cd91bba52baf9e445cd5118fd32723b460e30a0af30ea230e 29995 wcwidth-0.2.6-py2.py3-none-any.whl