Skip to main content

Posts

Showing posts with the label python

Announcing Feet, a Python Runner

I've been working on a problem that's bugged me for about as long as I've used Python and I want to announce my stab at a solution, finally! I've been working on the problem of "How do i get this little thing I made to my friend so they can try it out?" Python is great. Python is especially a great language to get started in, when you don't know a lot about software development, and probably don't even know a lot about computers in general. Yes, Python has a lot of options for tackling some of these distribution problems for games and apps. Py2EXE was an early option, PyInstaller is very popular now, and PyOxide is an interesting recent entry. These can be great options, but they didn't fit the kind of use case and experience that made sense to me. I'd never really been about to put my finger on it, until earlier this year: Python needs LÖVE . LÖVE, also known as "Love 2D", is a game engine that makes it super easy to build ...

The Range of Content on Planet Python

I've gotten a number of requests lately to contribute only Python related material to the Planet Python feeds and to be honest these requests have both surprised and insulted me, but they've continued. I am pretty sure they've come from a very small number of people, but they have become consistent. This is probably because of my current habit of writing about NaNoWriMo every day and those who aren't interested not looking forward to having the rest of the month reading about my novel. Planet Python will be getting a feed of only relevant posts in the future, but I'm going to be honest: I am kind of upset about it. I don't care if anyone thinks it is unreasonable of me to be upset about it, because the truth is Planet Python means something to me. It was probably the first thing I did that I considered "being part of the community" when I submitted my meager RSS feed to be added some seven years ago. My blog and my name on the list of authors at Plan...

The Curl Pipe

If anything deserves to be called an anti-pattern it is probably the common and worry-inducing practice of documenting your installation process by asking asking users to copy and paste a line into their shell that will snag some file off the internet and pipe its contents directly into your shell to execute. Sometimes this is even done as root. This is something known to be awful, but which remains a cornerstone via its use by some of the most important tools in our belts. Homebrew does it. NPM does it, too. And some projects look better, but are they? Pip asks you to download get-pip.py and run it to install, which isn’t practically any different than piping from curl, just less efficient. But worst of all, we might as well be doing this even more often, because our most depended about tooling is all just as guilty even without doing the curl pipe sh dance. What do you think happens when you pip install your favorite Python package, anyway? Pip downloads a file from the int...

Julython is on!

I'm participating in Julython , are you? Julython is a great initiative to promote Python developers focusing on their own projects through the month of July and contributing to the community providing great software, great libraries, and great tools. Sign up, track your commits on GitHub and BitBucket, and tell your dev friends to take part. Julython is going to be a lot of fun! Here's my profile

How To use Sphinx Autodoc on ReadTheDocs with a Django application

Sphinx is awesome for writing documentation. ReadTheDocs is awesome for hosting it. Autodocs are great for covering your entire API easily. Django is a great framework that makes my job easier. Between these four things is an interaction that only brought me pain, however. I'm here to help the next dev avoid this. Autodocs works by importing your modules and walking over the classes and functions to build documentation out of the existing docstrings. It can be used to generate complete API docs quickly and keep them in sync with the libraries existing docstrings, so you won't get conflicts between your docs and your code. Fantastic. This creates a problem when used with Django applications, where many things cannot be imported unless a valid settings module can be found. This can prevent a hurdle in some situations, and requires a little boilerplate to get working properly with Sphinx. It require a little extra to get working on ReadTheDocs. What makes this particularly h...

Announcement: Tracerlib 0.1 Released

Tracerlib is a set of utilities to make tracing Python code easier. It provides TracerManager , which can allow multiple trace functions to coexist. It can easily be enabled and disabled, either manually or as a context manager in a with statement. Tracer classes make handling the different trace events much easier.   class TraceExceptions ( Tracer ): def trace_exception ( self , func_name , exctype , value , tb ): print "Saw an exception: %r " % ( value ,)     Tracer is also easily capable of filtering which events it listens to. It accepts both an   events parameter, a list of trace events it will respond to, and a watch parameter, a list of paths it will respond to in the form of package.module.class.function . This can easily wrap a trace function, or you can subclass Tracer and implement one of its helpful trace_*() methods. And, a helper class FrameInspector which wraps a frame and makes it trivial to inspect t...

