Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install clint

How to install clint

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install clint
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.3.1 Available View build log
0.3.0 Available View build log
0.2.6 Available View build log
0.2.5 Available View build log
0.2.4 Available View build log
0.2.3 Available View build log
0.2.1 Available View build log
0.2.0 Available View build log
0.1.2 Available View build log
0.1.1 Available View build log
0.3.1 Available View build log
0.3.0 Available View build log
Windows (64-bit)
0.3.1 Available View build log
0.3.0 Available View build log
0.2.6 Available View build log
0.2.5 Available View build log
0.2.4 Available View build log
0.2.3 Available View build log
0.2.1 Available View build log
0.2.0 Available View build log
0.1.2 Available View build log
0.1.1 Available View build log
0.3.1 Available View build log
0.3.0 Available View build log
Mac OS X (10.5+)
0.3.1 Available View build log
0.3.0 Available View build log
0.2.6 Available View build log
0.2.5 Available View build log
0.2.4 Available View build log
0.2.3 Available View build log
0.2.1 Available View build log
0.2.0 Available View build log
0.1.2 Available View build log
0.1.1 Available View build log
0.3.1 Available View build log
0.3.0 Available View build log
Linux (32-bit)
0.3.1 Available View build log
0.3.0 Available View build log
0.2.6 Available View build log
0.2.5 Available View build log
0.2.4 Available View build log
0.2.3 Available View build log
0.2.1 Available View build log
0.2.0 Available View build log
0.1.2 Available View build log
0.1.1 Available View build log
0.3.1 Available View build log
0.3.0 Available View build log
Linux (64-bit)
0.3.1 Available View build log
0.3.0 Available View build log
0.2.6 Available View build log
0.2.5 Available View build log
0.2.4 Available View build log
0.2.3 Available View build log
0.2.1 Available View build log
0.2.0 Available View build log
0.1.2 Available View build log
0.1.1 Available View build log
0.3.1 Available View build log
0.3.0 Available View build log
0.3.1 Available View build log
 
Author
License
ISC
Lastest release
version 0.3.1 on Jan 17th, 2012

Clint is a module filled with a set of awesome tools for developing commandline applications.

https://github.com/kennethreitz/clint/raw/master/misc/clint.jpeg

C ommand L ine IN terface T ools .

Clint is awesome. Crazy awesome. It supports colors, but detects if the session is a TTY, so doesn't render the colors if you're piping stuff around. Automagically.

Awesome nest-able indentation context manager. Example: (with indent(4): puts('indented text')). It supports custom email-style quotes. Of course, it supports color too, if and when needed.

It has an awesome Column printer with optional auto-expanding columns. It detects how wide your current console is and adjusts accordingly. It wraps your words properly to fit the column size. With or without colors mixed in. All with a single function call.

The world's easiest to use implicit argument system w/ chaining methods for filtering. Seriously.

Run the various executables in examples to get a good feel for what Clint offers.

You'll never want to not use it.

Current Features:

  • Little Documentation (bear with me for now)
  • CLI Colors and Indents
  • Extremely Simple + Powerful Column Printer
  • Iterator-based Progress Bar
  • Implicit Argument Handling
  • Simple Support for Incoming Unix Pipes
  • Application Directory management

Future Features:

  • Documentation!
  • Simple choice system Are you sure? [Yn]
  • Default query system Installation Path [/usr/local/bin/]
  • Suggestions welcome.

Example

I want to indent my console text.

>>> from clint.textui import puts, indent

>>> puts('not indented text')
>>> with indent(4):
>>>     puts('indented text')
not indented text
    indented text

I want to quote my console text (like email).

>>> puts('not indented text')
>>> with indent(4, quote=' >'):
>>>     puts('quoted text')
>>>     puts('pretty cool, eh?')

not indented text
 >  indented text
 >  pretty cool, eh?

I want to color my console text.

>>> from clint.textui import colored

>>> puts(colored.red('red text'))
red text

# It's red in Windows, OSX, and Linux alike.

I want to get data piped to stdin.

>>> clint.piped_in()

# if no data was piped in, piped_in returns None

I want to get the first commandline argument passed in.

>>> clint.args.get(0)

# if no argument was passed, get returns None

I want to store a configuration file.

>>> from clint import resources

>>> resources.init('Company', 'AppName')
>>> resources.user.write('config.ini', file_contents)

# OSX: '/Users/appuser/Library/Application Support/AppName/config.ini'
# Windows: 'C:\\Users\\appuser\\AppData\\Local\\Company\\AppName\\config.ini'
# Linux: '/home/appuser/.config/appname/config.ini'

Installation

To install clint, simply:

$ pip install clint

Or, if you absolutely must:

$ easy_install clint

But, you really shouldn't do that.

License:

ISC License.

Copyright (c) 2011, Kenneth Reitz <me@kennethreitz.com>

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Contribute

If you'd like to contribute, simply fork the repository, commit your changes to the develop branch (or branch off of it), and send a pull request. Make sure you add yourself to AUTHORS.

Roadmap

  • Unittests
  • Sphinx Documentation
  • Python 2.5, 3.1, 3.2 Support

History

0.3.1
  • Progress mill indicator.
  • Colored unicode support.
  • Fix ipython nuance.
0.3.0
  • Python 3 support!
0.2.4
  • New eng module
  • Win32 Bugfix
0.2.3
  • Only init colors if they are used (iPython compatability)
  • New progress module
  • Various bugfixes
0.2.2
  • Auto Color Disabling
  • Progress Namespace Change
  • New Progress Bars
  • textui.puts newline fix
0.2.1 (2011-03-24)
  • Python 2.5 Support
  • List of available colors
0.2.0 (2011-03-23)
  • Column Printing!!!
  • (Auto/Manual) Disabling of Colors
  • Smarter Colors
  • max_width, min_width
  • Strip cli colors
  • bug fixes
0.1.2 (2011-03-21)
  • Bugfixes
0.1.1 (2011-03-20)
  • Bugfixes
  • Indent Newline Injection
  • resources: flags, not_flags, files, not_files
  • Lots of Examples
0.1.0 (2011-03-20)
  • Initial Release!

Subscribe to package updates

Last updated Jan 17th, 2012

Download Stats

Last month:6

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.