Call For Help: Convert Quickly Snippets To Python Snippets

25

As I have blogged about recently, I have been really getting into the idea of enabling opportunistic developers to get to grips with writing applications for the Open Source desktop as easily as possible. This has including raving about the awesome Quickly and I recently wrote Acire, a simple program for viewing a library of Python Snippets that can be used to read, learn from, run and help lower the barrier for making your own programs rock and roll.

Back at UDS there was an awesome snippets party which resulted in many examples on this wiki page, but it is just a webpage and of course you can’t see them in Acire, you can’t run them and you can’t play with them right away. I started moving some of them over to the Python Snippets library but I need your help! This is as simple as putting together some example programs, adding some information at the top in the comments and submitting them for review.

If we can get these (and other!) snippets included, it will be another awesome resource to enable our awesome developer community to make fantastic apps that make our desktop rock that little bit more.

Interested? Intrigued? Want to help make the goodness happen? Well, read on…

Creating Snippets

Before you create your snippets, I recommend you install the nice and fresh Acire 0.2.

Here is how you go about creating the snippets.

Step 1: Grab the library

Just run:

bzr branch lp:python-snippets 

Step 2: Create your snippet

A snippet should demonstrate a specific feature in a given module or in the Python language. This could include showing how to use a specific widget, a feature of that widget, or another function. The list of snippets in the Quickly Snippets page is ideal for porting over to snippets!

python-snippets is divided into sub-directories which outlines the theme of the snippets. You should pick the most appropriate directory to put your snippet it, and add it there. If a suitable directory does not exist already, create it and add it there.

Step 3: Add metadata

The way Acire pulls out the snippets is by detecting some specific metadata additions to comments at the top of the file You should now add the following meta data as comments to the top of the file:

# [SNIPPET_NAME: A Short Name For The Snippet] # [SNIPPET_CATEGORIES: Category]  <-- see CATEGORIES file for existing categories # [SNIPPET_DESCRIPTION: A single line description of the snippet] # [SNIPPET_AUTHOR: Your Name <
 This e-mail address is being protected from spambots. You need JavaScript enabled to view it
 >] # [SNIPPET_LICENSE: An Open Source license (from the LICENSES file)] 

Here is an example:

# [SNIPPET_NAME: Playing a Pipeline] # [SNIPPET_CATEGORIES: GStreamer] # [SNIPPET_DESCRIPTION: Construct and play a pipeline] # [SNIPPET_AUTHOR: Jono Bacon <
 This e-mail address is being protected from spambots. You need JavaScript enabled to view it
 >] # [SNIPPET_LICENSE: GPL] 

You now need to add your file to your branch with:

bzr add your-snippet.py 

Step 4: Propose it for merging

With your new snippet ready, it is time to propose it for inclusion in the main python-snippets library.

First, commit your changes to your local branch with:

bzr commit 

Now push it to your own branch on Launchpad:

bzr push lp:~<your launchpad username>/python-snippets/<name of your branch> 

As an example:

bzr push lp:~jonobacon/python-snippets/gstreamer-snippets 

Now go to https://code.launchpad.net/python-snippets and you should see your branch listed there. Click on it and when the branch page information page loads click on the Propose for merging link. Add a short description of what you examples do in the Initial Comment box and then click the Propose Merge button.

We will then review the merge and if it looks good, add it to python-snippets and it will be delivered to Acire users in the next daily package upload.

I really appreciate any time you can spend in contributing snippets!