ANN: straight.command 0.1a1 - A command framework with a plugin architecture

New Project Announcement: I'd like to announce a new project, based on straight.plugin, a command framework that provides a declarative way to define command-line options, sub-commands, and allows plugins from third-parties to expand commands. This is all very early, I'm calling this version 0.1a1 and lots of things are missing, but here is an example (which works) of a small todo application built with this. #!/usr/bin/env python from __future__ import print_function import sys from straight.command import Command , Option , SubCommand class List ( Command ): def run_default ( self , ** extra ): for line in open ( self . parent . args [ 'filename' ]): print ( line . strip ( ' \n ' )) class Add ( Command ): new_todo = Option ( dest = 'new_todo' , action = 'append' ) def run_default ( self , new_todo , ** extra ): with open ( self . parent . args [ 'filename...

ANN: straight.plugin 1.3 released - with docs!

I think it is worth a new release to announce that I have documented straight.plugin and published the docs to ReadTheDocs. I hope this will help anyone who has had trouble parsing my terse README file, and will improve adoption of the project in the future. Check out the new code and the new docs .

ANN: Django Better Cache 0.5 Released

I am announcing the release of Django Better Cache 0.5 today. This release includes a move to sphinx as a documentation tool and a new component, the bettercache.objects module, which provides a lite ORM-like interface for caching data. Please read the full, but short documentation over at Read The Docs for details on the bettercache {% cache %} tag and the bettercache.objects ORM, and have a much easier time with your caching needs. Here is just a quick example of the new cache models, from the docs: class User ( CacheModel ): username = Key () email = Field () full_name = Field () user = User ( username = 'bob' , email = '[email protected]' , full_name = 'Bob T Fredrick' , ) user . save () ... user = User . get ( username = 'bob' ) user . email == '[email protected]' user . full_name == 'Bob T Fredrick'

ANN: straight.plugin 1.2 Released

Erik Youngren contributed the loading of packages as plugin modules, which should be useful to a number of users who have module needs that don't fit in a single .py file. This release also includes .egg packages for Python 2.6, 2.7, and 3.2 versions. Enjoy! Get the new release here  http://pypi.python.org/pypi/straight.plugin/1.2 Or, go straight to the source at http://github.com/ironfroggy/straight.plugin

Relearning Twisted.web

I want to use Twisted.web for some projects, and I haven't used it in years. I'm relearning and I feel like a novice all over again, as I should, given the years that have passed since I have seriously looked at any twisted code. I miss it, very much. Want to relearn or learn for the first time? I can't stress enough the excellence of a quick pass through the examples of Twisted.web in 60 Seconds . Go through those immediately. Afterwards, I read up on the new twisted.web.template, which is based on the Nevow templates I worked with so long-feeling ago, and I'm pretty happy with what I see there. I'm wondering how well it will produce HTML5 compliant markup, not that it is very strict, but it looks pretty clear. My brain still thinks in asynchronous operations and I constantly have to unravel those thoughts and figure out how to express them, non-ideally, in a synchronous workflow. This is becoming tiring, and while I don't plan on leaving Django, I do plan...

ANNOUNCE: straight.plugin - A simple plugin loader for Python 2.7 - 3.2

Tonight I uploaded straight.plugin 1.1 to the Python Package Index. This release includes a new loader, straight.plugin.loaders.ClassLoader and adds an subclasses parameter to the simple load() API to invoke class loading, opposed to the default module loading. The classes are filtered by type and are looked up in the same modules that would be loaded by the ModuleLoader available in straight.plugin 1.0. This release has been testing on Python 2.7 and 3.2. You can check out the source at github or the packages at PyPI .

Ways Django Can Import Things

How many ways can django import a module? Grep is hard for this. In .py files "import (.*)\..*" "from (.*)\..* import .*" "patterns\(['"](.*)['"]" "url(r?['"].*, ['"](.*)" In INSTALLED_APPS and other settings. Am I missing any? Better question: Why do I have to wonder if I'm missing any?

