Versioning your Python project for Debian

Version numbers matter! Using a consistent version numbering throughout your project’s life matters, too. Changing project name is a high price to pay for cleaning up version errors.

So there’s some good news! The Python community’s PEP-440 specifies how to use versions.

Here are some examples of versions that abide PEP-440, they are in order!!

  • 0.1.dev1 – Our first release, just playing around. We’ll delete it from PyPi.
  • 0.1a1 – After playing around, we decide to release an Alpha 1 for our 0.1 series. We don’t know if people might depend on the version, but the Alpha status suggests that the package will be removed from PyPi.
  • 0.1b1 – Then we release a Beta version.
  • 0.1 – Our final release. But of course, more will come.
  • 0.1.post1 – just an hour later, we realize that we forgot a file in and we need to release a new version. PyPi does NOT allow us to overwrite versions so we need to bump the number.
  • 0.1.1 – Following a series of issues or fixes, we release a new update.
  • 0.1.2a1 – The next release contains a couple of fixes that we wanna triage first, so we release an alpha.

…you probably get the picture.

If you are in doubt, you can play around with pkg_resource.parse_version like this:

>>> from pkg_resources import parse_version
>>> parse_version("0.1a1") > parse_version("0.1b1")

Debian compatibility

Debian does not understand “special” characters or words. It just orders by ordinals, letters coming before numbers. You can play around with the rules using this code:

$ if dpkg --compare-versions 0.1a1 lt 0.1; then echo true; else echo false ; fi

Notice that? Debian does not understand the PEP-440 convention. That’s because Debian compares 0.1a1 and 0.1 like this: 0=0, 1=1, a>(nothing), 1>(nothing).

In Debian, we should have called it:

$ if dpkg --compare-versions 0.1~a1 lt 0.1; then echo true; else echo false ; fi

This is because ~ orders higher than “nothing”.

Maintaining a correct upstream version in Debian?

It’s unfortunately not possible to maintain upstream.version~ubuntu1 in case you want to release 0.1a1 followed by0.1.

Debian has introduced “epochs” for fixing wrong or changed versions. However, it will not work to fix our systematic problems. For instance, would you like this?

  • 0:0.1a1
  • 1:0.1
  • 1:0.2a1
  • 2:0.2

Probably not a good idea.

The solution

As stated in the Debian Packaging Policy:

Although this simple approach works most of the times, you may need to adjust package name and upstream version by renaming the upstream source to follow Debian Policy and existing convention.

So with the state of things being that PEP-440 enforces a strict version syntax that’s incompatible with a strict Debian version syntax, you should rename your package_VERSION.orig.tar.gz and make sure that VERSION is always translated from your original project’s version to Debian’s way.

A work flow could look like this:

  1. Bump version number to 0.1a2, release on PyPi
  2. Go to the old debian package source and run uupdate -v 0.1~a2 /path/to/project-0.1a2.tar.gz
  3. Run dch, dpkg-buildpackage -S etc.

So we won’t have “pristine upstream version numbers”, but we’ll get pretty close.


[also brought on FAIR Denmark]

Facebook has launched, maybe a solution that will provide internet access to lots of people who need it? In this post, I’ll explain what I think about it, because certainly it doesn’t seem like a project we can just ignore.

Others are also discussing the issue, and already a group of 65 international organizations have signed a letter with lots of criticism of Facebook’s new project. Having just launched in Malawi, Lecturer of Blantyre Polytechnic University and a dear contributor to FAIR’s projects in Malawi, Bennett Kankuzi, has also joined the growing number of critics.

Common to the criticism, is being questioned because it doesn’t actually give internet access, and concerns are widespread about the fundamental break-off from net neutrality.

Here’s what I found important…

The good

It’s with seemingly good reasons and intentions that wants to invest in technological transformations to increase internet access, this becomes evident from watching Zuckerberg’s 3 minute pitch on the website.

In the video, Zuckerberg doesn’t share many details about when or how things will be done, but on the other hand, we get to see a very kind and calm Zuckerberg addressing the needy world. The story wants us to believe that creating is easy, just as when he built Facebook in a basement.

