The nice people at Mojang, who write Minecraft, also provide class libraries in Java and Python to simplify interactions with the game, which are in the ~/mcpi/api/[java/python] directories.
Create a directory for the program
Copy the python class library from minecraft to the programs directory
Create minecraft-api.py python program
or open Idle and save minecraft-api.py to the minecraft-api directory
The complete code repository is also on github, https://github.com/martinohanlon/minecraft-api.git.
Note - minecraft must be running and you must be in a game
or if using Idle, click Run Module
Performance (on pre-release 0.1)
If you are using the pre-release (version 0.1) of Minecraft you will probably notice that the performance of the API is pretty slow, one of the key reasons for this is that the connection module supplied by mojang, prints the commands sent to the server, which is really useful for debugging but VERY slow - you can turn this off by modifying the connection.py module.
Change the send function and comment out the 2 print statements, so it looks like this:
Check out my minecraft posts, such as a game of Hide and Seek in Minecraft, an Auto Bridge, no matter where you walk a bridge will always be under your feet or a Massive Analogue Clock, big enough so you can walk on the arms.