pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/devel/py-bitstring



Module Name:    pkgsrc
Committed By:   wiz
Date:           Mon Nov 13 10:59:21 UTC 2023

Modified Files:
        pkgsrc/devel/py-bitstring: Makefile PLIST distinfo

Log Message:
py-bitstring: update to 4.1.2.

--------------------------------------
September 2023: version 4.1.2 released
--------------------------------------
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.

-----------------------------------
August 2023: version 4.1.1 released
-----------------------------------
A maintenance release, with some changes to the Array class which is still in 'beta'.

* bitarray dependency now pinned to ">=2.8.0, <3.0.0" rather than a specific version. Bug #283.
* Fix for using numpy integers as integer parameters. Bug #286.
* Removed ability to extend an Array with the '+' operator. Use the 'extend' method instead.
* Improvements when pretty-printing the Array.
* Array.count() can now count 'nan' values for floating point types.

-----------------------------------
August 2023: version 4.1.0 released
-----------------------------------

This has turned into a suprisingly big release, with a major refactor and a brand new
class (the first for 12 years!) There are also a couple of small possibly breaking changes
detailed below, in particular 'auto' initialising bitstrings from integers is now disallowed.

* Speed increased with bitarray dependency.

The major weakness of bitstring has been its poor performance for computationally
intensive tasks relative to lower level alternatives. This was principally due to
relying on pure Python code to achieve things that the base language often didn't have
fast ways of doing.

This release starts to address that problem with a fairly extensive rewrite to replace
much of the pure Python low-level bit operations with methods from the bitarray package.
This is a package that does many of the same things as bitstring, and the two packages
have co-existed for a long time. While bitarray doesn't have all of the options and
facilities of bitstring it has the advantage of being very fast as it is implemented in C.
By replacing the internal datatypes I can speed up bitstring's operations while keeping
the same API.

Huge kudos to Ilan Schnell for all his work on bitarray.

* New Array class for homogeneous data (beta)

If your data is all of the same type you can make use of the new Array class, which
mirrors much of the functionality of the standard array.array type, but doesn't restrict
you to just a dozen formats.

  >>> from bitstring import Array
  >>> a = Array('uint7', [9, 100, 3, 1])
  >>> a.data
  BitArray('0x1390181')
  >>> b = Array('float16', a.tolist())
  >>> b.append(0.25)
  >>> b.tobytes()
  b'H\x80V@B\x00<\x004\x00'
  >>> b.tolist()
  [9.0, 100.0, 3.0, 1.0, 0.25]

The data is stored efficiently in a BitArray object, and you can manipulate both the
data and the Array format freely. See the main documentation for more details. Note that
this feature carries the 'beta' flag so may change in future point versions.

Other changes:

* Added two new floating point interpretations: float8_143 and float8_152. These are 8-bit
  floating point formats, with very limited range and precision, but useful in some fields,
  particularly machine learning. This is an experimental feature - the formats haven't
  even been standardised yet.

  >>> a = Bits(float8_143=16.5)
  >>> a.bin
  '01100000'
  >>> a.float8_143
  16.0

* Auto initialistion from ints has been removed and now raises a TypeError. Creating a
  bitstring from an int still creates a zeroed bitstring of that length but ints won't
  be promoted to bitstrings as that has been a constant source of errors and confusion.

  >>> a = BitArray(100)  # Fine - create with 100 zeroed bits
  >>> a += 0xff   # TypeError - previously this would have appended 0xff (=255) zero bits.
  >>> a += '0xff'  # Probably what was meant - append eight '1' bits.
  >>> a += Bits(255)  # Fine, append 255 zero bits.

  This is a breaking change, but it breaks loudly with an exception, it is easily recoded,
  and it removes a confusing wrinkle.

* Explicitly specifying the 'auto' parameter is now disallowed rather than discouraged.
  It was always meant to be a positional-only parameter (and will be once I can drop
  Python 3.7 support) but for now it's renamed to '__auto'. In the unlikely event
  this breaks code, the fix should be just to delete the 'auto=' if it's already the
  first parameter.

  >>> s = Bits(auto='0xff')  # Now raises a CreationError
  >>> s = Bits('0xff')  # Fine, as always

* Deleting, replacing or inserting into a bitstring resets the bit position to 0 if the
  bitstring's length has been changed. Previously the bit position was adjusted but
  this was not well defined.

