@ wrote... (7 years, 2 months ago)

Well, I finally released alkali into the wild.

Alkali is a simple database that makes it very easy to specify the on-disk format of your data. This makes it easy to use your existing data files as tables in a database. Plus the api is based off of Django models.

This is my first real project that I've released and it's a surprising amount of work. I have a new level of appreciation for all the libraries that I just blithely download and use without a second's thought.

For instance, it took about the same amount of time to write the docs as it did to write the actual code. Plus there are a lot of moving pieces to release open source software the right way.

  • use git as your source code control
  • write documentation, learn Sphinx and reStructuredText
  • when you push to github, triggers are fired
  • push release to PyPi, writing setup.py is very non-trivial, learn how that works
  • try to do some marketing on Reddit. Given my zero karma I suck at marketing and/or programming.

So yeah… please go check out alkali!

Category: tech, Tags: alkali, python
Comments: 0
@ wrote... (7 years, 6 months ago)

Yesterday I was working on Pygments during a Pycon 2016 sprint and added markdown syntax highlighting (with help from Tim Hatch). My pull request just got merged so version 2.2 will finally highlight GitHub flavored markdown (issue).

Category: tech, Tags: python
Comments: 0
@ wrote... (7 years, 6 months ago)

I was working on Magic Wormhole during a Pycon 2016 sprint and noticed that zipfiles don't preserve file permissions. I'm not the only one who's noticed this (some posts go back over five years) but it still doesn't appear to be fixed.

Anyhow, here's how I did it…

more…

Category: tech, Tags: python
Comments: 1
@ wrote... (10 years, 1 month ago)

For funsies I ported my mazesolver to pypy.

See update 2 for reference.

more…

Category: tech, Tags: mazes, python
Comments: 0
@ wrote... (10 years, 2 months ago)

Python tempdir.mkdtemp() has an annoying feature, it doesn't clean up after itself.

This idea comes from my friend and colleague Mike.

more…

Category: tech, Tags: python
Comments: 0
@ wrote... (10 years, 7 months ago)

This was originally the majority of this post: Start a django project the right way but I've decided to put in it's own post instead.

I'm assuming you're on OSX. If you're on Linux most of these steps will be the same. If you're on Windows… Install VMWare and then install Linux.

I've added a tl;dr at the end.

Although I have tweaked this over the years, the original code came from (I think, I've long since lost the bookmark) klymyshyn.com

more…

Category: tech, Tags: python, shell
Comments: 10
@ wrote... (10 years, 10 months ago)

Although I doubt I'm forging into unknown territory, here is a nice little way I came up with to iterate around a box or square.

def next_coord( w, h ):
    """
    get the next x,y coordinates around your box
    w,h are the width and height of your box

    note, the strange ranges are to prevent getting the corners twice
    this loop configuration goes around clockwise from top left

    for x,y in next_coord(3,3):
        print "(%d,%d)" % (x,y),
    >>> (0,0) (1,0) (2,0) (2,1) (2,2) (1,2) (0,2) (0,1)
    """
    for x in range(0,w-1):        # top
        yield x,0
    for y in range(0,h-1):        # right
        yield w-1,y
    for x in range(w-1,0,-1):     # bottom
        yield x,h-1
    for y in range(h-1,0,-1):     # left
        yield 0,y
Category: tech, Tags: programming, python
Comments: 0
@ wrote... (12 years, 10 months ago)

Continuing from maze solver update, I came across another very large maze at Purpy Pupple wikipedia page. And when I say large, I mean 4000x4000 large. Purpy calls it 2000x2000 but since it is very clearly 4000 pixels by 4000 pixels I'm calling it as 4k.

more…

Category: tech, Tags: mazes, python
Comments: 0
@ wrote... (13 years, 2 months ago)

Here's a follow up to my previous post, maze solver. I've finally gotten around to solving this properly with a breadth-first search. Shortest path is 16031, 11% better than my previous best.

more…

Category: tech, Tags: mazes, python
Comments: 1
@ wrote... (14 years ago)

I saw a recent post of the most incredible maze I've ever seen. Well I just had to solve it.

more…

Category: tech, Tags: mazes, python
Comments: 0