This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

shcol is a shell columnizer that works in a similar way as the Unix-tool ls does when rendering directory contents.

Some examples:

>>> import shcol
>>> shcol.print_filenames()  # print contents of current directory
bin    LICENSE   MANIFEST.in  setup.py  testsuite
build  Makefile  README.md    shcol
>>> shcol.print_filenames('testsuite')  # print contents of a subdirectory
test_cli.py   test_core.py   test_highlevel.py   test_script.py
test_cli.pyc  test_core.pyc  test_highlevel.pyc  test_script.pyc
>>> shcol.print_filenames('testsuite/*.py')  # only print `*.py`-files
testsuite/test_cli.py   testsuite/test_highlevel.py
testsuite/test_core.py  testsuite/test_script.py
>>> shcol.print_filenames('~/shcol', hide_dotted=False)  # like `ls -A ~/shcol`
bin    .git     Makefile     README.md  shcol
build  LICENSE  MANIFEST.in  setup.py   testsuite

shcol can also columnize the attribute names of a Python-object:

>>> shcol.print_sorted(shcol)
__author__    config    helpers      __package__       print_columnized_mapping
__builtins__  core      highlevel    __path__          print_filenames
cli           __doc__   __license__  print_attrs       __version__
columnize     __file__  __name__     print_columnized
>>> shcol.print_sorted(shcol, spacing=5)
__author__       core          __license__     print_columnized
__builtins__     __doc__       __name__        print_columnized_mapping
cli              __file__      __package__     print_filenames
columnize        helpers       __path__        __version__
config           highlevel     print_attrs

Note that the spacing-parameter as shown above works with all kinds of print_*-functions in shcol.

You can also tell a print_*-function to use a specific line width for its output:

>>> shcol.print_sorted(shcol, spacing=5, line_width=60)
__author__       __file__        print_attrs
__builtins__     helpers         print_columnized
cli              highlevel       print_columnized_mapping
columnize        __license__     print_filenames
config           __name__        __version__
core             __package__
__doc__          __path__

Note that by default the terminal’s width is used as the line width.

And of course, you can columnize arbitrary names with shcol:

>>> shcol.print_columnized(['foo', 'bar', 'baz'], spacing=7)
foo       bar       baz
>>> shcol.print_columnized(['foo', 'bar', 'baz'], spacing=7, sort_items=True)
bar       baz       foo

The following example demonstrates that sorting is locale-aware. Note the German umlaut in it. Hint: You need German as your default locale setting to reproduce that in your Python interpreter:

>>> shcol.print_columnized(['foo', 'bär', 'baz'], sort_items=True)
bär  baz  foo

You can see that shcol handles Unicode-characters as you would expect it.

In case you need the raw columnized string you can get that directly:

>>> shcol.columnize(['foo', 'bär', 'baz'], sort_items=True)  # on Python 2.7
u'b\xe4r  baz  foo'
>>> shcol.columnize(['foo', 'bär', 'baz'], sort_items=True)  # on Python 3.x
'bär  baz  foo'

shcol has its focus on usability and speed. Even large lists will be rendered relatively fast (like shcol.print_filenames('/usr/bin')).

Just give it a try if you like it and feel free to give some feedback. :-)

Release History

Release History

0.3

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2-rc1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1-dev

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
shcol-0.3.zip (32.3 kB) Copy SHA256 Checksum SHA256 Source May 15, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting