Category Archives: Inside Look

Inside Look – Git Flow

Working on small projects, picking up a version control system (VCS) was hardly a must for me. I don’t any project here has ever had more than 4 people working on it at once. Nevertheless, using Git and a well established process can be incredibly useful for even the individual coder. It allows a one (or multiple people) to work on multiple paths of a project without (or at least little) worry of seriously corrupting the source code. Git is known as a decentralized version control system. There is no one golden repository which everyone must work from. In fact, any individual has their own copy of the repository which they can use to track their own local changes as they’re working. There are many ways to use Git to keep on top of a project and I think everyone finds their own style, but I’d like to share what I’ve been using.

My projects consist of two main branches, master and develop. These branches will always exist and will never be removed.

The two main branches.

The two main branches.

Master is considered sacred and only touched if a completely sound production release is ready. Instead, develop contains typically the latest, active, and (reasonably) working code. When a the team has a new feature they want to introduce, they create a branch off of develop. This is called a feature branch. This is worked on until completed and then merged back into develop. Sometimes, merges may happen before a feature is fully completed. Maybe there was a specific change that needed to be present in develop for other feature branches or some bug was found.

A feature branch example

A feature branch example.

In a perfect world, these are all the branches of code you would ever need to care about. There are many corner cases that can occur where you may need to create a hotfix branch to fix a bad release on master, you may have a feature with sub-features being worked on, and many more. For a nice example, here’s a bigger picture of what that may look like.

A full Git Flow example.

A full Git Flow example.

Huge credit goes to Vincent Driessen for these images. You can find his post at which describes the full process. Over a year ago when I was just getting into this Git thing, his post allowed me to finally grasp a good method of using this powerful tool.

Tagged , , ,

Inside Look – pyjs

Although not directly affiliated with my own personal project, I still want to try making some posts about interesting Python things I run across and use. Today’s Inside Look is about pyjs! I mentioned it in my last post, but I wanted to give a little more insight into it and why I have been using it.

Now that I’ve been working on some web development, I was thinking my only options would be Javascript and some CSS. I started doing some self-learning to review what Javascript I knew, but for what our team wanted to do, it felt so cumbersome and difficult to will the code to my expectations. This spurred me on to look for some alternative, maybe a way that I could stay with Python, but have all power and control that Javascript has. I nearly immediately ran into pyjs, the Python web app developer’s best friend. It quite literally converts your written Python code into Javascript. There is a large support for most of Python’s built-ins and most imported modules seem to work just fine. I’ve had some issues with using time.sleep(), but I may just be doing something wrong. Pyjs also includes its own module which contains a large amount of UI classes to use and expand upon.

I’ve been designing the prototype for the game using Panels. These are simply cells in a table. Eventually, I would like to progress to using the Canvas. This will probably require more art assets (just basics available right now) and some re-organizing of existing code to be more Canvas, less table. I’m having a meeting tonight with the three other team members to go over weekly progress and what we’d like to focus work on. Hopefully we can get a place to host our app (we’re looking at Chrome Web Store) so we can get testing on multiple platforms and make it easily available for people to play!

If pyjs just isn’t flexible enough or proves to much of a hurdle just to use Python, we may eventually switch over to Javascript. At least transferring Python over to Javascript will be easy!

Tagged , ,

Inside Look – Eclipse IDE and PyDev

For my IDE of choice when working with my project, I use Eclipse. I was introduced to Eclipse a couple years after I had made the first iteration of The First Fantasy. Now instead of Java, I use it for Python development. To do this, I use PyDev. There’s a ton of features, including the ones you would expect from a proper IDE like code completion, syntax highlighting, code coverage, and a debugger. It feels natural and provides me really everything I need as a Python newbie. In fact, it’s probably got more features than I’d ever use in my lifetime.

Eclipse has literally hundreds of additional software projects that can be installed to enhance productivity. PyDev is just one of these. Another tool that I use is EGit, a git plug-in to allows me to perform version control operations from within the IDE. I’ll go into EGit more in a later, as it can be pretty complex compared to other VCS solutions and deserves its own post.

What IDE do you use? I hear all sorts of methods that people use to work on their code and a surprising number of them use basic text editors such as VIM or Sublime to write code. I couldn’t submit myself to that kind of torture for larger projects, but I’d imagine it would feel good to make something from complete scratch with little assistance.

Tagged , , ,

Inside Look – py2exe

Early on in development, I immediately recognized the need for The First Fantasy to be easy distributed and ran without handing over a load of source files and asking the user to build them and also have the Python interpreter on their machine. This is where py2exe came in for me.

py2exe is a Python Distutils extension which converts Python scripts into executable Windows programs, able to run without requiring a Python installation.

The output from using the utility is what I zip and make available in the Downloads page. Nifty huh? All that’s needed is to create a simple file in your working source directory with the following:

from distutils.core import setup
import py2exe


Then, through a batch file or command line, execute both of the commands:

python install
python py2exe

Py2exe will create a build and dist directory. The build directory can be discarded, but the dist directory contains everything needed (besides possibly a couple .dlls that the user should have) to run the program. Numerous options exist that allow you to modify the output such as renaming the executable, choosing where to place the dist directory, and several optimization options.

Tagged ,
%d bloggers like this: