Python for Actual Beginners: GitHub for Windows

Once again in my attempts to learn python, I got stuck on something so basic that nobody else would explain it. I even tried searching “GitHub for complete newbies”, and the resulting tutorials still glossed over it. Maybe I should be embarrassed at how long it took me to figure it out, but I’ll ignore that in the interest of saving someone else from my fruitless searching.

I’m working on a programming project that I might share on the blog when it’s finished, but for now, I wanted to be able to save a couple of different versions of the code because I couldn’t figure out which approach was best. Version control is exactly what GitHub is for, so I decided it was time to figure out how to use it.

I managed to download and install GitHub for Windows easily enough. The instructions on the GitHub site were clear enough. However, note the last line:



See how there’s no link to instructions on how to code or edit your repository? Apparently, it’s so obvious nobody could need an explanation… Well, it is simple, but it wasn’t obvious to me.

I went the circuitous path of creating a repository on the website and pasting in some code there, instead of going straight to GitHub for Windows, which was probably a mistake. I figured out how to get access to my repository with GHfW easily enough.

The confusing part to me was that GHfW shows you the code right there in its window, but you can’t edit it. It took me an embarrassingly long time to figure out that the code is saved in a file somewhere else that you have to open with your preferred text editor/python IDE to edit. You can use the instructions here to figure out where (and change it to your preferred directory).

Here are the more straightforward instructions for creating a repository for some code you’ve already written in python:

  1. Save your .py file in a dedicated folder (the name can’t have any special characters or spaces)
  2. Drag the folder to the GHfW home screen (or click on “+create” at the top and manually point it to your folder). Your repository will appear in the list of local repositories.
  3. Click on the arrow to the right of the repository name. You’ll see a screen with several files listed on the right.
  4. Fill in the “summary” box with something that describes the current state of your project (at least that’s what I did).ghfw precommit
  5. Click “Commit”. Congratulations! You just created a repository! You can see your code by clicking on the arrow next to your .py file on the right.ghfw commit
  6. Now you can go back and edit your .py file with whatever you used to create it, and after you save any changes, GHfW will notice and show “uncommitted changes” on the left. Describe the new version and hit commitghfw uncommitted
  7. You can hit publish (in the top right) to upload your files to the cloud, too.

I haven’t figured out much more than this, but at least now I have various different versions of my program safely stored.


Python for Actual Beginners: Installing Python Packages in Windows

We have been learning Python recently. We’ve taken some MOOCs and written some programs that worked, and it all seemed to be going well. Then, I needed to install a package to do something that isn’t included in the regular Python installation.

People on Stack Overflow recommended using another package, easy_install, to make it easier to install other packages. Unfortunately, installing and using easy_install is not so easy. It doesn’t help that the responses to requests for help all assume that you’re either not using Windows at all or have far greater fluency in unix-style shell commands than I have. So, in case we need to install another package someday, or in case some other Windows user stumbles upon this, I decided to post step-by-step instructions.

First, you need to install the installer, either easy_install or pip. I have no idea which is better. They both eventually worked to install a package, which is all I’ve needed from them so far.

1. Download the special Windows version of setuptools or pip here, since the one on the developer’s site won’t work.

2. Run the executable file, making sure the installation is going into your Python folder.

3. Check that easy_install or pip is now in your python/scripts folder

Supposedly, you can add python to your Windows path so it knows how to find your scripts, but that didn’t actually do anything for me, as far as I can tell, so let’s skip it.

Now you can install other packages more easily. I installed Beautiful Soup.

1. Download the file from the developer’s website (did I actually need to do that? I never told easy_install where I downloaded it to…). No, I did not need to do this, that’s what easy_install is for!

2. Open a Windows shell (Windows+R, type cmd, hit enter)

3. Change the directory to your Python scripts folder (if you need to change drives, like I did, just type “d:” to change to drive D, for example, then “cd python\scripts”)

4. Type “easy_install beautifulsoup4” or “pip install beautifulsoup4”

5.  Be thankful that you didn’t have to spend an hour googling error messages to get it to work (or curse me because it still doesn’t work. I probably can’t help if it doesn’t).