A question about using docker to make contributing to OSS projects easier

I started writing this in a IRC channel earlier today, but I figured it might be useful share the question and the answer here, to capture it for others. Yes it is a bit lazyweb, but I can’t be the only one doing this, and I’ll share the answer here:

I’m working on a django project, and I’m interested in making a dockerfile so people who want to contribute, but don’t use pip or pipenv regularly, but have used docker before can contribute.

I use circle CI for CI, and I use their docker files for running tests on the project. Is it common/recommended to use the same for easy dev environments?


How to search better with Atom

I’ve been using Atom as my text editor for longer than any other text editor now, after using Textmate, Sublime Text, and Vim for a couple of years each. In this post, I show a little tip I’ve discovered to help make searching more powerful.

Using Atom?

I like using Atom as an editor.

It’s free, open source, polished, under constant development in the open with a well funded team, and on the whole, I agree with Alex Payne’s post about the flight to old text editors feeling like mis-step.

It’s easy enough to start with, and can adapt to work well with many, many languages. It’s what I’d recommend to most people learning to code too.

However, because it isn’t a full IDE, you do need to know how to use the search tools to get the most from it.

Searching for things that match one pattern, but not another

As the wonderful flight manual from Atom editor describes in more detail, you can search in within files, and search within projects easily, by hitting cmd+F to search in a file, and cmd+shift+F to search across your project.

This is nice, and it’s common to search for a pattern like some_function  or some class like Page in your existing project.

This example here shows a personal site I used to run, searching for mentions of Page in an django project:

Screen Shot 2017-05-11 at 22.13.25.png
I’m getting all kinds of maches, including ones in files I don’t want

However, lets say you’re working on an app, where you’re sure you don’t want to look in some kinds of files that also end in .py. This might be some migration files, which are written in python, but you know you won’t want to look in them for code that controls how an application works right now. To filter out all the migration files, you can and a second negated pattern, by adding the bang/exclamation mark instead, like so:

Screen Shot 2017-05-11 at 22.13.47.png
That’s more like it, no migration files in the search results. Huzzah!

This is, really, really handy when working with javascript projects, and huge node_modules directories. More here in this forum thread on discuss.atom.io.

Searching across files you normally want to ignore in a project

The other handy trick I’ve started using a fair amount of late, and especially since I started writing in javascript and python more is toggling the search behaviour between to ignore the files that you have told git to ignore with a .gitignore file, and including them when you’re trying to understand where a given bit of code came from.

You can do this the quick and dirty way by opening up Atom’s config file here:

Screen Shot 2017-05-11 at 22.25.08.png

And in the config.cson file that’s presented ​to you, making sure you have this property set to either true or false:

excludeVcsIgnoredPaths: true

If you have this set to true, you’ll have faster searching of just the files and folders you have decided to ignore with your gitignore file. But if you do need to search for something in something like a node_modules folder in javascript, in a virtual environment in Python, you can toggle this by setting this value to true or false.

I only really discovered these this year, and it’s not something I new how to do before, and I figured Atom others might find it useful too.

Hope it helps, and happy searching! If you use Atom, and there are any other gems like this, feel free to add a comment below.



Handy snippets – Python without the .pyc cruft

I maintain a huge workflowy file of snippets and tricks and, I suspect some of them will be handy for others to use too. I’m going to sharing them regularly, when I’m not sure what to write, mainly to keep the habit of blogging, until it comes naturally.

Part of my professional life, involves me writing a fair amount of python code. When you write python, you end up creating lots of files ending with .py, but when you run the code, you end up with compiled python files, sending in pyc.

If you don’t want loads of pyc files crufting up your workspace, and you’re workignon the command line, there’s a handy little environment variable you can set in your shell, to banish those ugly files once and for good. Run this command before working (or better yet, make it run whenever you open a terminal window):


See, isn’t that better?

I picked up this gem from the Hitchhiker’s Guide to Python, a free, opinionated book from Kenneth Reitz about good practices with working with Python. Reading it will almost certainly improve your python – I know mine is better as a result of spending some looking over it.