Skip to content

Commit e08fd0f

Browse files
committed
Add changelog for 2.8.0 release
1 parent 718354f commit e08fd0f

10 files changed

Lines changed: 101 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,40 @@
11
# Changelog
22

3+
## [2.8.0] - Extended Syntax
4+
5+
### Added
6+
7+
- New concept: *extended* syntax featuring typing compliance; introduces shortcut `f` to annotate fields and `Invisible()` to hide fields from the constructor
8+
- `struct_factory.mixin` and `bitfield_factory.mixin` both provide default function wrappers for packing and unpacking data as well as typing fixes for operating on types directly.
9+
- New `parentctx` context path
10+
- Dynamic endian is now used by default (i. e. can be changed via order parameter in pack() or unpack())
11+
- New generic `Timestamp` class
12+
- A number of new test cases
13+
- New module: `caterpillar.types`: defines default types that can be used as annotations within struct definitions
14+
- `O_DEFAULT_ENDIAN` as a global option to set a global default byteorder
15+
- `O_DEFAULT_ARCH` same concept for arch-like objects
16+
- new 'strict' option to `Enum` struct
17+
- `ATTR_PACK` and `ATTR_UNPACK` to *caterpillar.shared*
18+
- `'order'` and `'arch'` options to pack() and unpack(), which temporarily change the global endianess or arch (compatible with Dynamic byteorder)
19+
20+
### Changes
21+
22+
- Merge all stub files with their corresponding Python files. All typing is now inline.
23+
- `padding` struct now has its own dedicated class
24+
- sizeof() now always returns an integer
25+
- ContextPath: dropped support for the call action
26+
- Field.get_name() now always returns a string
27+
- Rename `ssize` and `size` to `pssize` and `psize` in caterpillar.fields exports
28+
- options.get_flags() always returns a list
29+
30+
### Fixes
31+
32+
- IntFlag support for `Enum` structs
33+
- Fix incorrect Sha1 Digest length
34+
- Add missing global exports in `caterpillar.py`
35+
- Bitfield, Struct and Sequence now respect fields with already configured byteorder
36+
- Prefixed struct now does not require `as_field=True` when calling pack() or unpack()
37+
338
## [2.7.0] - Dynamic Byteorder
439

540
### Added

docs/sphinx/source/development/changelog.rst

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,48 @@ Changelog
66

77
*More entries will be added in the future.*
88

9+
.. _changelog_2.8.0:
10+
11+
[2.8.0] - Extended Syntax
12+
=========================
13+
14+
Added
15+
-----
16+
17+
- New concept: *extended* syntax featuring typing compliance; introduces shortcut :data:`f` to annotate fields and :func:`~caterpillar.model.Invisible` to hide fields from the constructor
18+
- ``struct_factory.mixin`` and ``bitfield_factory.mixin`` both provide default function wrappers for packing and unpacking data as well as typing fixes for operating on types directly.
19+
- New :data:`~caterpillar.context.parentctx` context path
20+
- Dynamic endian is now used by default (i. e. can be changed via order parameter in pack() or unpack())
21+
- New generic :class:`~caterpillar.fields.Timestamp` class
22+
- A number of new test cases
23+
- New module: ``caterpillar.types``: defines default types that can be used as annotations within struct definitions
24+
- :data:`~caterpillar.byteorder.O_DEFAULT_ENDIAN` as a global option to set a global default byteorder
25+
- :data:`~caterpillar.byteorder.O_DEFAULT_ARCH` same concept for arch-like objects
26+
- new 'strict' option to :class:`~caterpillar.fields.Enum` struct
27+
- :data:`~caterpillar.shared.ATTR_PACK` and :data:`~caterpillar.shared.ATTR_UNPACK` to *caterpillar.shared*
28+
- `'order'` and `'arch'` options to pack() and unpack(), which temporarily change the global endianess or arch (compatible with Dynamic byteorder)
29+
30+
Changes
31+
-------
32+
33+
- Merge all stub files with their corresponding Python files. All typing is now inline.
34+
- :class:`~caterpillar.fields.Padding` struct now has its own dedicated class
35+
- sizeof() now always returns an integer
36+
- ContextPath: dropped support for the call action
37+
- Field.get_name() now always returns a string
38+
- Rename `ssize` and `size` to :data:`~caterpillar.fields.pssize` and :data:`~caterpillar.fields.psize` in caterpillar.fields exports
39+
- options.get_flags() always returns a list
40+
41+
Fixes
42+
-----
43+
44+
- IntFlag support for :class:`~caterpillar.fields.Enum` structs
45+
- Fix incorrect Sha1 Digest length
46+
- Add missing global exports in *caterpillar.py*
47+
- Bitfield, Struct and Sequence now respect fields with already configured byteorder
48+
- Prefixed struct now does not require ``as_field=True`` when calling pack() or unpack()
49+
50+
951
.. _changelog_2.7.0:
1052

