Páginas

Saturday, February 14, 2015

typokiller: my new tool to exterminate typos in software documentation

Last year, during the Django Sprint we had in Kraków, I was working on finding and fixing typos in the Django Documentation.

It was fun to automate spellchecking the docs, but it was also very laborious to use my rudimentary tools.

This week, in a span of 2 nights and 1 morning, I worked on a minimally usable version of typokiller. The first outcome of this work was this Pull Request made just a few hours ago.

Even though typokiller is still an alpha-quality baby project, I am pretty happy that it has an interactive terminal-based UI, thanks to the awesome termbox library:

With typokiller running, a bit of patience and about 1 hour of careful inspection I was able to find 45 typos in OpenShift Origin's documentation. As you can see in the screenshot I had to go through 1583 potential typos. Thank God I implemented replace all, edit all and ignore all commands :-)

The idea behind typokiller is to have several small programs each responsible for one of these steps:

  1. Collect documentation excerpts
  2. Check spelling
  3. Interactively fix typos
Right now typokiller only supports inspecting the documentation of Go code, but I might include support for more languages in the future (or you can create and issue to tell me which language you need, or you can code it and make a pull request).

You start with a Git repository with some project containing potential typos in its documentation. You might want to create a new branch. Then you can run:


$ ./killtypos $(find /path/to/project -type d -not \( -name Godeps -prune -o -name .git -prune  \))

This will find all directories inside the project path, ignoring the subdirectories Godeps and .git, and pass that through the 3 stages of typokiller, leaving you in an interactive mode. After inspecting the potential typos, type "a" to apply the changes to the files. Review the files with Git, commit, push and make a PR.

The design was made such that I can pipe the output of one command into another, and also easily integrate with other unix tools like head, grep, etc.

That's all for now, let me know if you enjoy typokiller.

Sunday, February 8, 2015

Falcon, Django, PyPy & Docker

Late last year I learned about the Falcon Framework, one more to the list of many Python frameworks out there. Falcon focus on performance, having quite impressive benchmarks.



So I was wondering how can you have super fast API endpoints in your Python web service while still serving some legacy code in Django, or just any other WSGI-compliant framework.

The outcome of my experiment lives in this GitHub repo: rhcarvalho/django-plus-falcon-pypy.

Saturday, February 7, 2015

StarterKit - automated development environment

I've been working at Base for 439 days. That's one year, two months, and two weeks of very intensive work.

I joined in 2013 to give life to a newly formed team of Python developers, effectively introducing a new piece to our existing infrastructure, previously Ruby-based. By the way, we're hiring.

Since then we've completed a few projects and keep working on end user productivity in our product. That's pretty exciting as we're at the core of our mission of helping sales teams become 10x more productive.

High productivity is not restricted to sales people. We, as software developers, rely on productivity-boosting tools as well. How can we ship quality code fast? Sure there're a bunch of things to it, but today I'll focus on having a good development environment. We call ours "StarterKit".

Getting Base up and running requires starting tens of services written in multiple languages, frameworks, with all kinds of dependencies, so it asks for a good deal of orchestration to get it all right. 

Our most recent and best attempt to automate it all started with Mirek and Gabriel, who sat together to build StarterKit, further improved by them and several other Base developers. StarterKit is very specific to Base and our internal needs, but the tools we use to build it are open source and you can leverage them to build something that fits your needs.

StarterKit is a Vagrant virtual machine combined with Ansible playbooks to setup a working environment to run Base services in isolation of your development environment that you might be running on your host (editor, vim config, etc).

That means you get a ready-to-use Linux virtual machine, with nginx, Docker and Docker images for MySQL, Elasticsearch, RabbitMQ, etc. You'll have everything pre-configured and with the latest versions of daily used tools.

Each web service that empowers Base runs in a Docker container inside the aforementioned virtual machine. Docker is such a cool tool that deserves a separate post.

In essence, StarterKit aims at making the process of setting up a new web development machine as painless and simple as possible. So what tools do you use to automate your development environment?

927 days

Time is passing, life is changing, and there's been a long while since my last post here.

How did I fill these last 2.5 years? I'm living abroad since the second half of 2012, first in Beijing, China and now in Cracow, Poland. It would take far too long to tell all that have happened, so I'll just move on to writing new posts.