* Only empty bitstring are now considered False in a boolean sense. Previously s was
  False is no bits in s were set to 1, but this goes against what it means to be a
  container in Python so I consider this to be a bug, even if it was documented. I'm
  guessing it's related to __nonzero__ in Python 2 becoming __bool__ in Python 3, and
  it's never been fixed before now.

* Casting to bytes now behaves as expected, so that bytes(s) gives the same result as
  s.tobytes(). Previously it created a byte per bit.

* Pretty printing with the 'bytes' format now uses characters from the 'Latin Extended-A'
  unicode block for non-ASCII and unprintable characters instead of replacing them with '.'

* When using struct-like codes you can now use '=' instead of '@' to signify native-
  endianness. They behave identically, but the new '=' is now preferred.

* More fixes for LSB0 mode. There are now no known issues with this feature.

----------------------------------
April 2023: version 4.0.2 released
----------------------------------
A maintenance release.

* Added py.typed file and converted the module to a package to let mypy find type
  annotations. Bug 248.
* Fix to shifting operations when using LSB0 mode. Bug 251.
* A few more fixes for LSB0 mode.
* Improved LSB0 documentation.
* Added build-system section to pyproject.toml. Bug 243.
* Rewrote the walkthrough documentation as a jupyter notebook.
* Updated the project's logo.

-------------------------------------
November 2022: version 4.0.1 released
-------------------------------------

This is a major release which drops support for Python 2.7 and has a new minimum
requirement of Python 3.7. Around 95% of downloads satisfy this - users of
older versions can continue to use bitstring 3.1, which will still be supported
with fixes, but no new features.

Other breaking changes are minimal, and there are a few cool features added.

Breaking changes:

* Minimum supported Python version is now Python 3.7.
* Removed ConstBitArray and BitString class aliases. Use Bits and BitStream instead.
* The cut() method will now also yield the final bits of a bitstring, even if they
  are shorter than the requested cut size.
* Removed default uint interpretation. This wasn't being applied uniformly - default
  is now always to return a bitstring object of the given length and not to interpret
  it as a uint. Bug 220.
* If an overwrite goes beyond the end of the bitstring it will now extend the bitstring
  rather than raise an exception. Bug 148.

New features and improvements:

* Type hints added throughout the code.
* Underscores are now allowed in strings representing number literals.
* The copy() method now works on Bits as well as BitArray objects.
* The experimental command-line feature is now official. Command-line
  parameters are concatenated and a bitstring created from them. If
  the final parameter is either an interpretation string or ends with
  a '.' followed by an interpretation string then that interpretation
  of the bitstring will be used when printing it.

  $ python -m bitstring int:16=-400
  0xfe70
  $ python -m bitstring float:32=0.2 bin
  00111110010011001100110011001101

* New pp() method that pretty-prints the bitstring in various formats - useful
  especially in interactive sessions. Thanks to Omer Barak for the suggestion
  and discussion.

  >>> s.pp()
    0: 10001000 01110110 10001110 01110110 11111000 01110110 10000111 00101000
   64: 01110010 11111001 10000111 10011000 11110111 10011110 10000111 11111101
  128: 11111001 10001100 01111111 10111100 10111111 11011011 11101011 11111011
  192: 1100
  >>> s.pp('bin, hex')
    0: 10001000 01110110 10001110 01110110 11111000 01110110   88 76 8e 76 f8 76
   48: 10000111 00101000 01110010 11111001 10000111 10011000   87 28 72 f9 87 98
   96: 11110111 10011110 10000111 11111101 11111001 10001100   f7 9e 87 fd f9 8c
  144: 01111111 10111100 10111111 11011011 11101011 11111011   7f bc bf db eb fb
  192: 1100                                                    c

* Shorter and more versatile properties. The bin, oct, hex, float, uint and int
  properties can now be shortened to just their first letter. They can also have
  a length in bits after them - allowing Rust-like data types. ::

      >>> s = BitArray('0x44961000')
      >>> s.h
      '44961000'
      >>> s.f32
      1200.5
      >>> s.u
      1150685184
      >>> s.i7 = -60
      >>> s.b
      '1000100'
      >>> t = Bits('u12=160, u12=120, b=100')

* Other types with bit lengths can also be used as properties ::

      >>> s.floatle64 = 10.511