Facebook/ also put out a serious statement on the problems of 4.4 billion people, a very critical aspect of the digital divide. We agree.

As mentioned earlier, a lot of the criticism towards has been that it doesn’t provide free and unlimited internet access, but rather the opposite: An application for mobile phones giving access to Facebook and partner services. But yet, what we can say is that these services also need a communication infrastructure that’s connected to the internet. So regardless of whether or not the end users have real internet access, the project relies on an infrastructure that does.

So far, so good.

And while we’re at it, when Facebook/ talks about open source, they should have credit where credit is due for the Open Compute project. It has actually produced some results, like detailed specs for construction of data centres. Facebook has also succeeded in making prominent players like Apple and Microsoft join their venture.

The bad

Zuckerberg says that we are going to get a 100x more affordable internet by creating a 10x speed boost and making the internet 10x cheaper.

Firstly, there’s no credible details supplied for the 10x speed boost. Zuckerberg speaks of compression, caching, and cleaning up airborn signals. Can caching and compression really achieve this and why wouldn’t anybody have done that already!? The world works like this: Over-use of data costs money and makes apps run slower. Nobody wants that! It’s as if he forgets that bandwidth is also sparse in rich countries and has been even more so in the past! The incentive has always been there and has always been acted upon in both the commercial and academic world. So even if we allow him to have a naive goal, I would say that he’s going to go absolutely nowhere with this. Everything that’s worth implementing about caching and compression is trivial and will be done where needed.

Cleaning up the airwaves in developing countries? It’s hard to believe that this is a serious issue in countries that lack connectivity. I call bullshit here.

But we should also wonder why he never says anything real about the 10x cheaper factor. What does it actually mean? Does it for instance mean that will provide a connection that’s worth 1/10 of the comparative Western internet connection? As for phones, we know that Chinese manufacturers have already disregarded IP (Intellectual Property) laws and are selling dirt cheap smart phones that are going to be impossible to out-do — after all, they’re made by underpaid Chinese labour, have a minimum of quality and violates all the patents that an open source model was supposed to have delivered a cost-saving on. Again, it seems that we’re being fed bullshit.

And why does Zuckerberg talk of making the internet cheaper instead of making people in the “beneficiary” countries richer? Why should they have cheap, low quality products if we could pay everyone on the global market a decent price so everyone could afford quality? Fairphone is a better answer to these problems than trying to make phones for developing countries even cheaper than they already are.

Then Zuckerberg goes to say that making the internet 10x faster and 10x cheaper will make it 100x more affordable. Not only is it hard to understand how this logic works, but ultimately what we get is an internet that’s: Less responsive, run on slower devices, and only open up the platform to Facebook and whoever they let through the gate. This is not 100x more affordable. This is something else.

There are also other issues about

  • Mainly, it’s an app and a business model. We should be talking about it in this context.
  • It isn’t open source, yet promotes open source and open content as the solutions to global problems.. how inconsistent is that!?
  • Even though Facebook said, they’d open up the platform, you have to be approved to get content included, and maybe just maybe they’ll let you?
  • It doesn’t support end-to-end encryption, so it’s possible for Facebook to read all communication.. again, Facebook and privacy seem to be very distant.

It is far from Net Neutrality, so we have to wonder why Facebook wants this policy in the US and not in their new markets.

And what about open source hardware? Does Nokia and Eriksson really want to offer prime hardware designs for poor people? Or is this just an empty pledge? Certainly the illustration of a soldering irons and mobile phone disassembly followed up by Zuckerberg saying ” (…) building low cost open source hardware and phones” would have us believe that is going to open source mobile phones.

The ugly

Facebook launched this initiative with the name “” as if it compares to other open internet initiatives (hence the .org part). But nowhere can we see that this is an open, democratic initiative. How can you influence it? Where’s the source code?

What’s also very ugly: If Facebook wanted to use their money to do good, why not join existing initiatives? There’s already open source mobile phones, open source operating systems, mobile operators, NGOs addressing the digital divide, business and government initiatives to increase internet access etc.

