This summer I started learning python in earnest. I learn best by doing, so I wanted a project that I could put together to see how all the python parts worked.
I eventually settled on a workflow library. If you’re not familiar, a workflow is made up of steps that need to be accomplished, like a programming language. Each step is a stand-alone piece of functionality and you can string steps together to do different things. It usually has a graphical component so you can _see_ what’s happening in your workflow.
The advantage of this is that it’s a simple programming language that non-programmers can use. If you have functionality in a traditional programming language, users have to wait for the entire software development life cycle to change the smallest part. The cost in time and effort is too high, so users just put up with what works instead of trying out new things. But with a workflow system in place, the users just configure the existing steps, so it’s easy to tweak the functionality to add or skip a step. They can play with new ideas to see if they are worthwhile, and throw away the ones that don’t work.
With that in mind, I set out to make a library to allow just that. It’s a good learning problem, because the challenges range from string manipulation and go all the way to dynamic class loading. Plus, there’s all the little things that you don’t use every day, like structuring the packages and uploading to PyPi.
The library itself came together very quickly. I’m only doing this in my free time (ha) but I’d say the library code came together in about 20 hours. It was a big mess of functionality that consisted of only two files: the code and the tests to run it. I always _try_ to write tests for code because it makes the code better and the time to get things working shorter. Finding bugs is just icing on the cake. Repackaging the code took less than a day, and uploading to PyPi was pretty easy. You can check it out at https://github.com/fairanswers/fair_flow
But that was just the tip of the iceberg. The problem was that I had a library, but no easy way to show off how cool it was. So I set up a separate project that lets you use a web page to create and run workflows. This required wrapping the library in a REST API and creating a front end to make it easy to use. This turned out to be a lot more work than the original library! I got a head start by modifying the code over at http://viz-js.com/ for the web page editor and rendering process, came up with some examples, and polished it until I was satisfied. You can create your own workflows or use the built-in examples to run the whole thing or just one step at a time. You can try it yourself at https://github.com/fairanswers/fair_flow_example
I still have some tweaks that I’d like to do. Python is such a fast language for getting things done it would be easy to add things for database access, API calls and asynchronous events. If you have a problem where you need to give the users some control, think about using workflows.