Python library that measures the width of unicode strings rendered to a terminal

Overview

Downloads codecov.io Code Coverage MIT 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 charater : 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=' '):
...    from wcwidth import wcswidth
...    return padding * max(0, (length - wcswidth(text))) + text
...

Our Solution uses wcswidth to determine the string length correctly:

>>> from wcwidth import wcswidth
>>> print(wcswidth('コンニチハ'))
10

>>> print(wc_rjust('コンニチハ', 20, '_'))
__________コンニチハ

Choosing a Version

Export an environment variable, UNICODE_VERSION. This should be done by terminal emulators or those developers experimenting with authoring one of their own, from shell:

$ export UNICODE_VERSION=13.0

If unspecified, the latest version is used. If your Terminal Emulator does not export this variable, you can use the jquast/ucs-detect utility to automatically detect and export it to your shell.

wcwidth, wcswidth

Use function wcwidth() to determine the length of a single unicode character, and wcswidth() to determine the length of many, a string of unicode characters.

Briefly, return values of function wcwidth() are:

-1
Indeterminate (not printable).
0
Does not advance the cursor, such as NULL or Combining.
2
Characters of category East Asian Wide (W) or East Asian Full-width (F) which are displayed using two terminal cells.
1
All others.

Function wcswidth() simply returns the sum of all values for each character along a string, or -1 when it occurs anywhere along a string.

Full API Documentation at http://wcwidth.readthedocs.org

Developing

Install wcwidth in editable mode:

pip install -e.

Execute unit tests using tox:

tox

Regenerate python code tables from latest Unicode Specification data files:

tox -eupdate

Supplementary tools for browsing and testing terminals for wide unicode characters are found in the bin/ of this project's source code. Just ensure to first pip install -erequirements-develop.txt from this projects main folder. For example, an interactive browser for testing:

./bin/wcwidth-browser.py

Uses

This library is used in:

Other Languages

History

0.2.0 2020-06-01
  • Enhancement: Unicode version may be selected by exporting the Environment variable UNICODE_VERSION, such as 13.0, or 6.3.0. See the jquast/ucs-detect CLI utility for automatic detection.
  • Enhancement: API Documentation is published to readthedocs.org.
  • Updated tables for all Unicode Specifications with files published in a programmatically consumable format, versions 4.1.0 through 13.0 that are published , versions
0.1.9 2020-03-22
  • Performance optimization by Avram Lubkin, PR #35.
  • Updated tables to Unicode Specification 13.0.0.
