Skip to content

Releases: scott-griffiths/bitstring

bitstring-4.4.0

10 Mar 20:47

Choose a tag to compare

This version adds a new optional Rust-based backend. This is turned off by default so shouldn't affect users. The new backend uses the tibs library, which is by the same author as bitstring and should allow some nice optimisations as the whole stack can work together.

For now the Rust backend is about the same speed as the C backend (which uses bitarray) so there are no real advantages to use it yet. If you do want to try it then you'll need to set the BITSTRING_USE_RUST_CORE environment variable.

BITSTRING_USE_RUST_CORE=1 python your_script.py

You can check which backend is being used using bitstring.options.using_rust_core which should be False unless you've enabled it as detailed above.

The plan is to remove the C backend in version 5, which will allow lots of code simplifications and further performance improvements.

The tibs dependency is a bit experimental and difficult to test on every possible platform. If you experience any issues with installation then please file a bug report.

The only other change is explicit support for Python 3.14.

bitstring-4.3.1

22 Mar 09:46

Choose a tag to compare

Updated bitarray dependency to allow for v3.x. Issue #355.

bitstring-4.3.0

01 Jan 14:24

Choose a tag to compare

A minor update, fixing a few issues and updating dependencies.

  • Upgraded bitarray dependency to >= 3.0.0.
  • Explicit support for Python 3.13.
  • Removed the 'experimental feature' label from the new exotic floating point types.
  • Fix for LSB0 slicing issue. Bug #343.

bitstring-4.2.3

25 May 21:11

Choose a tag to compare

More small bug fixes related to some of the new (beta) float formats.

  • Some codes representing exotic float negative zero converted to positive zero. Bug #333.
  • Auto-scaling rounding the wrong way on occasion. Bug #334.

bitstring-4.2.2

10 May 19:47

Choose a tag to compare

A couple more minor bug fixes.

  • Sometimes a ValueError was being raised instead of a ReadError. Bug #325.
  • Initialising a bitstring from None now raises a TypeError rather than generating
    an empty bitstring. Bug #323.
  • Fixed performance regression for find / findall in some situations. Bug #326.
  • Fix for AttributeError bug when combining Bits with BitStream. Bug #329.

bitstring-4.2.1

24 Apr 19:52

Choose a tag to compare

Fixing a few regressions introduced in 4.2.0.

  • Module crashes on import with 32-bit Python. Bug #317.
  • Lists of integers not converted to bytes when using the bytes constructor. Bug #318.
  • Empty comma separated tokens not handled correctly. Bug #319.
  • Crash on import when docstrings not present due to optimize flag. Bug #321.

bitstring-4.2.0

22 Apr 07:48

Choose a tag to compare

This release contains a fairly large refactor of how different types are managed. This
shouldn't affect the end user, and the main noticeable change should be the new Dtype
class, which is optional to use.

Support for 8-bit and smaller floats has been reworked and expanded. These are still
a 'beta' feature.

Backwardly incompatible changes:

  • Dropped support for Python 3.7. Minimum version is now 3.8.
  • For tokens that use a non-numeric length, a ':' is now compulsory rather than
    recommended. For example use 'uint:foo' instead of 'uintfoo'.
  • The previous e4m3float and e5m2float formats have become the slightly modified
    p4binary8 and p3binary8 formats.
  • Some parameters are now enforced as positional only, such as auto in constructors.

Other changes:

  • The Array class is no longer 'beta'.

  • A new Dtype class can be optionally used to specify types.

  • The bitstring.options object is now the preferred method for changing module options.
    The bitstring.lsb0 and bitstring.bytealigned variables are now deprecated, use
    bitstring.options.lsb0 and bitstring.options.bytealigned instead.

  • New fromstring method as another way to create bitstrings from formatted strings.
    Instead of relying on the auto parameter you can now optionally use fromstring.

  >>> s1 = BitArray('u24=1000')  # This is still fine
  >>> s2 = BitArray.fromstring('u24=1000')  # This may be clearer and more efficient.
  • More types can now be pretty printed. For example integer and float formats can be used.
  >>> s.pp('u15, bin')
  • Pretty printing is now prettier - optional terminal colours added.

  • A range of 8-bit, 6-bit and even 4-bit float formats added (beta):
    p3binary8: IEEE 8-bit floating point with 3 bit precision.
    p4binary8: IEEE 8-bit floating point with 4 bit precision.
    e5m2mxfp: OCP 8-bit floating point with 3 bit precision.
    e4m3mxfp: OCP 8-bit floating point with 4 bit precision.
    e2m3mxfp: OCP 6-bit floating point with 4 bit precision.
    e3m2mxfp: OCP 6-bit floating point with 3 bit precision.
    e2m1mxfp: OCP 4-bit floating point with 2 bit precision.
    e8m0mxfp: OCP 8-bit unsigned floating point designed to scale the other formats.
    mxint: OCP 8-bit floating point that is a scaled integer representation.

  • Performance improvements.

bitstring-4.1.4

29 Nov 18:18

Choose a tag to compare

Fixing a regression introduced in 4.1.3

  • 'bytes' token can't be used without explicit length. Bug #303.

bitstring-4.1.3

22 Nov 17:25

Choose a tag to compare

A maintenance release, with some changes to the beta features introduced in 4.1.

  • Removed a couple of files that accidentally got included in the previous release. Bug #293.
  • The 8-bit float formats have been renamed 'e4m3float' and 'e5m2float'.
  • Some refactoring and performance optimizations.

bitstring-4.1.2

07 Sep 20:19

Choose a tag to compare

Another maintenance release. Once again some small changes to the 'beta' Array class,
plus new Array functionality.

  • Fix for the module command-line usage. Bug #290.
  • Fix for when creating bitstrings from memoryview objects.
  • Renamed the 'fmt' parameter for Arrays to 'dtype'.
  • More Array operator coverage.
  • Added operators that act on two Arrays of the same size.
  • Added comparison operators for Arrays that return an Array of bools.
  • Added Array.equals method as == will now return an Array (see above item).
  • Added astype() method for Arrays to easily cast to a new dtype.