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.
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
cwcwidth-0.1.9.tar.gz
(57.9 kB
view hashes)
Built Distributions
Close
Hashes for cwcwidth-0.1.9-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 40466f16e85c338e8fc3eee87a8c9ca23416cc68b3049f68cb4cead5fb8b71b3 |
|
MD5 | e242b206aecaf8af4aede994069a8c1c |
|
BLAKE2b-256 | bea2462eebec8f0aa88751de678cbcdecd8b36ddf1ad05c25662541ef3e4455b |
Close
Hashes for cwcwidth-0.1.9-cp312-cp312-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba9da6c911bf108334426890bc9f57b839a38e1afc4383a41bd70adbce470db3 |
|
MD5 | 1bb52d60884ea892accf54dec1f259b9 |
|
BLAKE2b-256 | 4813069554f659482f967cc380cac46f12a4cd2d55561a5f3dd0aebe900029ab |
Close
Hashes for cwcwidth-0.1.9-cp312-cp312-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b4f7d24236ce3c9d3b5e07fd75d232452f19bdddb6ae8bbfdcb97b6cb02835e8 |
|
MD5 | 5560eaadea24b5e2c2bf00ef47e5fd0d |
|
BLAKE2b-256 | 6be169ff02feb0b10467b9fd0097650b1e4b6e0a2ad1ca32bcd1f936d18b27d8 |
Close
Hashes for cwcwidth-0.1.9-cp312-cp312-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6e0e023c4b127c47fd4c44cf537be209b9a28d8725f4f576f4d63744a23aa38 |
|
MD5 | 703b78fa1ac11e35999c748d7a01fe2c |
|
BLAKE2b-256 | 887c5f84b644834e1a9ca41f7575bbace15f947fa46c1349b90f179843b47bc2 |
Close
Hashes for cwcwidth-0.1.9-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fdbaf0a8dad20eb685df11a195a2449fe230b08a5b356d036c8d7e59d4128a88 |
|
MD5 | b8298d878f6835477cde12a9bb89d2f0 |
|
BLAKE2b-256 | fb070389633bd61619000563a72d11387d98290cd1231ad3cfec964a845e0256 |
Close
Hashes for cwcwidth-0.1.9-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 877e48c615b3fec88b7e640f9cf9d96704497657fb5aad2b7c0b0c59ecabff69 |
|
MD5 | 0916ed14a01b80c89ebccc6e30309a33 |
|
BLAKE2b-256 | 766a00c1944f27116c1846ea3e84cc2f5d8711b213712d7e06183f1c49162fc3 |
Close
Hashes for cwcwidth-0.1.9-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 42de102d5191fc68ef3ff6530f60c4895148ddc21aa0acaaf4612e5f7f0c38c4 |
|
MD5 | 42c3238b324caa7a0d087a79f8dc4212 |
|
BLAKE2b-256 | 100169a81a655ace57ce1423470ca29661a6821b66645ad4089e03d362a5c349 |
Close
Hashes for cwcwidth-0.1.9-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa6725e7b3571fdf6ce7c02d1dd2d69e00d166bb6df44e46ab215067028b3a03 |
|
MD5 | bb3043bf3dd1f1cc49329e727d8173f4 |
|
BLAKE2b-256 | c1462adf6b8e92b71a814e93a236d9eefc7a4b421dfc1e0d617f07c7672b9480 |
Close
Hashes for cwcwidth-0.1.9-cp311-cp311-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6ba88970ec12fdbed5554beb1b9a25d8271fc3d0d9e60639db700a79bed1863 |
|
MD5 | ad4b33d06b24b348ed75f47694e52f82 |
|
BLAKE2b-256 | 8c69b6e82b450bbc4c2a111144e4b4d96eba9bbfabcad1fe69422b10d3cbea93 |
Close
Hashes for cwcwidth-0.1.9-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f96386cc29e6eef8ef066d7dd3c767c5119d66506dabea20dd344dabb3f2d225 |
|
MD5 | 54f68175fd52f58a8953da1703c020d4 |
|
BLAKE2b-256 | ca643368099065dc1f627bd1e50cdc9de7568321fa030115157534c854ba8796 |
Close
Hashes for cwcwidth-0.1.9-cp311-cp311-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca9a653661e152a426bdb51a272f36bc79f9830e6a7169abe8110ec367c3518c |
|
MD5 | e40751514ae722c4f58acfbd236127e8 |
|
BLAKE2b-256 | b18345e46256f4ab27e4f6fc5ad97148a48b8fa69fc4a939eec88e5aa4930b14 |
Close
Hashes for cwcwidth-0.1.9-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 368ace13080dbaacdc247370d8a965a749b124aa50d0b1b6eb87601826db870f |
|
MD5 | 8c6b0d2eeb02f07908458264a6ff97fd |
|
BLAKE2b-256 | 22ae8b86fbcfda216908e93eb8373f35914b56b8723781357679b45a9c7645a5 |
Close
Hashes for cwcwidth-0.1.9-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c8752815ce4e40e7b34b7fe039276a5fbfb1b077131614381b13ef3b7bb21ff |
|
MD5 | 24af8c07dc7477d09404a13ab025d5bc |
|
BLAKE2b-256 | b3d91f646f04afb38bc9aaea3510586246c5e12a5d060a54dd6e061728f662ed |
Close
Hashes for cwcwidth-0.1.9-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1c3eb0a8c1b25c4a17b6b9bbf7d25ce9df3ea43b6f87903c51bc12434a2cc29 |
|
MD5 | 942ff774abd5c2e1ccc9684ac4c98651 |
|
BLAKE2b-256 | 242734e67bde079eeeaa8b364f985549264226e20b522727c461ed4c070708fd |
Close
Hashes for cwcwidth-0.1.9-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae17e493ffc18497c2602f8f42a0d8e490ea42ab3ccfbe5e4a6069a6d24f3b36 |
|
MD5 | b268942fcc00e38921b0153a85ff7157 |
|
BLAKE2b-256 | 646d76676d3d85eceb1d59c543c983e7cb73a01a12fe31141f80055582f6002b |
Close
Hashes for cwcwidth-0.1.9-cp310-cp310-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e3c186b5c171d85f2b7f093e7efb33fd9b6e55b791ff75a0f101b18ec0433cd |
|
MD5 | e700799619fc551f536fc350efac4e2f |
|
BLAKE2b-256 | 2b2bed7fb35d010f154ed8f7de2c074294b8046b69326a7be0a29939ea6e7d21 |
Close
Hashes for cwcwidth-0.1.9-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf71151ae06e95f266bef91392c1562539b2eed847fd1f00f7b5b4ca3fd41a67 |
|
MD5 | 6578a0da00db4941c01d2c9cf266cbf1 |
|
BLAKE2b-256 | 8a1616ea230fbc78e9efdd4dcd75226064d7e4487a2c2a7ed59e69be9951fd50 |
Close
Hashes for cwcwidth-0.1.9-cp310-cp310-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 72490e07dfbc599fdf6efe26a13cfbf725f0513b181c3386d65bfd84f6175924 |
|
MD5 | 99ae2b200592ca7ecaa2e7915211fe76 |
|
BLAKE2b-256 | fa822531561586d0710de1fe6b23b6d1de15689fb18c99d22881ea17a3dd9a15 |
Close
Hashes for cwcwidth-0.1.9-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a5407d0933c3aab8ee92cffd9e4f09010f25af10ebdfa19776748402bba9261 |
|
MD5 | 3b4c5eef9486706ec990bc5a73746b99 |
|
BLAKE2b-256 | d8e6b9cf91702d3b05e4a436fb857ca5f6c0716df8d499951c763f73e949e3ed |
Close
Hashes for cwcwidth-0.1.9-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0633158205b50f253ad04e301156807e309a9fb9479a520418e010da6df13604 |
|
MD5 | f4660e3d51eea545f1192a1bdacdd56b |
|
BLAKE2b-256 | 13e9ad542f2eff3c0095f3f76f328007ccb02bde9f6e6437243e6c9ad7493aa8 |
Close
Hashes for cwcwidth-0.1.9-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 704f0d6888aa5e81e76d9f76709385f9f55aca8c450ee82cc722054814a7791f |
|
MD5 | 7d1f88ddbc8ab44a89a317920306c7f5 |
|
BLAKE2b-256 | dd0793131aec3f8d3788a9a2597a39a5203320a5976bf1259670aa5b51916f96 |
Close
Hashes for cwcwidth-0.1.9-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ddef2c504e6f4fd6122b46d55061f487add1ebb86596ae70ffc2a8b8955c8bc |
|
MD5 | b8c99ad959361fb96292c1e2d4d8df3c |
|
BLAKE2b-256 | ceda6c9e61fabaf1b6eed14b6cc8a50401951905cbde18add8db83a580f0c246 |
Close
Hashes for cwcwidth-0.1.9-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03093cac6f8e4326b1c30169e024fe2894f76c6ffddf6464e489bb33cb3a2897 |
|
MD5 | b8c2cfe7f78a42c84e61cdaa6fa988bd |
|
BLAKE2b-256 | e7f9dd3a3be328e253e92946cb9cc9d67e721adae2478d4047fccaf3ee3eb2da |
Close
Hashes for cwcwidth-0.1.9-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ffaf706abe400282f299463594d8887566e2a280cd0255110bd4397cc7be2910 |
|
MD5 | 1debb674c9d8dfb3c3f8c84e632a514f |
|
BLAKE2b-256 | d583830efff026443b847db8e298622bf59e51353dafc6683e1b29c9476a9e50 |
Close
Hashes for cwcwidth-0.1.9-cp39-cp39-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 945615a7b8cdcbcd8e06d399f96a2b09440c3a4c5cb3c2d0109f00d80da27a12 |
|
MD5 | 25800dadf3e0da7e52f7476efb9be745 |
|
BLAKE2b-256 | 0b95948a6322d61c55c2c56f78f09358e0f771a15c2c249481c991af70228138 |
Close
Hashes for cwcwidth-0.1.9-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 711ace9796cb6767ff29095ff5b0ec4619e7297854eb4b91ba99154590eddcc9 |
|
MD5 | d59c45b4f91c73fabeac69d49e8cb170 |
|
BLAKE2b-256 | 41e7f0bd572cf2148930ed2d20a60f03448cc633ba111d5ac26697b78ef0f476 |
Close
Hashes for cwcwidth-0.1.9-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad721d9dbc14eafd06176e4f5594942336b1e813de2a5ab7bd64254393c5713f |
|
MD5 | bf6abcc9a63393c1419ca4a5d0b88d93 |
|
BLAKE2b-256 | aa29d2a79159a2f1cffeeb49369b35b6b2ed40170be98c35b7c26f43f3fd6e47 |
Close
Hashes for cwcwidth-0.1.9-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d367da5e6fb538388817bf5b2d6dd4db90e5e631d99c34055589d007b5c94bc |
|
MD5 | eea34b983ee09e2efee96c4b4a5e1786 |
|
BLAKE2b-256 | 86bbdd1901ae60193bc61ce2194c503ccb217626d5da8039511d35d201afa2f3 |
Close
Hashes for cwcwidth-0.1.9-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 024d1b21e6123bf30a849e60eea3482f556bbd00d39215f86c904e5bd81fc1b6 |
|
MD5 | 6c016f8f13f04fad0fe1ed2bcf0ef071 |
|
BLAKE2b-256 | a8417eda451c55027c554da3422dfe4c969a8e8bc742f93f7b98f06efc74444c |
Close
Hashes for cwcwidth-0.1.9-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1bafe978a5b7915848244a952829e3f8757c0cebef581c8250da6064c906c38c |
|
MD5 | 25b5742e2a39048883347d6574705a84 |
|
BLAKE2b-256 | 72135a9dfdbb6eec67de6415e3938c20375a588688ac311b19376293f9dc923a |
Close
Hashes for cwcwidth-0.1.9-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc049ce273f32b632f5ead649b2120f8b2b78035d7b069fdc460c4be9affddb5 |
|
MD5 | 2ce8fd441af187707629d56152435c02 |
|
BLAKE2b-256 | 9d49226d62524751ed128c7fd6ef98afce3b27e204a27ba4dfd09c61edd7bb1d |
Close
Hashes for cwcwidth-0.1.9-cp38-cp38-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c858842849ce2cfdf207095253da83831d9407771c8073f6b75f24d3faf1a1eb |
|
MD5 | 6550e1609385ff09e44bce3b51aee0c8 |
|
BLAKE2b-256 | 72eaf9e911bef1f866bbee24d32a267ec9291a4e6b9097a827d7da5e85430406 |
Close
Hashes for cwcwidth-0.1.9-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f8d55c47cbec4796e89cfedc89c52e6c4c2faeb77489a763415b9f76d8fc14db |
|
MD5 | c763c3651f68e80f7e415de2e35bba11 |
|
BLAKE2b-256 | 132edff2bccfe0da62054a73e01d8d4780d3de90f1cdb43fade47ac39e7b822b |
Close
Hashes for cwcwidth-0.1.9-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | afc745f18c9e3c38851a931c0c0a7e479d6494911ba1353f998d707f95a895b4 |
|
MD5 | 06fa53f56ce9706cb2ec5a89a0f012cf |
|
BLAKE2b-256 | af213b9735366f178120091698d57bba257947d3be7da0c927fa8e3ee8bb82d1 |
Close
Hashes for cwcwidth-0.1.9-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 167f59c3c1e1d8e231a1abd666af4e73dd8a94917efb6522e9b610ac4587903a |
|
MD5 | f4fa06fda1018db13e6a216f7c038906 |
|
BLAKE2b-256 | 645d9ec82b6cfef4bf4969c9f25ba2ab8319e012b29c22e92e25d5a031ada92a |