Transforming Code into Beautiful, Idiomatic Python
Kanonvideo om hur Python skall se ut.
Framsteg på Logorator igen!
Har spenderat lite tid på att refactora stora delar av koden. Lagt till en del fler enhetstester. Särskilt mycket nyutveckling har det inte blivit än. Nästa stora ryck blir att lägga till så att jag kan generera något som kan renderas av three.js typ (WebGL!)
Work in progress; Mac OS X application launcher.
Väldigt inspirerad av Alfred såklart. Kommer vara open source.
Spotlight search with python example
2012-10-22, 15:15 | Python, Spotlight, Kod, Mac OS X,
Var nyfiken på hur det här fungerade, så jag knappade ihop ett exempel på hur man kan göra.
Framsteg idag igen. Generatorspecifik kod som blandar två L-system. Funkar helt ok, men behöver nog mer pillande med för att bli riktigt schyst.
Logorator v0.1
Det börjar likna något! För några dagar sedan nådde jag milstolpen med grundläggande blandning/mixande av olika vyer.
Egentligen inga spännande eller fina bilder. Men projektet går framåt, använder bloggen som en changelog. Idag har jag gjort om strukturen lite så att det är möjligt att ha flera ‘generatorer’ i samma vy. Här två instanser av LSysGen.
L-systemet kan producera plantor nu då pop och push-operationerna fungerar som de skall. Har även gjort så det går att titta på varje vy individuellt.
Ambitiöst projekt/verktyg, som jag grejar med för tillfället. Python+Pyglet.
bpython interpreter
2012-05-21, 08:48 | Python, Kod, Programmering, Mjukvara,
bpython is a fancy interface to the Python interpreter for Unix-like operating systems (I hear it works fine on OS X). It is released under the MIT License. It has the following features:
- In-line syntax highlighting.
- Readline-like autocomplete with suggestions displayed as you type.
- Expected parameter list for any Python function.
- “Rewind” function to pop the last line of code from memory and re-evaluate.
- Send the code you’ve entered off to a pastebin.
- Save the code you’ve entered to a file.
- Auto-indentation.
- Python 3 support.

Introducing Plumbum - Shell Combinators
2012-05-12, 13:54 | Plumbum, Python, Mjukvara, Kod, Programmering, Shell,
Python.
Plumbum was born to fill this very gap: on the one hand, be pythonic (and be backed by strong libraries), and on the other, make it all as easy and one-liner-ish by nature: use a real programming language, with a well-behaved object model and high level concepts, to achieve what you’d normally do in a shell script, with the same expressive power and wrist-handiness of the shell. I call it shell combinators, as they mimic shell syntax, but keep you pythonic.
Plumbum is actually a collection of utilities that I wrote for several separate projects, but the time has come to consolidate them into a single, production-grade library. The library provides local and remote program execution, with support for piping and IO redirection; local and remote file-system path abstraction; a programmatic command-line interface (CLI) toolkit, and numerous other utilities.
Exempel:
from plumbum import local
from plumbum.cmd import wc, ls, echo, grep
from plumbum.utils import copy, delete
delete(local.cwd // "*/*.pyc")
for fn in local.cwd / "src" // "*.py":
print wc("-l", fn)
num_of_src_lines = (ls["-l"] | grep["\\.py"] | wc["-l"])()
echo["1"] > "/proc/sys/net/ipv4/ip_forward")()