Philadelphia Python Workshop/Setup/Linux project dependencies: Difference between revisions

imported>Abatula
(Created page with "==ColorWall== 200px ===Install ColorWall dependencies=== If you are running Ubuntu or Debian, at a Terminal prompt run: <pre>sudo apt-get ins...")
 
imported>Abatula
 
(7 intermediate revisions by the same user not shown)
Line 1:
==ColorWall==
 
[[File:Colorwall_matrix.png|200px]]
 
===Install ColorWall dependencies===
 
If you are running Ubuntu or Debian, at a Terminal prompt run:
 
<pre>sudo apt-get install python-tk
</pre>
 
You will be prompted for your administrative password.
 
This will install the <code>python-tk</code> package, which is used by the ColorWall project.
 
===Download the ColorWall project===
 
You'll be writing graphical effects for an existing ColorWall project. Download this ColorWall code and example effects so you're ready to start working with them tomorrow:
 
# Right click the following file, click "Save Target as..." or "Save link as...", and save it to your Desktop directory:
#* http://web.mit.edu/jesstess/www/BostonPythonWorkshop6/ColorWall.tar.gz
#Find ColorWall.tar.gz on your Desktop and double-click on it. A window will pop up with some options about how to "extract" the file. Leave the defaults where they are and click the "extract" button. That will create a folder on the Desktop called ColorWall containing several files.
 
===Test the ColorWall code===
 
Start a command prompt and navigate to the Desktop/ColorWall directory where the ColorWall code lives. For example, if the ColorWall project is at <code>/home/jesstess/Desktop/ColorWall</code>,
 
<pre>
cd /home/hello/Desktop/ColorWall
</pre>
 
will change you into that directory, and
 
<pre>
ls
</pre>
 
will show you the source code files in that directory. One of the files is "run.py", which has a ".py" extension indicating that it is a Python script. Type:
 
<pre>
python run.py
</pre>
 
at the command prompt to execute the run.py Python script. You should see a window pop up and start cycling through colorful effects. If you don't, let a staff member know.
 
Now type:
 
<pre>
python run.py -a -s
</pre>
 
at the command prompt to execute the run.py Python script so that it runs only the advanced effects. You should see a window pop up and start cycling through different colorful effects. If you don't, let a staff member know.
 
You can also run both sets of effects by typing:
 
<pre>
python run.py -a
</pre>
 
===Success!===
 
You've completed setup for the ColorWall project.
 
==Wordplay==
 
Line 108 ⟶ 45:
<ol>
<li>Click and save these four dependencies to your Desktop:
* https://github.com/abatula/PythonWorkshop-Twitter/archive/master.zip
* http://mit.edu/jesstess/www/BostonPythonWorkshop6/Twitter/httplib2-0.6.0.zip
* http://mit.edu/jesstess/www/BostonPythonWorkshop6/Twitter/simplejson-2.1.6.zip
* http://mit.edu/jesstess/www/BostonPythonWorkshop6/Twitter/python-twitter.zip
* http://mit.edu/jesstess/www/BostonPythonWorkshop6/Twitter/python-oauth2.zip
</li>
<li>
Line 120 ⟶ 54:
===Install the Twitter project dependencies===
 
