bitmath-1.0.8-1 was published on 2014-08-14.
Last week I wrote about bitmath, a Python module I made for working with (prefix) units commonly used to represent file sizes, e.g., kB, GiB, Byte, TB. I can now happily say that python-bitmath has passed the review process and has been officially accepted into Fedora!
Need more proof?
UPDATE 2014-10-17 – Installation of the “Insensitive Message Tray” extension has solved my issue with the notification bar frequently appearing when I did not want it to. This is on Gnome version 3.10.2. Note that pressing the Super+M keyboard shortcut will allow you to view the message tray when you want to.
My old work laptop, the ThinkPad T510, went out of warranty a few months ago. At work this means I’m eligible for a hardware refresh, i.e., a new laptop. Because they’re so much thinner and lighter, this time I decided to go with the 400 series. All in all it’s a fine piece of hardware, so long as you’re running Fedora 20 (or newer). I have two lingering issues however.
The T440s is one of those laptops trying it’s hardest to emulate the Apple Trackpad. That is to say, the T440S has one giant touchpad, no left/right/middle buttons. Unfortunately for Linux users, this is usually either a hit or a miss. It was a miss for me.
My problems with laptop touchpads usually come down to a few basic things:
And specific to the T440s:
In the past I’ve dealt with the former issues by simply disabling tap to click and touchpad scroll regions. But the T440s is an entirely different beast which required quite a bit more effort to make it usable.
I’ve written a new Python module which I’m calling bitmath.
Given my day job as a System Administrator, and the content of my upcoming book on Linux virtual disks, I frequently find myself in situations requiring me to convert file sizes into various other formats. I recall far too many instances of having to do unit conversions mid-code in projects (does this look familiar to anyone else?):
Thus, out of necessity, bitmath was born.
I’m going to plagiarize myself here and rip the long description right from the project:
bitmath simplifies many facets of interacting with file sizes in various units. Examples include: converting between SI and NIST prefix units (GiB to kB), converting between units of the same type (SI to SI, or NIST to NIST), basic arithmetic operations (subtracting 42KiB from 50GiB), and rich comparison operations (1024 Bytes == 1KiB).
In addition to the conversion and math operations, bitmath provides human readable representations of values which are suitable for use in interactive shells as well as larger scripts and applications.
Anyone not deeply invested in the heartache that comes with converting base-2 and base-10 prefix units can stop reading now.
bitmath finally provides a uniform way to manipulate these units in a way which is natural to Python programmers. There’s nothing special or unusual required to work with bitmath objects. You can add them, subtract them, multiply and divide them — just like you’re already used to with the int and float objects. bitmath objects support all of the standard Rich Comparison Operators as well!
Converting bitmath objects is a first-class supported operation. Even more complex conversions, like converting from Mibibits to Kilobytes, is trivial. This functionality is supported in both directions: from the lowliest Bit() object through the grand EiB() object. That is to say, any bitmath object, whether it be base-2 (NIST ‘kibi’ and ‘gibi’ style) or base-10 (SI ‘kilo’ and ‘giga’ style), supports conversion (without loss of accuracy) to any other valid prefix unit.
As the previous two examples demonstrated, bitmath objects have useful console representations, as well as string representations. In a future release the format string for this may be configurable.
Fedora/RHEL6 users will need to wait a bit longer for a proper yum install command to be available, as the package
is currently sitting in the package-review queue awaiting judgement. Update: 2014-03-27: python-bitmath is now in Fedora!
However, there are several other methods available for installation: installing from PyPi, building your own RPM, and from setup/distutils.
[..] this post describes our journey from initially trying to implement a simple solution to improve the day-to-day lives of developers, through the technical limitations we experienced along the way, and finally arrives at the empathy for our developers we’ve gained from that experience. We’ll wrap up with a note on how Red Hat Software Collections (announced as GA in September) would’ve simplified our development process.