* A colon is no longer required in format strings before a bit length. So for
  example `Bits('int:15=-101')` could be written as `Bits('int15=-101')`. This is
  now the preferred usage in the documentation except where the colon improves
  readability.

* Support for IEEE 16 bit floats. Floating point types can now be 16 bits long as well
  as 32 and 64 bits. This is using the 'e' format from the struct module.

* Support for bfloats. This is a specialised 16-bit floating point format
  mostly used in machine learning. It's essentially a truncated IEEE 32-bit
  format that keeps its range but only has a couple of signficant figures of
  accuracy.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 pkgsrc/devel/py-bitstring/Makefile
cvs rdiff -u -r1.2 -r1.3 pkgsrc/devel/py-bitstring/PLIST
cvs rdiff -u -r1.4 -r1.5 pkgsrc/devel/py-bitstring/distinfo

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/devel/py-bitstring/Makefile
diff -u pkgsrc/devel/py-bitstring/Makefile:1.3 pkgsrc/devel/py-bitstring/Makefile:1.4
--- pkgsrc/devel/py-bitstring/Makefile:1.3      Tue Jan  4 20:52:53 2022
+++ pkgsrc/devel/py-bitstring/Makefile  Mon Nov 13 10:59:21 2023
@@ -1,8 +1,7 @@
-# $NetBSD: Makefile,v 1.3 2022/01/04 20:52:53 wiz Exp $
+# $NetBSD: Makefile,v 1.4 2023/11/13 10:59:21 wiz Exp $
 
-DISTNAME=      bitstring-3.1.9
+DISTNAME=      bitstring-4.1.2
 PKGNAME=       ${PYPKGPREFIX}-${DISTNAME}
-PKGREVISION=   1
 CATEGORIES=    devel python
 MASTER_SITES=  ${MASTER_SITE_PYPI:=b/bitstring/}
 
@@ -11,11 +10,18 @@ HOMEPAGE=   https://github.com/scott-griff
 COMMENT=       Simple construction, analysis and modification of binary data
 LICENSE=       mit
 
+TOOL_DEPENDS+= ${PYPKGPREFIX}-setuptools-[0-9]*:../../devel/py-setuptools
+TOOL_DEPENDS+= ${PYPKGPREFIX}-wheel-[0-9]*:../../devel/py-wheel
+DEPENDS+=      ${PYPKGPREFIX}-bitarray>=2.8.0:../../devel/py-bitarray
+
 USE_LANGUAGES= # none
 
-do-test:
-       cd ${WRKSRC}/test && \
-       ${SETENV} ${TEST_ENV} ${PYTHONBIN} -m unittest discover
+PYTHON_VERSIONS_INCOMPATIBLE=  27
+
+# remove broken test so others can run
+# https://github.com/scott-griffiths/bitstring/issues/301
+pre-test:
+       ${RM} ${WRKSRC}/bitstring/plugin_test.py
 
-.include "../../lang/python/egg.mk"
+.include "../../lang/python/wheel.mk"
 .include "../../mk/bsd.pkg.mk"

