Python bindings for wc(s)width
Project description
Python bindings for wc(s)width
cwcwidth
provides Python bindings for wcwidth
and wcswidth
functions defined in POSIX.1-2001
and POSIX.1-2008 based on Cython. These functions compute the printable
length of a unicode character/string on a terminal. The module provides the same functions as
wcwidth and its behavior is compatible.
On systems not conforming to POSIX.1-2001 and POSIX.1-2008, Markus Kuhn's implementation is used to provide the functionality.
Dependencies
Cython >= 0.28
(optional, only for building). If Cython is not available, the C files are not regenerated from their source.
Quick installation guide
cwcwidth
can be installed via pip
:
pip install cwcwidth
or by running:
python3 setup.py install
Usage
>>> import cwcwidth
>>> cwcwidth.wcwidth("a")
1
>>> cwcwidth.wcswidth("コ")
2
>>> cwcwidth.wcswidth("コンニチハ, セカイ!")
19
>>> cwcwidth.wcswidth("コンニチハ, セカイ!", 5)
10
Comparison with wcwidth
>>> import wcwidth, cwcwidth, timeit
>>> timeit.timeit(lambda: wcwidth.wcswidth("コンニチハ, セカイ!"))
19.14463168097427
>>> timeit.timeit(lambda: cwcwidth.wcswidth("コンニチハ, セカイ!"))
0.16294104099506512
License
The code is licensed under the MIT license.
Tidelift
Security contact information
To report a security vulnerability, please use the Tidelift security contact. Tidelift will coorindate the fix and disclosure.
Commercial support
cwcwidth and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source packages you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use. Learn more.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file cwcwidth-0.1.5.tar.gz
.
File metadata
- Download URL: cwcwidth-0.1.5.tar.gz
- Upload date:
- Size: 11.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c840e7d85f6de45c45986b416d79312c91882e1121b78d4c347e49c4238c09d |
|
MD5 | 4e0a6e8f7eca3e463c296d6a9a08bdb7 |
|
BLAKE2b-256 | 3817aadd0c6190dca91aa27c4d7e84d69d30fdf4966e7764247cdc395f8fe7d9 |
File details
Details for the file cwcwidth-0.1.5-cp39-cp39-win_amd64.whl
.
File metadata
- Download URL: cwcwidth-0.1.5-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 20.8 kB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23fa1021135b8b99e9d4478097ce42aaa17d957c037d5a76e990de20262d76d4 |
|
MD5 | e117505b5544225273005ac853abb312 |
|
BLAKE2b-256 | 70665be45aa28aa8c20928f17f998677284923181a167937fe8abfa1b68e798d |
File details
Details for the file cwcwidth-0.1.5-cp39-cp39-win32.whl
.
File metadata
- Download URL: cwcwidth-0.1.5-cp39-cp39-win32.whl
- Upload date:
- Size: 18.5 kB
- Tags: CPython 3.9, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9321274eca7fd4323a3f0eb472d08a08dfa7e2e0d797b713167d5106e41c92ad |
|
MD5 | 668f95e0a415539a89e04690d3cbfe0a |
|
BLAKE2b-256 | b2414303c83b149151e72a2f19f10d432b7e246fe15d15d1ba2fd1a71b49550b |
File details
Details for the file cwcwidth-0.1.5-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
.
File metadata
- Download URL: cwcwidth-0.1.5-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
- Upload date:
- Size: 56.2 kB
- Tags: CPython 3.9, manylinux: glibc 2.12+ x86-64, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1dc35642fd1a26ce63236c18d7d4a32909be2b1e99b272be95859872f97d1d28 |
|
MD5 | ade3c4eae460fa4f151d206f311acfd0 |
|
BLAKE2b-256 | 78544c74428128f2bf6fd1a0dd2c35ba65b9cc4f4c5aa49917c501306bd818cc |
File details
Details for the file cwcwidth-0.1.5-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl
.
File metadata
- Download URL: cwcwidth-0.1.5-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl
- Upload date:
- Size: 54.4 kB
- Tags: CPython 3.9, manylinux: glibc 2.12+ i686, manylinux: glibc 2.5+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 66addcb77a16d3e1ab817bea337ffb2509c57af6d91f5515c37811b081e7a448 |
|
MD5 | 0f1220cf41353907d9a377a9087efb91 |
|
BLAKE2b-256 | 945d4f211894bd536074da16ea09e9cf2fa8ea4048a5d0fbfa3cd014cd97d589 |
File details
Details for the file cwcwidth-0.1.5-cp39-cp39-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: cwcwidth-0.1.5-cp39-cp39-macosx_10_9_x86_64.whl
- Upload date:
- Size: 15.3 kB
- Tags: CPython 3.9, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 21701b63cc4e287a197e65c033583bbea674ec7176f983c5fff77fa82118d440 |
|
MD5 | c451e437424496daa509c54bda57c7ed |
|
BLAKE2b-256 | 57affcda94f8584610ad54077375fe06245b62fd0ce0dd0b0565e483b6205101 |
File details
Details for the file cwcwidth-0.1.5-cp38-cp38-win_amd64.whl
.
File metadata
- Download URL: cwcwidth-0.1.5-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 20.9 kB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b05739a439f815c85b47abfb3fea301354762950142539d13263a353f21a90f6 |
|
MD5 | b0505c88e54d93ad88d4705b8aaf3872 |
|
BLAKE2b-256 | 5b65bb2a576cfc7fdfb6efededa171d6458db2f19bdc19c21643faa735e5f13e |
File details
Details for the file cwcwidth-0.1.5-cp38-cp38-win32.whl
.
File metadata
- Download URL: cwcwidth-0.1.5-cp38-cp38-win32.whl
- Upload date:
- Size: 18.6 kB
- Tags: CPython 3.8, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3fe12ba738548ff5ad3081621d22b7bff97fa78258c44a6586e97ec4f1430739 |
|
MD5 | 7a009c6f97532c48376fa5abdb5d3fd5 |
|
BLAKE2b-256 | 5caa0f3a287f893c00c976100a6fa54fdc3b6432466e897b1b6b55c591ad0bfe |
File details
Details for the file cwcwidth-0.1.5-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
.
File metadata
- Download URL: cwcwidth-0.1.5-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
- Upload date:
- Size: 56.6 kB
- Tags: CPython 3.8, manylinux: glibc 2.12+ x86-64, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f57a3784c799553a67d5ebc2c4854d4cc95e8c2c01f10861b97a0a829c09c36e |
|
MD5 | ad9fb6bd29cbfddd40d4a881c11d4653 |
|
BLAKE2b-256 | 4b5ef6c923d14afa76ccdbec4df5de71bc35dad5ca60b8d5ed2184fb21bc81da |
File details
Details for the file cwcwidth-0.1.5-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl
.
File metadata
- Download URL: cwcwidth-0.1.5-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl
- Upload date:
- Size: 55.1 kB
- Tags: CPython 3.8, manylinux: glibc 2.12+ i686, manylinux: glibc 2.5+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6385cfdb3f0cfd4f42ab73d2c965e8f133f4f78ad56a7495f6e5924165a6c73 |
|
MD5 | 4499dbe290e7d8b3dc1a2cc9c255a009 |
|
BLAKE2b-256 | 51525e8867303c25f7d76147bbb87e53b39f532692c72ae840eec59a644b9681 |
File details
Details for the file cwcwidth-0.1.5-cp38-cp38-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: cwcwidth-0.1.5-cp38-cp38-macosx_10_9_x86_64.whl
- Upload date:
- Size: 15.4 kB
- Tags: CPython 3.8, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a25161e4302413b8b4c3379b29c1adcbe04c05380a6dfc8e4eb0e3938e4b3f9 |
|
MD5 | ed85d91ff81d973ccb3b07948c0b3629 |
|
BLAKE2b-256 | 5ae5afafaf7e5be71cecee8901b2d91008e81424d75dd4b9da597175c5d44e5e |
File details
Details for the file cwcwidth-0.1.5-cp37-cp37m-win_amd64.whl
.
File metadata
- Download URL: cwcwidth-0.1.5-cp37-cp37m-win_amd64.whl
- Upload date:
- Size: 20.6 kB
- Tags: CPython 3.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 106efcbe26c495720cdfd4694e4c191ce1a3c1268b2d90356c875fd109d78a46 |
|
MD5 | 1843b842611d647268d18547799f752b |
|
BLAKE2b-256 | 263c1a0223614616cd601ab211f4532c612b09cc0947ec9c211e54224d5846f0 |
File details
Details for the file cwcwidth-0.1.5-cp37-cp37m-win32.whl
.
File metadata
- Download URL: cwcwidth-0.1.5-cp37-cp37m-win32.whl
- Upload date:
- Size: 18.3 kB
- Tags: CPython 3.7m, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c3ab17f0ee34d71b7de12d543eb40f1a6aae9339c9221b96b06970e6299bd10 |
|
MD5 | 27ecb153406b95e6580812e12c571513 |
|
BLAKE2b-256 | 3e51961876b4365dd1a0f75a1dca079380a8472acc064d37da88a1513e990c4c |
File details
Details for the file cwcwidth-0.1.5-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
.
File metadata
- Download URL: cwcwidth-0.1.5-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
- Upload date:
- Size: 54.3 kB
- Tags: CPython 3.7m, manylinux: glibc 2.12+ x86-64, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 268775831c952d45cf8165bc9168585868e933a87b72f6f1bd35230ad5206f1f |
|
MD5 | b7a7298722572ea10e034505e95bd287 |
|
BLAKE2b-256 | d0641b30977919542f1b84def27dfb59ba98ff1186e06473a2e567df1940010c |
File details
Details for the file cwcwidth-0.1.5-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl
.
File metadata
- Download URL: cwcwidth-0.1.5-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl
- Upload date:
- Size: 52.9 kB
- Tags: CPython 3.7m, manylinux: glibc 2.12+ i686, manylinux: glibc 2.5+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae134791ea6024bc0397f6b6a15d398f31167ad4b71190278e9c02178dad6948 |
|
MD5 | b5794b927c4503719baad578f94e1aaa |
|
BLAKE2b-256 | a0e6d66c3160a13b9fa478b7d9bea89da996260c1ea8b53f2ebba39eaf9f3289 |
File details
Details for the file cwcwidth-0.1.5-cp37-cp37m-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: cwcwidth-0.1.5-cp37-cp37m-macosx_10_9_x86_64.whl
- Upload date:
- Size: 15.2 kB
- Tags: CPython 3.7m, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f1777c325f7153b4e430d540a3ae2e8595b8117c10e5e3c2f65862af95ff94f5 |
|
MD5 | 75e5fb46804a37df7be5b689aff654ad |
|
BLAKE2b-256 | b063272cfd2abd0e041c0e0bb1de4c256e89b8d55a216fca5f0ef89f6a16b1d9 |
File details
Details for the file cwcwidth-0.1.5-cp36-cp36m-win_amd64.whl
.
File metadata
- Download URL: cwcwidth-0.1.5-cp36-cp36m-win_amd64.whl
- Upload date:
- Size: 20.5 kB
- Tags: CPython 3.6m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 672b0d4b9d39642c023a80daf4a8623b3aa63a31275c20f705569e3b50021b06 |
|
MD5 | d16f7c2f1740aa3c7aeb54f70dbc4744 |
|
BLAKE2b-256 | 327a2aed1bc5715c8d5a4032c3b7535756ae7cd1b107e8ad1dd55165f7cce050 |
File details
Details for the file cwcwidth-0.1.5-cp36-cp36m-win32.whl
.
File metadata
- Download URL: cwcwidth-0.1.5-cp36-cp36m-win32.whl
- Upload date:
- Size: 18.2 kB
- Tags: CPython 3.6m, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d3dc22afbaeba3b3a168e6a15e194d55fb63f01720feee53051b62f0f1c6165f |
|
MD5 | b4980df29217887e472c90c1b5cd313f |
|
BLAKE2b-256 | 987dc14910327cad718385771b41d7d83b43c066326d79e648a2e09f1d8b0635 |
File details
Details for the file cwcwidth-0.1.5-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
.
File metadata
- Download URL: cwcwidth-0.1.5-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
- Upload date:
- Size: 53.1 kB
- Tags: CPython 3.6m, manylinux: glibc 2.12+ x86-64, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6a1b285655c7c86ceebe241f722fe19ccdef4891f7dced8cd818c966b6bb9d9 |
|
MD5 | 42a7ef46c9dc055aa712d8e6950f69cb |
|
BLAKE2b-256 | 8853ffb76561f3d77d37091e6b5accb2827b5d6cf3bd9339ed75849623c270a9 |
File details
Details for the file cwcwidth-0.1.5-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl
.
File metadata
- Download URL: cwcwidth-0.1.5-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl
- Upload date:
- Size: 51.6 kB
- Tags: CPython 3.6m, manylinux: glibc 2.12+ i686, manylinux: glibc 2.5+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 77c0492c65555dfd022635ffc83365bbf2b15e95fde030b95ee9b2409ce98909 |
|
MD5 | 98353f8063a6bfaa8bcb33dc26f351c1 |
|
BLAKE2b-256 | 65e78d5e0df43e33a3c2c31388d94dd2e45602a14f756ec78450d2537af85eef |
File details
Details for the file cwcwidth-0.1.5-cp36-cp36m-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: cwcwidth-0.1.5-cp36-cp36m-macosx_10_9_x86_64.whl
- Upload date:
- Size: 15.2 kB
- Tags: CPython 3.6m, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6fbbdbc742d78d732f0cfd3f69672f3805ec6c766f14460f8c392f624ea7af09 |
|
MD5 | 0189dc1b17d25bd1c7a16ce59005ea14 |
|
BLAKE2b-256 | 60c07a482e907e58c5f6feaa29c661436e8736da732694ae437ae2d004928fe5 |