Skip to content

Releases: dargueta/binobj

0.6.2

05 Mar 16:39
5707d71
Compare
Choose a tag to compare

Released 2019-03-05

Deprecations

The load, loads, dump, and dumps of Field classes are deprecated in favor of from_stream, from_bytes, to_stream, and to_bytes for consistency with the Struct methods.

Other Changes

  • Minor typo fixes in the documentation.
  • Changed imports in internal code to stop importing fields from binobj.
  • Upgraded test dependencies.

0.6.1

22 Feb 15:54
Compare
Choose a tag to compare

Released: 2019-02-22

Bugfixes

  • Array used to dump all items in the iterable given to it, ignoring count. Now it respects count, and will throw an ArraySizeError if given too many or too few elements.
  • Timestamp and subclasses treated naive timestamps as in the local timezone when dumping, but when tz_aware is False timestamps were loaded in UTC instead of being converted to the local timezone. This asymmetric behavior has been corrected, and naive datetimes are always local.
  • Bytes would always write its const value, even if a different value was passed to it.
  • Bytes always treated its size as if it were an integer, and never supported other valid things like field names or objects, even though all other scalar fields do.
  • Bytes didn't support being unsized.
  • Bytes threw an UnserializableValueError if given anything other than bytes or a bytearray. This was not in line with the other fields' behavior where they would "let it crash" if given an invalid type.

Other Changes

  • Validators are no longer called when setting a field value. This would cause crashes when a validator depends on two fields; if one is updated, the condition may no longer be true, even if the user would've updated both fields before dumping.
  • field_object.default will return const if const is defined but no default value was passed in. If you think about it, this makes far more sense than the original behavior where it returned UNDEFINED.
  • Added new example with CPIO archive reader.

0.6.0

16 Feb 15:52
Compare
Choose a tag to compare

Released: 2019-02-16

New Features

New field types were added:

  • Float16: half-precision floating-point numbers. While this has technically
    been supported since 0.4.3, it was never made explicit. Float16 only works
    on Python 3.6 and above. Attempting to use it on Python 3.5 will trigger a
    ValueError.
  • Timestamp, Timestamp32, and Timestamp64.

Bugfixes

  • Integer accidentally used some positional arguments instead of keyword-only.
    Only a breaking change for people who used it directly (rare) and ignored the
    "only use keyword argumets" advice.
  • Integer wasn't catching OverflowError and rethrowing it as an
    UnserializableValueError like it was supposed to.
  • helpers.iter_bytes() would iterate through the entire stream if max_bytes
    was 0.
  • Struct.to_dict() didn't omit fields marked with discard.

Breaking Changes

  • Support for Python 3.4 was dropped (deprecated 0.5.1).
  • Zigzag integer encoding support was dropped (deprecated 0.5.0).
  • Removed the validation module and moved the decorator marker to decorators.
  • Struct.to_dict() now omits fields marked with discard. They used to be
    left in due to a bug that has now been fixed.
  • Float and String field class constructors have been changed to throw
    ConfigurationError instead of other exception types, to be more in line
    with the other fields.

0.5.2

16 Feb 15:56
Compare
Choose a tag to compare

Released: 2019-01-31

Fix typo in homepage URL in metadata. Otherwise identical to 0.5.1.

0.5.1

16 Feb 15:55
Compare
Choose a tag to compare

Released: 2019-01-31

This release is functionally identical to 0.5.0; changes are completely internal.

Breaking Changes

Setuptools < 30.3.0 (8 Dec 2016) will no longer work, as configuration has been
moved to setup.cfg. Please install a newer version with pip3 install -U setuptools.

Deprecations

Support for Python 3.4 is deprecated and will be dropped in 0.6.0. Python 3.4
reaches end-of-life in March 2019 and will no longer be maintained. See PEP 429
for full details.

0.5.0

22 Dec 06:41
Compare
Choose a tag to compare

Released: 2018-12-21

Features

Comparing a Struct instance to UNDEFINED is now True if and only if the
struct has all of its fields undefined. Previously a struct would never compare
equal to UNDEFINED.

Deprecations