Index: pkgsrc/devel/py-bitstring/PLIST
diff -u pkgsrc/devel/py-bitstring/PLIST:1.2 pkgsrc/devel/py-bitstring/PLIST:1.3
--- pkgsrc/devel/py-bitstring/PLIST:1.2 Thu Sep  9 07:29:09 2021
+++ pkgsrc/devel/py-bitstring/PLIST     Mon Nov 13 10:59:21 2023
@@ -1,8 +1,44 @@
-@comment $NetBSD: PLIST,v 1.2 2021/09/09 07:29:09 adam Exp $
-${PYSITELIB}/${EGG_INFODIR}/PKG-INFO
-${PYSITELIB}/${EGG_INFODIR}/SOURCES.txt
-${PYSITELIB}/${EGG_INFODIR}/dependency_links.txt
-${PYSITELIB}/${EGG_INFODIR}/top_level.txt
-${PYSITELIB}/bitstring.py
-${PYSITELIB}/bitstring.pyc
-${PYSITELIB}/bitstring.pyo
+@comment $NetBSD: PLIST,v 1.3 2023/11/13 10:59:21 wiz Exp $
+${PYSITELIB}/${WHEEL_INFODIR}/LICENSE
+${PYSITELIB}/${WHEEL_INFODIR}/METADATA
+${PYSITELIB}/${WHEEL_INFODIR}/RECORD
+${PYSITELIB}/${WHEEL_INFODIR}/WHEEL
+${PYSITELIB}/${WHEEL_INFODIR}/top_level.txt
+${PYSITELIB}/bitstring/__init__.py
+${PYSITELIB}/bitstring/__init__.pyc
+${PYSITELIB}/bitstring/__init__.pyo
+${PYSITELIB}/bitstring/__main__.py
+${PYSITELIB}/bitstring/__main__.pyc
+${PYSITELIB}/bitstring/__main__.pyo
+${PYSITELIB}/bitstring/bitstore.py
+${PYSITELIB}/bitstring/bitstore.pyc
+${PYSITELIB}/bitstring/bitstore.pyo
+${PYSITELIB}/bitstring/bitstream.py
+${PYSITELIB}/bitstring/bitstream.pyc
+${PYSITELIB}/bitstring/bitstream.pyo
+${PYSITELIB}/bitstring/bitstring_array.py
+${PYSITELIB}/bitstring/bitstring_array.pyc
+${PYSITELIB}/bitstring/bitstring_array.pyo
+${PYSITELIB}/bitstring/classes.py
+${PYSITELIB}/bitstring/classes.pyc
+${PYSITELIB}/bitstring/classes.pyo
+${PYSITELIB}/bitstring/dtypes.py
+${PYSITELIB}/bitstring/dtypes.pyc
+${PYSITELIB}/bitstring/dtypes.pyo
+${PYSITELIB}/bitstring/exceptions.py
+${PYSITELIB}/bitstring/exceptions.pyc
+${PYSITELIB}/bitstring/exceptions.pyo
+${PYSITELIB}/bitstring/fp8.py
+${PYSITELIB}/bitstring/fp8.pyc
+${PYSITELIB}/bitstring/fp8.pyo
+${PYSITELIB}/bitstring/hints.py
+${PYSITELIB}/bitstring/hints.pyc
+${PYSITELIB}/bitstring/hints.pyo
+${PYSITELIB}/bitstring/methods.py
+${PYSITELIB}/bitstring/methods.pyc
+${PYSITELIB}/bitstring/methods.pyo
+${PYSITELIB}/bitstring/plugin_test.py
+${PYSITELIB}/bitstring/py.typed
+${PYSITELIB}/bitstring/utils.py
+${PYSITELIB}/bitstring/utils.pyc
+${PYSITELIB}/bitstring/utils.pyo

Index: pkgsrc/devel/py-bitstring/distinfo
diff -u pkgsrc/devel/py-bitstring/distinfo:1.4 pkgsrc/devel/py-bitstring/distinfo:1.5
--- pkgsrc/devel/py-bitstring/distinfo:1.4      Tue Oct 26 10:18:14 2021
+++ pkgsrc/devel/py-bitstring/distinfo  Mon Nov 13 10:59:21 2023
@@ -1,5 +1,5 @@
-$NetBSD: distinfo,v 1.4 2021/10/26 10:18:14 nia Exp $
+$NetBSD: distinfo,v 1.5 2023/11/13 10:59:21 wiz Exp $
 
-BLAKE2s (bitstring-3.1.9.tar.gz) = d36227d1ae07c4dd81028eae00f6cbbb900e80efaf56e3d536ecc5648e18ced3
-SHA512 (bitstring-3.1.9.tar.gz) = e47e27fdf98486cb1968ef6dad4c90cc673487e18b9da79ba176ed73be4ff629360330e6e3bb422edd4c5e104af437169739f9000f93917a2fe0e8448a0b42d0
-Size (bitstring-3.1.9.tar.gz) = 198509 bytes
+BLAKE2s (bitstring-4.1.2.tar.gz) = 7a709f9678fa0f3471d8680a04f9b6acf8b85cef08e64d03413f968d0cd253da
+SHA512 (bitstring-4.1.2.tar.gz) = 23e5f651538b06c6342dd661661382b8935271d6266e6ad2404e19c0af49ca2756337793e66d858731421246fad5330f2f5588bee3e81cc8ca39a985c2941721
+Size (bitstring-4.1.2.tar.gz) = 232896 bytes



Home | Main Index | Thread Index | Old Index