0.1.8 2020-01-01
  • Updated tables to Unicode Specification 12.0.0. (PR #30).
0.1.7 2016-07-01
  • Updated tables to Unicode Specification 9.0.0. (PR #18).
0.1.6 2016-01-08 Production/Stable
  • LICENSE file now included with distribution.
0.1.5 2015-09-13 Alpha
  • Bugfix: Resolution of "combining character width" issue, most especially those that previously returned -1 now often (correctly) return 0. resolved by Philip Craig via PR #11.
  • Deprecated: The module path wcwidth.table_comb is no longer available, it has been superseded by module path wcwidth.table_zero.
0.1.4 2014-11-20 Pre-Alpha
0.1.3 2014-10-29 Pre-Alpha
0.1.2 2014-10-28 Pre-Alpha
0.1.1 2014-05-14 Pre-Alpha
  • Initial release to pypi, Based on Unicode Specification 6.3.0

This code was originally derived directly from C code of the same name, whose latest version is available at http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c:

* Markus Kuhn -- 2007-05-26 (Unicode 5.0)
*
* Permission to use, copy, modify, and distribute this software
* for any purpose and without fee is hereby granted. The author
* disclaims all warranties with regard to this software.
Comments
  • Bump pyyaml from 3.11 to 5.1

    Bump pyyaml from 3.11 to 5.1

    Bumps pyyaml from 3.11 to 5.1.

    Changelog

    Sourced from pyyaml's changelog.

    5.1 (2019-03-13)

    3.13 (2018-07-05)

    • Resolved issues around PyYAML working in Python 3.7.

    3.12 (2016-08-28)

    • Wheel packages for Windows binaries.
    • Adding an implicit resolver to a derived loader should not affect the base loader.
    • Uniform representation for OrderedDict? across different versions of Python.
    • Fixed comparison to None warning.
    Commits
    • e471e86 Updates for 5.1 release
    • 9141e90 Windows Appveyor build
    • d6cbff6 Skip certain unicode tests when maxunicode not > 0xffff
    • 69103ba Update .travis.yml to use libyaml 0.2.2
    • 91c9435 Squash/merge pull request #105 from nnadeau/patch-1
    • 507a464 Make default_flow_style=False
    • 07c88c6 Allow to turn off sorting keys in Dumper
    • 611ba39 Include license file in the generated wheel package
    • 857dff1 Apply FullLoader/UnsafeLoader changes to lib3
    • 0cedb2a Deprecate/warn usage of yaml.load(input)
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot ignore this [patch|minor|major] version will close this PR and stop Dependabot creating any more for this minor/major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 14
  • Wrong width for emoji chars

    Wrong width for emoji chars

    as reported in xonsh/xonsh#1569 some (maybe all) emojis are reported as being 2 char wide, while most (all?) terminals think they are 1 char wide:

    440944d0-63b6-11e6-8173-7e954087f26c

    The difference in position is because while editing a command xonsh is using wcwidth but to print the line it just prints and let the terminal position things

    bug enhancement 
    opened by santagada 10
  • Style and about 10x speed improvement

    Style and about 10x speed improvement

    Hi, first off: Awesome project. This world is missing unicode-aware software.

    I had a look at the code, and I found that it could easily be optimized by using more of the python standard library. The code as attached is about 10x faster on large strings (I tested it on 10MB of english text).

    With the caching hack it's about 10x as fast (3.3s vs. 37s on my machine), without it's about 3x as fast (12.5s vs. 37s on my machine).

    Tell me what you think of it and I'll format a more descriptive commit.

    Regards, jaseg

    wontfix needs-feedback 
    opened by jaseg 8
  • special character width problem

    special character width problem

    image

    import pandas as pd
    from tabulate import tabulate
    from io import StringIO
    import wcwidth
    
    
    csv_str = ''',0,1,2
    0,a)  将净利润调节为经营活动现金流量,,
    1,,2019 年度,2018 年度
    2,净利润,"63,205,243","55,350,200"
    3,加:资产减值损失,"(73,370)","10,465,899"
    4,信用减值损失,"3,611,595",—
    5,固定资产折旧,"6,543,253","6,530,713"
    6,投资性房地产折旧,"1,718,108","1,514,560"
    7,无形资产摊销,"447,821","440,444"
    8,长期待摊费用摊销,"338,210","189,875"
    9,处置固定资产、无形资产和其他长,,
    10,期资产的收益,"(568,141)","(175,112)"
    11,财务费用,"10,179,757","12,568,535"
    12,公允价值变动损失,"484,752","368,343"
    13,投资收益,"(4,212,538)","(5,646,311)"
    14,递延所得税资产的增加,"(3,083,170)","(2,511,075)"
    15,递延所得税负债的增加/(减少),"107,125","(644,386)"
    16,存货的增加,"(70,420,830)","(96,125,732)"
    17,受限资金的(增加)/减少,"(1,387,681)","280,759"
    18,经营性应收项目的增加,"(125,133,902)","(108,365,569)"
    19,经营性应付项目的增加,"83,217,173","135,881,219"
    '''
    
    csv_io = StringIO(csv_str)
    
    df = pd.read_csv(csv_io, index_col=0)
    
    print(df)
    
    df_tabulated = tabulate(df, headers='keys', tablefmt='psql', showindex=False)
    
    print(df_tabulated)
    
    opened by playgithub 6
  • Optimize wcwidth()

    Optimize wcwidth()

    Some minor optimizations for wcwidth(). Should result in ~30% performance gain.

    >>> from timeit import timeit
    >>> timeit('wcwidth("a")', setup='from wcwidth import wcwidth', number=10000000)
    

    Before optimizations: 7.065002638002625

    After optimizations: 4.69557189499028

    The main speedups come from using a set instead of a chain of boolean comparisons and passing the upper bound of the table into the binary search instead of calling length on the table for each run.

    opened by avylove 5
  • Using DerivedCombiningClass.txt to determine width is inappropriate

    Using DerivedCombiningClass.txt to determine width is inappropriate

    DerivedCombiningClass.txt contains the Canonical_Combining_Class field from UnicodeData.txt (see http://www.unicode.org/reports/tr44/#Canonical_Combining_Class_Values). This field is intended to be used for the collation algorithm.

    wcwidth.py is currently assuming that characters are zero width combining characters if and only if they have a non-zero combining class. I think this is an invalid assumption. For example, characters that are enclosing marks (General Category = Me) all have a zero combining class, but they are also zero width combining characters.

    I'm not sure what the standard way to determine zero width combining characters is. One possibility is to check for a General Category of Mn or Me, but I don't know if there are any exceptions to this. Also note that there are combining characters that do have a width (category Mc).

    bug 
    opened by philipc 5
  • Set targets on badges

    Set targets on badges

    so that clicking them goes somewhere useful rather than opening the image in the browser.

    Try it out at https://github.com/msabramo/wcwidth/tree/set_targets_on_badges

    opened by msabramo 5
  • Support all Unicode Versions

    Support all Unicode Versions

    Support all versions of Unicode, using the UNICODE_VERSION environment variable, when defined, or, for non-shells, explicitly by passing argument unicode_version to the wcwidth family of functions.

    A demonstration utility that determines the Terminal's Unicode Version is made available as a separate package, https://github.com/jquast/ucs-detect/ which contains a Problem and Solution statement, copied here:

    Problem

    Chinese, Japanese, Korean, and Emoticon characters are "double-wide", occupying 2 cells, instead of 1, and some other special characters are "zero-width".

    Any terminal application that formats and displays these characters may have trouble determining how it will be displayed to the end-user.

    This problem happens often, because the Unicode Consortium releases new versions of the Unicode Standard periodically, but the source code of libraries and applications are not updated at the same time, or at all!

    Many languages and libraries continue to conform only to Unicode 5.0, which is the last version of wcwidth.c released by Markus Kuhn in 2007.

    Solution

    The most important factor is to determine: What version of unicode is the Terminal Emulator using?

    This program, ucs-detect, is able to automatically detect the version of unicode that the connecting Terminal supports. The python wcwidth library supports all Unicode versions, 4.1.0 through 12.1.0 at time of this writing, and so it is able to select and match the correct return value for by using the given value of the UNICODE_VERSION environment variable.

    opened by jquast 4
  • Combining browser

    Combining browser

    We've updated created a new script for testing whether combining characters combine as expected, and found that many don't on our terminals. Should we consider the behavior on our terminals correct, or read more about all the offending classes of characters?

    Any feedback on the code would be great too :)

    opened by thomasballinger 4
  • `python setup.py update` no longer works

    `python setup.py update` no longer works

    On a fresh checkout:

    $ python3 setup.py update
    running update
    data/ created.
    retrieving http://www.unicode.org/Public/UNIDATA/EastAsianWidth.txt.
    data/EastAsianWidth.txt saved.
    parsing data/EastAsianWidth.txt ..
    Traceback (most recent call last):
      File "setup.py", line 252, in <module>
        main()
      File "setup.py", line 248, in main
        cmdclass={'update': SetupUpdate},
      File "/usr/lib/python3.5/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/lib/python3.5/distutils/dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python3.5/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "setup.py", line 64, in run
        self.do_east_asian()
      File "setup.py", line 72, in do_east_asian
        properties=(u'W', u'F',)
      File "setup.py", line 127, in _parse_east_asian
        uline = line.decode('ascii')
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 2: ordinal not in range(128)
    
    bug 
    opened by sebastinas 3
  • Wrong width for some Cyrillic characters

    Wrong width for some Cyrillic characters

    The width for these are not correct:

    • COMBINING CYRILLIC HUNDRED THOUSANDS SIGN
    • COMBINING CYRILLIC HUNDRED MILLIONS SIGN

    Test case:

    import unicodedata
    import math
    import wcwidth
    
    charnames = [u'COMBINING CYRILLIC HUNDRED THOUSANDS SIGN',
                 u'COMBINING CYRILLIC HUNDRED MILLIONS SIGN',
                 u'CIRCLED LATIN CAPITAL LETTER A',
                 u'KANGXI RADICAL BIRD']
    
    for charname in charnames:
        print(u'Character: {}'.format(charname))
        c = unicodedata.lookup(charname)
        cwidth = wcwidth.wcwidth(c)
        spacing = int(math.floor(2 - cwidth)) * u' '
        print(u"123456789")
        print(u"123{}{}6789".format(c, spacing))
        print(u"Char width: {}".format(cwidth, spacing))
    

    This is printed with Python 2.7 and wcwidth 0.1.4:

    Character: COMBINING CYRILLIC HUNDRED THOUSANDS SIGN
    123456789
    123҈ 6789
    Char width: 1
    Character: COMBINING CYRILLIC HUNDRED MILLIONS SIGN
    123456789
    123꙱ 6789
    Char width: 1
    Character: CIRCLED LATIN CAPITAL LETTER A
    123456789
    123Ⓐ 6789
    Char width: 1
    Character: KANGXI RADICAL BIRD
    123456789
    123⿃6789
    Char width: 2
    

    Related: https://github.com/dbcli/mycli/issues/149

    invalid 
    opened by dveeden 3
  • Unicode 15

    Unicode 15

    Supersedes #59. I used Python 3.11.1 which only has unicodedata 14.0.0, so the name comments aren't perfect. Maybe someone could edit the script to use the comments from the input files directly.

    opened by landfillbaby 1
  • Add CodeQL workflow for GitHub code scanning

    Add CodeQL workflow for GitHub code scanning

    Hi jquast/wcwidth!

    This is a one-off automatically generated pull request from LGTM.com :robot:. You might have heard that we’ve integrated LGTM’s underlying CodeQL analysis engine natively into GitHub. The result is GitHub code scanning!

    With LGTM fully integrated into code scanning, we are focused on improving CodeQL within the native GitHub code scanning experience. In order to take advantage of current and future improvements to our analysis capabilities, we suggest you enable code scanning on your repository. Please take a look at our blog post for more information.

    This pull request enables code scanning by adding an auto-generated codeql.yml workflow file for GitHub Actions to your repository — take a look! We tested it before opening this pull request, so all should be working :heavy_check_mark:. In fact, you might already have seen some alerts appear on this pull request!

    Where needed and if possible, we’ve adjusted the configuration to the needs of your particular repository. But of course, you should feel free to tweak it further! Check this page for detailed documentation.

    Questions? Check out the FAQ below!

    FAQ

    Click here to expand the FAQ section

    How often will the code scanning analysis run?

    By default, code scanning will trigger a scan with the CodeQL engine on the following events:

    • On every pull request — to flag up potential security problems for you to investigate before merging a PR.
    • On every push to your default branch and other protected branches — this keeps the analysis results on your repository’s Security tab up to date.
    • Once a week at a fixed time — to make sure you benefit from the latest updated security analysis even when no code was committed or PRs were opened.

    What will this cost?

    Nothing! The CodeQL engine will run inside GitHub Actions, making use of your unlimited free compute minutes for public repositories.

    What types of problems does CodeQL find?

    The CodeQL engine that powers GitHub code scanning is the exact same engine that powers LGTM.com. The exact set of rules has been tweaked slightly, but you should see almost exactly the same types of alerts as you were used to on LGTM.com: we’ve enabled the security-and-quality query suite for you.

    How do I upgrade my CodeQL engine?

    No need! New versions of the CodeQL analysis are constantly deployed on GitHub.com; your repository will automatically benefit from the most recently released version.

    The analysis doesn’t seem to be working

    If you get an error in GitHub Actions that indicates that CodeQL wasn’t able to analyze your code, please follow the instructions here to debug the analysis.

    How do I disable LGTM.com?

    If you have LGTM’s automatic pull request analysis enabled, then you can follow these steps to disable the LGTM pull request analysis. You don’t actually need to remove your repository from LGTM.com; it will automatically be removed in the next few months as part of the deprecation of LGTM.com (more info here).

    Which source code hosting platforms does code scanning support?

    GitHub code scanning is deeply integrated within GitHub itself. If you’d like to scan source code that is hosted elsewhere, we suggest that you create a mirror of that code on GitHub.

    How do I know this PR is legitimate?

    This PR is filed by the official LGTM.com GitHub App, in line with the deprecation timeline that was announced on the official GitHub Blog. The proposed GitHub Action workflow uses the official open source GitHub CodeQL Action. If you have any other questions or concerns, please join the discussion here in the official GitHub community!

    I have another question / how do I get in touch?

    Please join the discussion here to ask further questions and send us suggestions!

    opened by lgtm-com[bot] 0
  • Switch to using importlib.metadata

    Switch to using importlib.metadata

    pkg_resources is a little heavyweight, and has some rather glaring shortcomings for checking the metadata of an install Python package. importlib.metadata is contained in the standard library (as of 3.8), and provides a much nicer interface. Switch to using it, falling back to importlib_metadata if the Python version is too old.

    opened by s-t-e-v-e-n-k 1
  • Use a new jinja2 templating process to update library to latest unicode (14.0)

    Use a new jinja2 templating process to update library to latest unicode (14.0)

    • update tox.ini, requirements* files
      • use pip-compile with "requirements.in" files to generate "requirements.txt" files
      • use older testing tools for older python versions (requirements-tests38.in and requirements-tests39.in)
      • use python3.10 for most build steps
    • bin/update-tables.py changes,
      • use https
      • use jinja2 (.j2) templating to generate code and documentation,
        • easier to support code generation of other languages
      • unreliable connection support using tenacity library to retry on connection timeout, etc.
      • optional --check-last-modified will compare last-modified for redownload
        • a unicode.org data file was only once updated for a botched release
    • for wcwidth/table*.py files
      • uses new template system to generate new table data files for unicode version 14
      • when a description of unicode is single codepoint, describe only as 'A' instead of 'A..A'
    opened by jquast 4
  • Upgrade to Unicode 14.0.0

    Upgrade to Unicode 14.0.0

    Generated by python3.11 bin/update-tables.py. Using python 3.11 because only on python 3.11, unidecodedata.unidata_version is "14.0.0".

    $ python3.11 -V
    Python 3.11.0a5
    

    Based on commit 53b0dd1.

    opened by GalaxySnail 0
Releases(0.2.5)
  • 0.2.5(Jun 23, 2020)

  • 0.2.4(Jun 11, 2020)

    • minor "bugfix" to avoid using pkg_resources module on import, 7918f581feedeaa4246dc0fc03ec6fb49cff15cb
    • may help xonsh https://github.com/xonsh/xonsh/issues/3607
    Source code(tar.gz)
    Source code(zip)
  • 0.2.3(Jun 2, 2020)

  • 0.2.2(Jun 1, 2020)

    PR #23: Support all versions of Unicode, using the UNICODE_VERSION environment variable, when defined, or, for non-shells, explicitly by passing argument unicode_version to the wcwidth family of functions.

    A demonstration utility that determines the Terminal's Unicode Version is made available as a separate package, https://github.com/jquast/ucs-detect/ which contains a Problem and Solution statement.

    Source code(tar.gz)
    Source code(zip)
  • 0.1.9(Mar 23, 2020)

  • 0.1.7(Jul 2, 2016)

  • 0.1.6(Jan 8, 2016)

  • 0.1.5(Sep 14, 2015)

    • Bugfix: Resolution of "combining character width" issue, most especially those that previously returned -1 now often (correctly) return 0. resolved by Philip Craig via PR #11.
    • Deprecated: The module path wcwidth.table_comb is no longer available, it has been superseded by module path wcwidth.table_zero.
    Source code(tar.gz)
    Source code(zip)
  • 0.1.4(Nov 20, 2014)

    0.1.4

    • Feature: wcswidth() now determines printable length for (most) combining characters. The developer's tool bin/wcwidth-browser.py is improved to display combining characters when provided the --combining option (@thomasballinger and @lmontopo PR #5).
    • added static analysis (prospector) to testing framework.
    Source code(tar.gz)
    Source code(zip)
  • 0.1.3(Oct 29, 2014)

  • 0.1.2(Oct 28, 2014)

  • 0.1(May 5, 2014)

Owner
Jeff Quast
xyzzy
Jeff Quast
Python Fire is a library for automatically generating command line interfaces (CLIs) from absolutely any Python object.

Python Fire Python Fire is a library for automatically generating command line interfaces (CLIs) from absolutely any Python object. Python Fire is a s

Google 23.6k Dec 31, 2022
Clint is a module filled with a set of awesome tools for developing commandline applications.

Clint: Python Command-line Interface Tools Clint is a module filled with a set of awesome tools for developing commandline applications. C ommand L in

Kenneth Reitz Archive 82 Dec 28, 2022
Rich is a Python library for rich text and beautiful formatting in the terminal.

Rich 中文 readme • lengua española readme • Läs på svenska Rich is a Python library for rich text and beautiful formatting in the terminal. The Rich API

Will McGugan 41.4k Jan 02, 2023
Cement is an advanced Application Framework for Python, with a primary focus on CLI

Cement Framework Cement is an advanced Application Framework for Python, with a primary focus on Command Line Interfaces (CLI). Its goal is to introdu

Data Folk Labs, LLC 1.1k Dec 31, 2022
A module for parsing and processing commands.

cmdtools A module for parsing and processing commands. Installation pip install --upgrade cmdtools-py install latest commit from GitHub pip install g

1 Aug 14, 2022
prompt_toolkit is a library for building powerful interactive command line applications in Python.

Python Prompt Toolkit prompt_toolkit is a library for building powerful interactive command line applications in Python. Read the documentation on rea

prompt-toolkit 8.1k Jan 04, 2023
A minimal and ridiculously good looking command-line-interface toolkit

Proper CLI Proper CLI is a Python package for creating beautiful, composable, and ridiculously good looking command-line-user-interfaces without havin

Juan-Pablo Scaletti 2 Dec 22, 2022
A CLI tool to build beautiful command-line interfaces with type validation.

Piou A CLI tool to build beautiful command-line interfaces with type validation. It is as simple as from piou import Cli, Option cli = Cli(descriptio

Julien Brayere 310 Dec 07, 2022
Humane command line arguments parser. Now with maintenance, typehints, and complete test coverage.

docopt-ng creates magic command-line interfaces CHANGELOG New in version 0.7.2: Complete MyPy typehints - ZERO errors. Required refactoring class impl

Jazzband 108 Dec 27, 2022
A cross platform package to do curses-like operations, plus higher level APIs and widgets to create text UIs and ASCII art animations

ASCIIMATICS Asciimatics is a package to help people create full-screen text UIs (from interactive forms to ASCII animations) on any platform. It is li

3.2k Jan 09, 2023
Simple cross-platform colored terminal text in Python

Colorama Makes ANSI escape character sequences (for producing colored terminal text and cursor positioning) work under MS Windows. PyPI for releases |

Jonathan Hartley 3k Jan 01, 2023
Python Command-line Application Tools

Clint: Python Command-line Interface Tools Clint is a module filled with a set of awesome tools for developing commandline applications. C ommand L in

Kenneth Reitz Archive 82 Dec 28, 2022
A thin, practical wrapper around terminal capabilities in Python

Blessings Coding with Blessings looks like this... from blessings import Terminal t = Terminal() print(t.bold('Hi there!')) print(t.bold_red_on_brig

Erik Rose 1.4k Jan 07, 2023
Corgy allows you to create a command line interface in Python, without worrying about boilerplate code

corgy Elegant command line parsing for Python. Corgy allows you to create a command line interface in Python, without worrying about boilerplate code.

Jayanth Koushik 7 Nov 17, 2022
Python library to build pretty command line user prompts ✨Easy to use multi-select lists, confirmations, free text prompts ...

Questionary ✨ Questionary is a Python library for effortlessly building pretty command line interfaces ✨ Features Installation Usage Documentation Sup

Tom Bocklisch 990 Jan 01, 2023
Python library that measures the width of unicode strings rendered to a terminal

Introduction This library is mainly for CLI programs that carefully produce output for Terminals, or make pretend to be an emulator. Problem Statement

Jeff Quast 305 Dec 25, 2022
plotting in the terminal

bashplotlib plotting in the terminal what is it? bashplotlib is a python package and command line tool for making basic plots in the terminal. It's a

Greg Lamp 1.7k Jan 02, 2023
sane is a command runner made simple.

sane is a command runner made simple.

Miguel M. 22 Jan 03, 2023
A simple terminal Christmas tree made with Python

Python Christmas Tree A simple CLI Christmas tree made with Python Installation Just clone the repository and run $ python terminal_tree.py More opti

Francisco B. 64 Dec 27, 2022
emoji terminal output for Python

Emoji Emoji for Python. This project was inspired by kyokomi. Example The entire set of Emoji codes as defined by the unicode consortium is supported

Taehoon Kim 1.6k Jan 02, 2023