Wednesday, December 19, 2012

PyPgDay

I was thinking about staying home from PyCon in 2013.

I know, that's a horrible idea. But financing the trip has gotten hard recently, and I want to spend weeks and weeks in Montreal for PyCon 2014, so I was thinking maybe I'd save up my travel money for a spectacular trip to Quebec in a year.

But now look what they've done. PyPgDay. Postgres and Python. They've got my number. Resistance is futile.

The CFP is out; I'll be thinking about what I can propose. Maybe this will lead to a spasm of EDD (embarrassment-driven development) on sqlpython and cmd2.

So keep close watch over your kidneys, because I may resort to stealing them to make the trip, but I'll see you in Santa Clara.

Saturday, December 15, 2012

ipython_doctester 0.2

The big improvement for 0.2 is that ipython_doctester now optionally reports test results to an instructor's webapp, http://ipython-docent.appspot.com. In a classroom setting, this helps a teacher see who needs more time or help.

To turn on reporting, at the beginning of the IPython Notebook session,

import ipython_doctester
ipython_doctester.workshop_name = 'demo1'
ipython_doctester.student_name = 'Catherine'
from ipython_doctester import test

The instructor should run through the notebook first, executing all cells just to register each of the function names in order. Then she can check on the class's progress at http://ipython-docent.appspot.com/workshop_name.

You can also optionally set ipython_doctester.verbose = True to get the full table of results for every exercise, even the successes.

I plan to use this for the Columbus Python Workshop on Jan 18-19. Anyone you know from central Ohio needs to hear about this class!

Friday, November 02, 2012

ipython_doctester

That IPython project I was kicking around has started to mature, and I've released it into PyPI:

ipython_doctester

I'm much happier with using it as a decorator, it stays out of the student's way that way:

Sunday, October 21, 2012

GiveCamp

I really enjoyed Southwest Ohio GiveCamp this year. There are lots of community events where I learn stuff and have fun, but it's especially nice when we can also look back on something good done for a good cause.

I was on a small team that redid URS Dayton's website into a WordPress site. (The new version isn't online yet, so don't go clicking today and saying, "Ew, you're proud of that?") I'll say this for WordPress: despite having no genuinely experienced WordPress users on the team, we made a very presentable site in just an evening and a day. There was even enough time left last night for me to jump into another project for an hour - and being able to contribute a little bit within an hour of jumping into an unknown project says something about just how easy GitHub makes collaboration.

It's interesting: nothing stops any of us from volunteering for any of those nonprofits anytime, but something about gathering for an intense push generates enthusiasm and momentum in a way that scattered efforts rarely do. I guess that's why conference sprints exist, too. This being Sunday, it occurs to me that most churches have pitiable websites; I wonder if churchgoing geeks could do a gathering to fix some of those up. Call it a "Sprint to Emmaus" or something.

Anyway, the broadening is nice and all, but someday I'd like to be on a Pythonista team at GiveCamp. I think it would need to be preceded by an effort to convince a requesting nonprofit to ask for a Python-based project. Nonprofits always come to SWOGC requesting a specific technology, almost always something from the PHP or Microsoft universes, simply because that's what they know about. Hmm, I wonder if it would be unethical to say, "For your project, we've used a special cutting-edge version of WordPress called 'Django'..."

A great weekend. Thanks to Andrew Douglas, my team leader, and to the GiveCamp organizers!

Tuesday, October 16, 2012

Columbus Python Workshop, Jan 18-19

Happy Ada Lovelace Day!

Announcing the first

Columbus Python Workshop

for women and their friends

Jan. 18-19, 2013

The Columbus Python Workshop for women and their friends is a free hands-on introduction to computer programming that's fun, accessible, and practical even to those who've never programmed at all before. We empower women of all ages and backgrounds to learn programming in a beginner-friendly environment.

Thanks to Pillar Technologies for hosting the workshop in their brand-new office in Columbus' Short North!

The workshop is the latest in a series based on the famous Boston Python Workshop; they've already introduced hundreds of beginners to programming in Boston, Indianapolis, Portland, Chicago, and Kansas City. Now it's Ohio's turn, so spread the word!

Get more details and sign up now: https://openhatch.org/wiki/Columbus_Python_Workshop

Traditionally, Ada Lovelace Day is celebrated by highlighting the achievements of present and past women in science and technology. Today, instead, I'm saluting the contributors of the future!

Thursday, October 11, 2012

IPython Notebook tutorial with doctest feedback

I'm increasingly amazed at IPython Notebook, and want to use it for an interactive tutorial. I'd like the notebook to be full of exercises for the student to fill out, and to get feedback from the notebook itself - a lot like CodingBat but in IPython Notebook format.

Here's the code: ipython_doctester

Next step - maybe - would be to finish with a scorecard cell summarizing the student's overall progress.

And then... automatically push data on a student's progress up to a webserver on the instructor's machine? Which presents a dashboard showing her where everybody is and what everybody is struggling with...

