

Blessings: a pythonic answer to curses - whit537
http://pypi.python.org/pypi/blessings/

======
erikrose
So glad you're enjoying Blessings! I've had fun writing it.

I'd love to hear what kind of projects other folks are doing with it. Any neat
hacks? One of my fun little demos is this terminal-dwelling Game of Life:
<http://pypi.python.org/pypi/conway/>. I was thinking of adding an interactive
mode so you can draw your own patterns and set them free; it would be an
excuse to add key trapping to Blessings.

~~~
erikrose
Oh, and for any who like the look of Blessings but don't have any terminal
projects afoot, shoppers who looked at this item also viewed...

A sequel to itertools: <http://pypi.python.org/pypi/more-itertools/> (The
upcoming 2.1 will include all the routines from the "recipes" section of the
docs as well.)

A front end for the popular Nose test runner that shows a progress bar and
tracebacks during tests (via blessings, of course):
<http://pypi.python.org/pypi/nose-progressive/>

A shim for using Nose with Django (and making your tests go 4x as fast):
<http://pypi.python.org/pypi/django-nose/>

While on the subject of Django, here's a little shim to let you write
lightweight management _sub_ commands (and generate commands at runtime, if
you want to go crazy): <http://pypi.python.org/pypi/django-subcommander/>

------
peter_l_downs
Not only does this seem like an excellent replacement for curses, this
overview/readme is a really great example of exactly how to detail a
library/component's capabilities and how to use them. I've bookmarked this to
use as a reference when writing my own documentation.

------
evincarofautumn
I recently had the terrible idea of writing a new screen editor. This project
is very much not helping me avoid working on that idea.

~~~
slurgfest
What makes you want to do that - can I assume that it means you can't find an
editor which works the way you need it to?

~~~
heretohelp
Must be a forth programmer.

Those people are the unabombers of programming.

Weird, isolated, and unhappy with everything.

~~~
slurgfest
I felt the same way in the past, and I am not a Forth programmer... nor do I
have a manifesto or a bomb shack

------
andrewf
_Leave more than one screenful of scrollback in the buffer after your program
exits, like a well-behaved command-line app should._

If you hate this, you can tweak your terminal definition so curses apps don't
do it. [http://fixlog.blogspot.com.au/2006/09/stop-gnome-terminal-
sc...](http://fixlog.blogspot.com.au/2006/09/stop-gnome-terminal-screen-
clear.html?showComment=1181164440000#c8296590195188985501)

------
ciupicri
> Blessings provides just one top-level object: Terminal. Instantiating a
> Terminal figures out whether you're on a terminal at all and, if so, does
> any necessary terminal setup.

Why doesn't the module figure this out at import? Since there is a single
terminal (at least right now), I don't see the point of having to instantiate
a class. All that stuff could be provided directly by the module. Or if
there's the possibility of controlling 2 terminals simultaneously, do
something similar with the _random_ module. Provide both functions and a class
that can be instantiated if needed.

~~~
erikrose
Deferring the setup is first a matter of politeness, an artifact of my opinion
that importing a module shouldn't have (possibly surprising) side effects on
the environment.

As for hanging everything off the Terminal instance, the motivation is that
there's significant state on it that you might want to customize. Things like
type (ANSI, vt100, etc.) and whether to suppress or force styling affect the
result of formatting methods. See
[http://packages.python.org/blessings/#blessings.Terminal.__i...](http://packages.python.org/blessings/#blessings.Terminal.__init__).
I've several times benefitted by making a formatting-suppressed Terminal and
passing it around.

I fully endorse you saying...

    
    
        term = Terminal()
    

...at the top level of some module and referencing it there. Then you get the
init-on-import behavior you want, but it's not forced on anybody who'd rather
not have it.

Cheers!

~~~
ciupicri
Or as The Zen of Pythons says, _explicit is better than implicit_. Thanks for
clearing things up for me.

------
theorique
Looking forward to try this out for a terminal based streaming-data feed
rendering library for columnar data. The curses module in python has been ...
interesting ... so any alternative is welcome.

------
lorenzfx
I just experimented a bit with Blessings and I love it! I have used some urwid
for terminal projects, but for the next one I'll consider Blessings as well.

Also I can't believe how few lines of code it is...

------
Nick_C
This is amazing serendipity. I was literally just then reading through
python's curses docs when this post came through.

Blessings will make my task a piece of cake. Thanks!

------
borntyping
After having difficulty trying to write a console application with
python/curses, this looks a much nicer way of doing it.

------
RegEx
I work with curses a LOT for fun server utilities on our big-screen monitor at
work. Super excited to give this a go.

------
famousactress
At a glance, this looks so very awesome. I've definitely wanted something like
this a number of time now!

------
anandpdoshi
We have been using termcolor for getting formatted output. This seems much
more powerful and intuitive.

------
fcoury
I'd love to have something like this for Ruby. Does anyone know a decent ruby
[n]curses wrapper?

~~~
Evbn
My friend keeps track of such things:
<https://www.google.com/search?q=ruby+ncurses>

------
shreeshga
this is great. i always felt that the most common webpages we visit would be
great if they were to be rendered in terminal in text only;
hackernews,reddit,news,mail etc.

------
sirclueless
Callable strings? Only in Python (oh how I love thee).