Zigzag integer encoding support will be dropped in 0.6.0. It was an experimental
feature added when I was trying different variable-length integer formats. It's
highly specific to Protobuf and just doesn't seem useful to have here.

Breaking Changes

  • The endian and signed keyword arguments to VariableLengthInteger
    were deprecated in version 0.4.3 and have been removed.
  • The fill_missing argument to Struct.to_dict() was deprecated in version
    0.4.0 and has been removed.
  • Struct no longer behaves as a MutableMapping. All dictionary mixin
    methods have been removed. This was deprecated in 0.4.1. Several behaviors were
    broken by this change, namely that
    • dict(struct_instance) no longer works and will cause a TypeError.
      Use struct_instance.to_dict().
    • Dictionary expansion like **struct_instance will also no longer work. Use
      **struct_instance.to_dict().

Other Changes

Trivial fixes to documentation to fix broken links.

0.4.6

29 Sep 05:21
Compare
Choose a tag to compare

Released: 2018-09-28

Bugfixes

  • A fair number of documentation fixes -- better explanations, formatting fixes,
    broken internal links.
  • Fix bug in Makefile introduced in 0.4.4 where fields submodule wasn't
    detected as a dependency for testing and documentation building.
  • Work around installation crash while testing on Python 3.4, due to a known race
    condition in setuptools.

Other Changes

  • Dependencies:
    • Bump Python 3.6 testing version to 3.6.6.
    • Minimum required pytest version is now 3.1.
    • Now compatible with tox 3.x.
  • Use 3.7.0 as the default version for running stuff and testing.
  • Add deprecation warnings for (almost) all dictionary methods in Struct.
    They've been deprecated since 0.4.1 but I didn't add the warnings.

0.4.5

05 Aug 06:57
Compare
Choose a tag to compare

Released: 2018-08-04

Bugfixes

  • StringZ failed to include the trailing null when reporting its size.
  • pylint was missing from the development dependencies.

Features

Added present argument to Field that accepts a callable returning a
boolean indicating if the field is present. This is useful for optional
structures whose presence in a stream is dependent on a bit flag somewhere
earlier in the stream:

    class MyStruct(binobj.Struct):
        flags = fields.UInt8()
        name = fields.StringZ(present=lambda f, *_: f['flags'] & 0x80)

    MyStruct.from_bytes(b'\0') == {
        'flags': 0,
        'name': fields.NOT_PRESENT,
    }

0.4.4

14 Jul 22:26
Compare
Choose a tag to compare

Released: 2018-07-14

Bugfixes

  • Loading floats didn't work at all because size wasn't set in the constructor.
  • Fixed minor typo in the documentation.

Other Changes

This release is a significant rearrangement of the code, but no behavior has
changed.

binobj.fields was split from a module into a subpackage, with the following
modules:

  • base: The Field base class and a few other things.
  • containers: The fields used to nest other schemas and fields, such as
    Array and Nested.
  • numeric: All fields representing numeric values, such as integers and
    floats.
  • stringlike: All fields that are text strings or bytes.

0.4.3

10 Jul 05:47
Compare
Choose a tag to compare

Released: 2018-07-09

Bugfixes

  • You no longer need to specify the signedness of variable-length integer fields,
    since those are hard-coded by the standards anyway.
  • Outdated documentation was missing some arguments in _do_load and _do_dump
    examples.

Features

  • Added the Float32 and Float64 fields. These support 32- and 64-bit
    floating-point numbers stored in IEEE-754:2008 interchange format.
  • Added support for signed and unsigned LEB128
    variable-length integers.

Deprecations

  • Passing the signed or endian keyword arguments to a VariableLengthInteger
    is now superfluous, and will cause a DeprecationWarning. These arguments
    will be removed in a future version.
  • Importing Field objects directly from binobj is deprecated. Import
    them from binobj.fields instead. This will reduce namespace clutter.
    # Deprecated:
    from binobj import String

    # Do this instead:
    from binobj.fields import String

Other Changes

  • Use the "Alabaster" theme for documentation instead of RTD.
  • Relax the dependency on bumpversion.