Like every open-source author, I'm eager for feedback!

This dip into IPython Notebook reminds me of people who suggested years ago that I should integrate SQLPython into IPy. Indeed, writing a SQL-handling extension for IPy sounds really attractive... I wonder how many insomniac nights it would take...

Wednesday, October 10, 2012

doctesting just one function

There's no such function as doctest.testfunc. Or doctest.testclass, or, for that matter, doctest.testobj. However, you can run the doctests on a single function or class with doctest.run_docstring_examples, like so:

doctest.run_docstring_examples(myfunction, globals=globals())
"That's OK", I thought, "My function doesn't call any globals, so I'll just pass in an empty dictionary." Wrong. run_doctstring_examples actually needs your globals to find the object you're testing; you'll get

    NameError: name 'myfunction' is not defined
The docs say the function is "rarely useful", but I'm finding it very useful for an IPython Notebook-based interactive tutorial I'm hoping to work up shortly!

Sunday, April 22, 2012

Indianapolis Python Workshop for women and their friends - the results

This April 13-14, Mel Chua, Jessica McKellar, and I ran the first annual Indianapolis Python Workshop for women and their friends... and I loved it!

We borrowed our curriculum (not to mention Jessica) from the Boston workshop, and the time they've put into fine-tuning it really shows. The participants varied from absolute first-time programmers to computer science graduate students, but the materials did a great job of not leaving anybody behind.

I chatted with a few of the participants about their backgrounds and motivations for coming, and I was fascinated by the diversity among them. One woman was re-entering the programming workforce after a decade away. One was an artist and designer of 3D games who wanted to learn to script her favorite gaming engine. One was the business manager for an IT firm who wanted a deeper understanding of the nuts and bolts of her own company. And, of course, several were students, from high school through graduate school.

We had roughly 20 participants, plus assistants from IndyPy, and the classroom dynamics were great. Usually, when running an IT event, I strain to convince the participants on to work together. Far too many programmers tend to struggle along in private silence, each at their own machine, which ruins the point of having a group learning event in the first place. Not our workshop students, though! They did a wonderful job of grouping up and helping each other out. I loved the sound of students teaching each other and laughing with each other. We had lots to teach and we worked them hard, but they met the challenge with enthusiasm and teamwork. I'm really looking forward to seeing them again at IndyPy's project night on May 8.

We have many thanks to give! Thanks to the Python Software Foundation and FewerHassles for their financial support; to DirectEmployers for their logistical help; to Indiana LinuxFest for providing a locale; and to the Boston Python Workshop for sending Jessica and all her experience. Mel and I are looking forward to keeping the ball rolling with more workshops in Indianapolis and elsewhere in the Midwest. Please contact <mpw-staff at lists.openhatch.org> if you'd like to help make it happen.

Saturday, March 31, 2012

Indianapolis Python Workshop for women and their friends

Mel Chua, I, the team from the Boston Python Workshop, and IndyPy are all working together to bring about the Indianapolis Python Workshop for women and their friends in just two weeks!

There are several great things about this style of workshop:

- It's designed for beginners. No, really. I've taught what I thought of as "introductions" before, but like most non-beginners, I'm way too prone to zoom ahead and forget what it's really like for beginners. The BPW staff has worked hard to overcome this, and put together an amazing curriculum that really covers what beginners need in detail.

- The participants will be mostly (but not exclusively) women. There is an awkwardness about being the "only girl in the room" which, when heaped on top of garden-variety beginners' nervousness, can make people decide to just stay home... or make them nervous as heck if they do come. (There's nothing like feeling like the reputation of all women everywhere rest on your n00bish shoulders...) The quickest way to short-circuit that problem is to make sure that there are plenty of other girls in the room!

- It's very hands-on, concentrating on getting people using and enjoying code in a short time.

- It's designed to help participants plug immediately into using and enjoying their local developers' community, moving from the workshop into cooperative Project Nights with their local user group. In fact, this workshop takes place at Indiana LinuxFest, so their first exposure to the user community is right outside the door.

Please tell the Midwesterners you know. And if your company is excited about this, too, talk to me about sponsorship opportunities!

Monday, March 12, 2012

PyCon 2012

Best. PyCon. Ever.

And since PyCon is like my Christmas (in the 5-year-old sense: "I get new toys to play with!"), that's extremely high praise.

This isn't a proper retrospective - don't know if I'll have time to write one - but I just wanted to give thanks and glory to Jesse Noller, the entire volunteer staff (from whom I was notably absent), the proud ranks of the sponsors, and the awesome participants (the word is definitely "participant", not "attendee"). If you were wondering if PyCon's magic could scale, be reassured: the rainbows only proliferate.

PyOhio CFP should be out within a couple weeks, too.

Sunday, February 26, 2012

SENDING TO EVERYONE. PASS IT ON.

I think I need to create a script that