1153
[2.7.0] - Dynamic Byteorder

docs/sphinx/source/reference/capi/extension.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Before proceeding, ensure you have the following tools installed:
1717
Assuming you are using `scikit-build <https://scikit-build-core.readthedocs.io/en/stable/getting_started.html)>`_ to write
1818
your extension, the following project structure applies:
1919

20-
.. code-block:: txt
20+
.. code-block:: text
2121
2222
example-extension
2323
├── CMakeLists.txt

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ cmake.source-dir = "."
88

99
[project]
1010
name = "caterpillar"
11-
version = "2.8.0rc"
11+
version = "2.8.0"
1212
requires-python = ">=3.10"
1313
description = "Library to pack and unpack structurized binary data."
1414
authors = [{ name = "MatrixEditor" }]

src/caterpillar/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# along with this program. If not, see <https://www.gnu.org/licenses/>.
1515
import warnings
1616

17-
__version__ = "2.8.0rc"
17+
__version__ = "2.8.0"
1818
__release__ = "2.8"
1919
__author__ = "MatrixEditor"
2020

src/caterpillar/abc.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,9 @@ def __call__(self, value: Any, context: _ContextLike) -> _StructLike: ...
344344

345345

346346
_SwitchOptionsT = _SwitchLambda | dict[Any, Any]
347-
347+
"""
348+
.. versionadded 2.8.0
349+
"""
348350

349351
@runtime_checkable
350352
class _SupportsBits(Protocol):
@@ -391,6 +393,11 @@ def __call__(self, __value: Iterable[_IT]) -> Collection[_IT]: ...
391393

392394

393395
class _ContextFactoryLike(Protocol):
396+
"""
397+
398+
.. versionadded 2.8.0
399+
"""
400+
394401
def __call__(self, **kwargs: Any) -> _ContextLike: ...
395402

396403

src/caterpillar/fields/_base.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,11 @@ def get_type(self) -> type:
485485
return return_type # pyright: ignore[reportReturnType]
486486

487487
def get_name(self) -> str:
488+
"""Returns the name of this field.
489+
490+
.. versionchanged:: 2.8.0
491+
now always returns a string
492+
"""
488493
return getattr(self, "__name__", "_")
489494

490495
# IO related stuff

src/caterpillar/fields/common.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,10 @@ class Enum(Generic[_EnumT, _IT], Transformer[_EnumT, _IT, _EnumT | _IT, _IT]):
798798
:param struct: The _StructLike object to be wrapped.
799799
:param default: The default value to return if decoding encounters an unrecognized value.
800800
Default is `INVALID_DEFAULT`.
801+
:param strict: controls whether the parsed value has to conform to the input enum model.
802+
803+
.. versionchanged:: 2.8.0
804+
Add new 'strict' option.
801805
"""
802806

803807
__slots__: tuple[str, ...] = ("model", "default", "strict")

src/caterpillar/options.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ def get_flags(obj: object, attr: str | None = None) -> list[_OptionLike]:
109109
"""
110110
Get the flags associated with an object.
111111
112+
.. versionchanged:: 2.8.0
113+
now always returns a list
114+
112115
:param obj: The object.
113116
:param attr: The attribute name containing the flags (default is "flags").
114117
:return: The set of flags, or None if no flags are present.

src/ccaterpillar/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ CP_ENABLE_NATIVE = "1"
1717

1818
[project]
1919
name = "caterpillar"
20-
version = "2.8.0rc"
20+
version = "2.8.0"
2121
requires-python = ">=3.12"
2222
description = "Library to pack and unpack structurized binary data."
2323
readme = "../../README.md"

0 commit comments

Comments
 (0)