But this initiative is not about joining the community or unifying civic society, governments, NGOs, and companies… this is about ownership and control of emerging markets and new communication infrastructures.. and one of the methods to get there is this a lobbying / marketing scheme called “”.

Lastly, let’s consider what they say versus what they do in general: We have to compare their good efforts to their actual capacity and reach. For instance, with the Open Compute project with Apple and Microsoft joining: How does the project scale to the full production of the world’s top ICT companies? This resembles when NestlĂ© launched a Fairtrade product, a KitKat. Did they take the non-Fairtrade KitKat off the shelves? No. Are they suddenly good guys because of this Fairtrade KitKat, a micro share of their total revenue!? They certainly would want you to think so.

Regenerating Shotwell thumbnails

When reinstalling, upgrading or moving settings, thumbnails may be missing in Shotwell. The problem can look like this:


Each time you import photos, Shotwell will generate thumbnails in two different sizes. If you loose them, you have the problem that they are regenerated on-demand, everytime you scroll by an image. That stinks.


You need to do apt-get install sqlite3 imagemagick to fetch requirements.


Here’s a script that will regenerate everything, and it’s tested on Shotwell 0.18.0. View / fork Gist souce.

# Based on
# Remove " > date('now','start of month','-1 month')" if you want to re-generate everything
sqlite3 ~/.local/share/shotwell/data/photo.db \
  "select id||' '||filename from PhotoTable where date(timestamp,'unixepoch','localtime') > date('now','start of month','-1 month') order by timestamp desc" |
while read id filename; do
  tf1=$(printf $THUMB_ROOT/thumbs128/thumb%016x.jpg $id);
  tf2=$(printf $THUMB_ROOT/thumbs360/thumb%016x.jpg $id);
  if [ -e "$tf1" ]
    echo "Skipping $filename"
    echo -n "Generating thumb for $filename";
    #echo $tf1
    convert "$filename" -quality 60 -auto-orient -thumbnail 128x128 $tf1
    convert "$filename" -quality 60 -auto-orient -thumbnail 360x360 $tf2

Nokia 301 on Wammu / Gammu

I had an older Nokia and got a new one which I needed to upload my phone book to. In order to connect to Nokia 301 from Gammu, plug the phone in with a USB cable and select the “Modem” option on the phone. The others won’t work.

Wammu is a GTK frontend to Gammu. You can use for various tasks, but I found that restoring my backup through Wammu failed (even though the file was created with Wammu), while using the commandline tool Gammu directly worked.

Firstly, use the command “gammu-detect” and find the line that reads something with “Nokia”, most likely the first line. It will contain something like:

device = /dev/ttyACM3
name = Nokia Nokia_301_Dual_SIM
connection = at

Put this info in your file ~/.gammurc. You then use this command to backup a file created from either Wammu or Gammu:

gammu -s 0 restore ~/Desktop/nokia.backup

The 0 denotes that we are using the 0th section of the configuration file, so if you don’t have any other configurations, simply leave the 0.

Ubuntu 14.04 Trusty with DNS server and NetworkManager (disabling dnsmasq)

I’ve badly been looking for a way to both run an internal network server on eth0 and connecting to any kind of internet device, be it on wlan0 or a USB dongle.

That way, I can be online and browsing documentation, downloading new stuff etc. on the server but not depend on a static configuration but still use Network Manager for its intended purpose.

In /etc/NetworkManager/NetworkManager.conf, uncomment the dnsmasq option like so, because Network Manager’s dnsmasq blocks listening to these ports if you want to run your own DNS server:

# dns=dnsmasq

But that’s not all! We need /etc/resolv.conf to be updated with the external DNS providers that Network Manager discovers. This can be achieved by removing resolvconf which automatically alters /etc/resolv.conf.

apt-get remove resolvconf

There, done! Now add static configurations in /etc/networks/interfaces.d/ or /etc/networks/interfaces and let Network Manager handle your WLAN interfaces.