Technitribe

interesting problems (and a few solutions, too)

Technitribe
  • About the Authors
  • Log In
  • Log Out
  • Lost Password
  • Register
  • Reset Password
    • 24 Aug 2016

      bitmath-1.3.1 released

      Written by Tim Bielawa

      bitmath is a Python module I wrote which simplifies many facets of interacting with file sizes in various units as python objects. A few weeks ago version 1.3.1 was released with a few small updates.

      Updates

      • New function: bitmath.parse_string_unsafe(), a less strict version of bitmath.parse_string()

      This new function accepts inputs using non-standard prefix units such as single-letter, or mis-capitalized units. For example, parse_string will not accept a short unit like ‘100k‘, whereas parse_string_unsafe will gladly accept it:

      • Documentation Refresh: The project documentation has been thoroughly reviewed and refreshed.

      Several broken, moved, or redirecting links have been fixed. Wording and examples are more consistent. The documentation also lands correctly when installed via package.

      Getting bitmath-1.3.1

      bitmath-1.3.1 is available through several installation channels:

      • Fedora 23 and newer repositories
      • EPEL 6 and 7 repositories
      • PyPi

      Ubuntu builds have not been prepared yet due to issues I’ve been having with Launchpad and new package versions.

      0 Comments
    • 3 Feb 2016

      bitmath-1.3.0 released

      Written by Tim Bielawa

      It’s been quite a while since I’ve posted any bitmath updates (bitmath is a Python module I wrote which simplifies many facets of interacting with file sizes in various units as python objects) . In fact, it seems that the last time I wrote about bitmath here was back in 2014 when 1.0.8 was released! So here is an update covering everything post 1.0.8 up to 1.3.0.

      New Features

      • A command line tool, bitmath, you can use to do simple conversions right in your shell [docs]!
      • New utility function bitmath.parse_string for parsing a human-readable string into a bitmath object
      • New utility: argparse integration: bitmath.BitmathType. Allows you to specify arguments as bitmath types
      • New utility: progressbar integration: bitmath.integrations.BitmathFileTransferSpeed. A more functional file transfer speed widget
      • New bitmath module function: bitmath.query_device_capacity(). Create bitmath.Byte instances representing the capacity of a block device
        • This my favorite enhancement
        • In an upcoming  blog post I’ll talk about just how cool I thought it was learning how to code this feature
        • Conceptual and practical implementation topics included
      • The bitmath.parse_string() function now can parse ‘octet’ based units
        • Enhancement requested in #53 parse french unit names by walidsa3d.
      • New utility function: bitmath.best_prefix()
        • Return an equivalent instance which uses the best human-readable prefix-unit to represent it
        • This is way cooler than it may sound at the surface, I promise you

      Bug Fixes

      • #49 – Fix handling unicode input in the bitmath.parse_string function. Thanks drewbrew!
      • #50 – Update the setup.py script to be python3.x compat. Thanks ssut!
      • #55 “best_prefix for negative values”. Now bitmath.best_prefix() returns correct prefix units for negative values. Thanks mbdm!

      Misc

      To help with the Fedora Python3 Porting project, bitmath now comes in two variants in Fedora/EPEL repositories (BZ1282560). The Fedora and EPEL updates are now in the repos. TIP: python2-bitmath will obsolete the python-bitmath package. Do a dnf/yum ‘update‘ operation just to make sure you catch it.

      The PyPi release has already been pushed to stable.

      Back in bitmath-1.0.8 we had 150 unit tests. The latest release has almost 200! Go testing! :confetti:

      1 Comment
    • 28 Sep 2014

      New update for python-bitmath released

      Written by Tim Bielawa

      bitmath-1.0.8-1 was published on 2014-08-14.

      Major Updates

      • bitmath has a proper documentation website up now on Read the Docs, check it out:
        • bitmath.readthedocs.org
      • bitmath is now Python 3.x compatible
      • bitmath is now included in the Extra Packages for Enterprise Linux EPEL6 and EPEL7repositories
      • merged 6 pull requests from 3 contributors

      Bug Fixes

      • fixed some math implementation bugs
        • commutative multiplication
        • true division

      Changes

      Added Functionality

      • best-prefix guessing: automatic best human-readable unit selection
      • support for bitwise operations
      • formatting customization methods (including plural/singular selection)
      • exposed many more instance attributes (all instance attributes are usable in custom formatting)
      • a context manager for applying formatting to an entire block of code
      • utility functions for sizing files and directories
      • add instance properties equivalent to instance.to_THING() methods

      Project

      Tests

      • Test suite is now implemented using Python virtualenv’s for consistency across across platforms
      • Test suite now contains 150 unit tests. This is 110 more tests than the previous major release (1.0.4-1)
      • Test suite now runs on EPEL6 and EPEL7
      • Code coverage is stable around 95-100%

      Examples Below the Fold

      (more…)

      1 Comment
    • 27 Mar 2014

      python-bitmath – Now available in Fedora!

      Written by Tim Bielawa

      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?

      References:

      • bitmath on the Python Package Index
      • bitmath on GitHub (with examples!)
      • original blog post about bitmath
      2 Comments
    • The Authors
    • Virtual Disk Guide

      Interested in virtualization? Do QCOWs rule your filesystem? Are you a libvirt or KVM+QEMU wizard? I wrote a book about virtual disk management. Check out the The Linux Sysadmin's Guide to Virtual Disks online for free at ScribesGuides.com.


      Consider supporting the author by purchasing a hard copy of the first edition for just $10.00 on Lulu.com.

    • bitmath

      bitmath is a Python library for dealing with file size units (GiB's, kB's, etc) in a sane way. bitmath supports arithmetic, rich comparison, conversion, automatic best human-readable representation, and many other utility functions. Read some examples on the docs site or check out the source on GitHub.

    • latest posts

      • Using jq to filter an array of objects from JSON September 9, 2019
      • Two Year Break — And we’re back! November 16, 2018
      • [Updated] GitHub + Gmail — Filtering for Review Requests and Mentions January 20, 2017
    • tags

      bitmath blog conference css dblatex DNS DocBook eclipse Emacs Erlang Fedora fedora 22 filter GNU Screen Haiku Introduction java jboss LCSEE Linux locale locales fix slicehost ubuntu Macports module nist nXML-Mode opengl open source OS X package packaging pki prefix units presentation project pypi Python scholarship si summit Tutorial ubuntu xcode XML XMPP
    • h4ck teh world

      tbielawatbielawa

    Creative Commons License
    Technitribe by Tim Bielawa is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.