Each of these 4 dependencies has an installer script that we'll need to run at a command prompt to installUnzip the software. '''It is important that the dependencies are installed in thefile orderyou listedjust abovedownloaded.''' For each project, startOpen a command prompt and navigate to the Desktop directory where the source codeunzipped livesfolder. For example, if theyou httplib2-0.6.0extracted projectthe was extractedfolder to /home/jesstessmyname/Desktop/httplib2PythonWorkshop-0.6.0Twitter-master, the command
 
<pre>
cd /home/jesstessmyname/Desktop/httplib2PythonWorkshop-0.6.0Twitter-master
</pre>
 
will changemove you into that directory, and
 
<pre>
Line 132 ⟶ 65:
</pre>
 
will show you the source code files in that directory. In this directory are five folders: Twitter (the main folder) and four dependency folders (simplejson-3.3.0, python-oauth2-master, httplib2-0.8, and python-twitter-1.0). Three of the dependency subfolders have an installer script that we'll need to run at a command prompt to install the software. For each dependency (in the order: simplejson-3.3.0 python-oauth2-master httplib2-0.8) navigate to the folder using cd. For example:
will show you the source code files in that directory. One of the files is "setup.py", which has a ".py" extension indicating that it is a Python script. Type:
<pre>
cd simplejson-3.3.0
</pre>
to move into the subfolder for simplejson from the main PythonWorkshop-Twitter-master folder. Use the ls command again to display the source code files in the directory. One of the files is "setup.py", which has a ".py" extension indicating that it is a Python script. Type:
 
<pre>
Line 138 ⟶ 75:
</pre>
 
type in your password, and hit enter to install httplib2simplejson.
 
To return to this main folder, use the cd command again to move up one directory:
Navigate to the 3 other dependency directories and run
 
<pre>
cd ..
</pre>
 
 
Navigate to the 2 other dependency directories and run
 
<pre>
Line 160 ⟶ 104:
</pre>
 
Now use cd to move into the python-twitter-1.0 folder. This time we will run the two following commands to install the dependency:
===Download the Twitter project===
<pre>
python setup.py build
sudo python setup.py install
</pre>
 
And type in your password when prompted.
We've written some skeleton code for the Twitter project already. Download this code so you're ready to start working with it tomorrow:
 
===Test the Twitter code===
 
Within the python-twitter-1.0 folder, run
<pre>
python twitter_test.py
</pre>
 
After it runs, it should state that it ran 41 tests on the code, and the final line should say "OK." If your test failed, ask an instructor for help.
 
After successfully testing the dependencies, use the cd command again to navigate to the Twitter folder. Use the ls command again to view the files in this folder. One of the files is "twitter_functions.py", which has a ".py" extension indicating that it is a Python script. Open this file in your text editor and find the line that says:
<pre>
CONSUMER_SECRET = 'We will give this to you in class :)'
</pre>
 
Change the string to the consumer secret string that we will give you in class. Save the file and go back to the command line. Now type:
 
<pre>
python twitter_api.py --search=python
</pre>
 
at the command prompt to execute the twitter_api.py Python script. You should see the text from 20 tweets containing the word "Python" printed to the screen. If you don't, let a staff member know.
 
===Success!===
 
You've completed setup for the Twitter project.
 
==ColorWall==
 
[[File:Colorwall_matrix.png|200px]]
 
===Install ColorWall dependencies===
 
If you are running Ubuntu or Debian, at a Terminal prompt run:
 
<pre>sudo apt-get install python-tk
</pre>
 
You will be prompted for your administrative password.
 
This will install the <code>python-tk</code> package, which is used by the ColorWall project.
 
===Download the ColorWall project===
 
You'll be writing graphical effects for an existing ColorWall project. Download this ColorWall code and example effects so you're ready to start working with them tomorrow:
 
# Right click the following file, click "Save Target as..." or "Save link as...", and save it to your Desktop directory:
#* http://web.mit.edu/jesstess/www/BostonPythonWorkshop6/TwitterColorWall.tar.gz
#Find TwitterColorWall.tar.gz on your Desktop and double-click on it. A window will pop up with some options about how to "extract" itthe file. Leave the defaults where they are and click the "extract" button. That will create a folder on the Desktop called TwitterColorWall containing several files.
 
===Test the TwitterColorWall code===
 
Start a command prompt and navigate to the Desktop/TwitterColorWall directory where the TwitterColorWall code lives. For example, if the TwitterColorWall project is at <code>/home/jesstess/Desktop/TwitterColorWall</code>,
 
<pre>
cd /home/jesstesshello/Desktop/TwitterColorWall
</pre>
 
Line 182 ⟶ 175:
</pre>
 
will show you the source code files in that directory. One of the files is "twitter_apirun.py", which has a ".py" extension indicating that it is a Python script. Type:
 
<pre>
python twitter_apirun.py --search=python
</pre>
 
at the command prompt to execute the twitter_apirun.py Python script. You should see thea textwindow frompop 20up tweetsand containingstart thecycling wordthrough "Python" printed to thecolorful screeneffects. If you don't, let a staff member know.
 
Now type:
 
<pre>
python run.py -a -s
</pre>
 
at the command prompt to execute the run.py Python script so that it runs only the advanced effects. You should see a window pop up and start cycling through different colorful effects. If you don't, let a staff member know.
 
You can also run both sets of effects by typing:
 
<pre>
python run.py -a
</pre>
 
===Success!===
 
You've completed setup for the TwitterColorWall project.
 
==State Capitals==
Line 205 ⟶ 212:
You are done installing dependencies for the Saturday projects.
 
[[BostonPhiladelphia Python Workshop 6/FridaySetup|&laquo; Back to the Friday setup page]]
Anonymous user