Category archives: Snaking
Discussions of programming, particularly of programming Python
Python 2.5.6 on Ubuntu Natty... urgh...
Written by
on
in
Snaking.
Customer asked me to look at a 2.5 based project yesterday. No problem, just fire up my virtualenv and take a quick look. Hrm, no, the virtualenv isn't working... Python 2.5 isn't installed. Hrm, and it's not in the apt repository for Natty. Hrm... okay, build from source... fail on sqlite... debug... patch... build succeeds. ...
SimpleParse-pure on Python 3.2, useless, but working
Written by
on
in
Snaking.
I wanted to test PyOpenGL under 3.2 (using 2to3), but my entire test-suite is written in OpenGLContext, which is dependent on many other libraries (numpy, pydispatcher, pyvrml97, fonttools, ttfquery, simpleparse, etceteras). So, since I want to test, let's see how easy it is to convert the SimpleParse-pure project (written to test pypy speed) into a ...
PyOpenGL should now support GLE on Python 2.7
Written by
on
in
Snaking.
Got the GLE DLL built using VC9 (a.k.a. 2008), and a mechanism in place to load the GLE DLL based on which version of Python you are running (unfortunately, I don't see a good hook to check for the vcX version to use that to decide which DLL to load. In theory someone might compile ...
OpenGL up to 4.2
Written by
on
in
Snaking.
We should now have up to OpenGL 4.2 supported in PyOpenGL bzr head, should someone have a desire to play with it and hardware/drivers capable of running it.
Requests Library is nice
Written by
on
in
Snaking.
Experimented with replacing a few urllib2 calls in a product today with the requests library. Yes, requests really is nice (sat down and read through the code last night). One thing that's not obvious from the docs, to do digest auth, you pass (username, password, 'digest') as the auth parameter. There are a number ...
Run coverage of your Django test suite...
Written by
on
in
Snaking.
Since there is a 4-year old still-open ticket on this, thought I'd provide a simple recipe for getting a coverage report on your Django project:
pip install coverage
coverage run path/to/django-admin.py test myapp
coverage report -m --include="*myapp*"
coverage erase # clean up afterward/between runs
Sure, it's not --with-coverage, but it does seem to work.
Choices for Foo?
Written by
on
in
Snaking.
The choices_for_FOO hook would allow a model to restrict the choices for a given field based on e.g. another field (common requirement where you have row-level authorization and need to restrict choices to the set of records accessible by the auth-row attached to this object). It's currently a patch attached to a 5 year old ...
FakeLion rides the PyPI
Written by
on
in
Snaking.
Put a bit more work into FakeLion (L10N, get it) this afternoon to see how a particular project is doing on getting i18n coverage. I added some quick flags so you can suppress HTML-code escaping, suppress Python string-subs escaping, disable the reversing of strings, and use full-width-latin substitution characters (which does a pretty good job ...
Quick Hack to do Psuedo-Localization (l10n)
Written by
on
in
Snaking.
Pseudo-localization lets you easily see which strings in your site are not yet marked for translation. That's pretty useful if you don't yet have a real translation, but want to check whether someone could do a translation if you paid them to do so. Didn't find a good package freely available (though I imagine there ...
Django + JQuery Mobile Quick Start Tutorial
Written by
on
in
Snaking.
I've uploaded a tutorial and a very minimal library for creating JQuery Mobile sites with Django. It's actually the first time I've used PyPI's documentation hosting system, mostly because Launchpad doesn't have a web-page hosting mechanism. The library (django-jqm) is not intended to be a platform for creating "real" sites, it's just a bunch of ...