DeferArgs on GitHub

A time ago I wrote a library called DeferArgs and I used it when I was still in Twisted code every day. I no longer have that fun, but I was reminded of the code and decided to throw it onto GitHub for anyone who cares for it. http://github.com/ironfroggy/DeferArgs An example usage, where foo could take any deferreds and would be called when they all fire. @deferargs def foo():     assert False @catch(AssertionError) def onAssert(error):      print "OOPS"      @catch()              def onOthers(error):      print "I WOULD BE REACHED FOR ANYTHING NOT CAUGHT ABOVE." @cleanup                                            ...

How To Backport Multiprocessing to 2.4 and 2.5

Just let these guys do it for you. My hats off to them for this contribution to the community. It is much appreciated and will find use quickly, I'm sure. I know I have some room for it in my toolbox. Hopefully, the changes will be taken back to the 2.6 line so that any bugfixes that come will help stock Python and the backport. So, if you don't follow 2.6/3.0 development you might not be aware of multiprocessing, the evolution of integrating the pyprocessing module into the standard library. It was cleaned up and improved as part of its inclusion, so its really nice to have the result available to the larger Python user base that is still on 2.5 and 2.4. Although some edge cases might still need to be covered, the work is stable quickly. Here's an overview incase you don't know, so hopefully you can see if it would be useful for any of your own purposes. I think, starting out, there is more potential for this backport than the original multiprocessing module. Thus, I ...

How To Join The Python/XKCD Rejoicing

I am saying nothing new here but I do this not for reddit votes, diggs, comments, or hits, but for love. This about a great online comic that completes my geek morning three days a week and the thing that lets me make all the big bucks: XKCD and Python, together at last . Congratulations!

How To Fullfil The (Geek) Rockstar Dream

I've been putting a lot of though to my ongoing desire to write something in the way of a video game. This was my original foray into programming and I just didn't stick with it. Turns out I am such a geek that I actually found database design and protocols more interesting than first-person shooters. Go figure. Still, the old dream burns inside me. I've spoken with a few people here and there that could gain interest if I started something, and I'm thinking the time is arriving that I buckle down into the nights and see what I can do. I've been looking pygame versus pyglet and hoping to find a ready-to-use accelerated sprite library. Although I really want to write a straight Python, installable game, the lure of the web is strong. There are a lot of fun ideas I could try there, and probably a much larger audience I would reach. Of course, there are pros and cons to both. Web-Based Installable Pros Zero installation Higher number of users One target platform (for t...

First Week At SocialServe

My first full week at Social Serve ended yesterday with me jetting out early to try and avoid the rush hour traffic on top of race weekend conjestion going past Lowe's Motor Speedway. Turns out, everyone else had the same idea. Still, most days I seem to be able to make good time if I just get out before the real traffic clogs the roads. I've learned a few tricks, as well, like avoiding I-77 completely on the way home in favor of Brookshire all the way to the 85 junction. Avoiding the ramps between three interstates makes a huge difference. The work itself has been good. I still am learning my way around the existing code, and making my fair share of suggestions to improve things with all the stuff I see from the Python community. I'm looking forward to doing some fun stuff. I've joined the commit team on the GeoPy project to push some patches and further work I've done on it for Social Serve. Where things are is a surprisingly difficult problem to deal with.

How To Work At SocialServe.com

Here are my instructions to anyone else who may want to work at SocialServe.com: Have a strong enough interest and passion for development to start a contracting business without any formal training. Support yourself for about a year and a half working for one client and the next. Move to an area populated enough to start a user group for your favorite development language, tool, or concept. (Mine was Python) Be suggested to send in a resume to the company of one of the first members. Sweat your way through the first real interview for the kind of job you've wanted your whole life. Cross your fingers not to screw it up. So, that's my story. I had my interview last Tuesday, called Thursday, and started Friday. I've enjoyed it a lot. Learning my way around the codebase has been going pretty well and I've already got my first couple of commits in, as well as two small projects. I like to think I'm moving along nicely. One of the things I need to get used to is that all...