1. Scans my gmail inbox for any mail whose subject line uses ALL CAPS and which urges me to forward it to everyone I know;
2. Searches snopes.com for the message body;
3. Replies with a link to the top Snopes hit and its text, plus a preachy little sermon by me on the importance of Truth

... all automatically.

What sort of tools can I use to make such a script?

If you don't know, please forward my question on to everyone you know. It's very important. It probably involves President Obama and/or dead babies.

Wednesday, February 22, 2012

slides from Saturday class

Hi, Python students from Saturday! Hope you enjoyed the class, and thanks for your patience as we struggled with wireless issues.

Here's the updated class materials I promised - if you can, install Visual Python on your machine and try out some of the suggestions given in the comments at the bottom of move.py and gravity.py.

I'm very fortunate to be able to go to PyCon this year, and I plan to come to the Dayton Dynamic Languages meeting the following Wednesday (March 14) bubbling over with stuff I learn there - I'd love to see you there! Bring whatever Python project you've been working on and we'll help push you over any bumps you've hit, or strategize on ideas for new projects.

Tuesday, February 14, 2012

Growth in PyCon sponsorship

When I teach Python, I usually include a slide or two about Python's importance and growth. At this point, that's begun to feel unnecessary - but I think I will include this illustration, because it's a neat one.

In 2004, I'd just started looking at Python. When I found out that PyCon would be just a few miles from my sister-in-law's house, I thought, "Why not?" - and I fell in love with the Python community forever. PyCon 2004 had nine sponsors.


This year, I barely squeaked my registration in before the blast doors slammed shut. Here are PyCon US 2012's sponsors.

Sunday, February 12, 2012

Free Python class in Dayton

This Saturday (Feb 18, 2012), Sinclair Community College in Dayton will host Python: Programming is Fun Again, a two-hour introduction to the language.

It's a hands-on workshop, so bring a laptop if you can.

I'm teaching, so you can expect some planets to collide. However, this time, the aim is to help you get your own feet wet in actual programming. We'll start with simple 3-D graphical scenarios, and students will decide how to tweak and evolve the programs from there.

Contact Dr. Shirley Stallworth (shirley.stallworth@sinclair.edu) to register and for detailed directions and parking information.

Afterward, you can stop by TechFest, also running at Sinclair!

Pass the word along!

February 18, 2012 1012pm
Python: Programming is Fun Again
Sinclair Community College, room 14130
444 W 3rd Street
Dayton OH 45402-1453 USA
A free, hands-on introduction to Python programming
Free Python class in Dayton

This hCalendar event brought to you by the hCalendar Creator.

Saturday, February 11, 2012

HTSQL-powered Flask

With seven lines of code, you can plug HTSQL into a web application platform like Flask. Yes, I know that you know SQLAlchemy already; the point is that then your Flask apps can support HTSQL's rich in-the-URL filtering language. (Also, it lets you skip the schema definition step for read-only apps.)

For instance, this app serves reports from HTSQL's sample "University" database. Each report can run as-is

http://localhost:5000/hardcourses

or can accept arbitrary HTSQL filters

http://localhost:5000/hardcourses?title~'ogy'

The advantage over plain HTSQL is that you can use full Flask power. In this case, the reports come through a template that includes functioning links in each row, so it's a drill-down report:

<td><a href="/departments?code='{{ row.department_code }}'">
{{ row.dept }}</td>


Here are the magic seven lines:

htsql = HTSQL('pgsql:uni') # customize me

def data(qry):
filters = flask.request.url.replace(flask.request.base_url, '', 1)
if filters and ('?' in qry): # this can be fooled by a filtered subquery
filters = '&%s' % filters.strip()[1:]
qry = '%s%s' % (qry, filters or '')
return htsql.produce(qry)

Now each of your report pages asks for data in the form of an HTSQL query, and the ``data`` function appends any user-supplied filters to that:

return flask.render_template('departments.html', data=data(qry))

full code for the sample app

Thursday, January 12, 2012

Movie Night at the user group

At Dayton Dynamic Languages last night, we watched a great video, "Git for Ages 4 and Up". ("WARNING: CHOKING HAZARD - Small Parts. Not For Children Under 4 Years.") We had a great time, and I learned a bunch of things that I literally put to use for work on the bus home that night.

So, what's the difference between watching a video at home and watching it at a user group meeting? The all-important pause key. Every couple minutes, one of us would say, "Wait, what?"; we'd pause and discuss. Discussion is always the best part of a user event; anytime I help organize an event where the attendees don't start talking to each other, I'm disappointed. DDL never has a problem with discussion, but the video acts as a great tool to help seed and drive the conversation.

Now I'm thinking that all sorts of groups may want to add an occasional Movie Night to their regular meeting schedule. There are plenty of great video sources like Python Miro Community, but watching with your friends adds enormously to the experience.

[Hi to all my friends at CodeMash! Sorry I'm not there... next year in Sanduskalem, right?]