pkgsrc-Changes archive

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

CVS commit: pkgsrc/print/py-pikepdf



Module Name:    pkgsrc
Committed By:   adam
Date:           Sun Sep 13 07:02:33 UTC 2026

Modified Files:
        pkgsrc/print/py-pikepdf: Makefile PLIST distinfo

Log Message:
py-pikepdf: updated to 10.13.0.post1

v10.13.0

Exception hierarchy

pikepdf's exceptions now form a documented hierarchy rooted at the new
`pikepdf.PikepdfError`, with `pikepdf.PikepdfWarning` playing the same role for
warnings. See {doc}`/api/exceptions` for the full tree. {issue}`739`

- **Behavior change:** `pikepdf.DataDecodingError` now derives from
  `pikepdf.PdfError`. A stream that will not decode is a defect in the document,
  and the same call that raises it -- `Object.read_bytes()` -- already raised
  `PdfError` for other kinds of damage, so `except PdfError` was a handler that
  looked correct, passed on healthy files, and let a traceback escape on damaged
  ones. Code catching `DataDecodingError` by name is unaffected. Code that
  orders `except PdfError` *before* `except DataDecodingError` will now take the
  first branch; if the distinction matters, reverse the order.
- **Behavior change:** `pikepdf.PdfParsingError` now derives from
  `pikepdf.PdfError`, for the same reason.
- `pikepdf.PasswordError` remains a sibling of `PdfError`, not a subclass. A
  wrong password does not mean the document is defective, and handlers that
  report the two separately depend on `except PdfError` not catching it.
- `pikepdf.NotExtractableError` is now exported. It was already the base class
  of the exported `HifiPrintImageNotTranscodableError` but could not be caught
  by name.
- Fixed the exceptions documentation, which referenced a nonexistent
  `FormCopyWarning` (the class is `PageCopyWarning`) and omitted
  `ReferenceCycleError`, `PageCopyWarning` and `NotExtractableError`.

XMP metadata value types

XMP assigns a type to every standard property, and software that reads XMP
discards a property whose type is wrong -- Ghostscript strips these silently,
and PDF/A validators reject them. pikepdf used to choose the RDF container from
the Python type of the value it was handed, so `meta['dc:subject'] = ['a', 'b']`
wrote an `rdf:Seq` where the specification requires an `rdf:Bag`, and
`meta['dc:creator'] = 'Author'` wrote a bare string where an `rdf:Seq` belongs.
pikepdf now knows the type of the properties in the standard schemas and
converts values to it. See {ref}`metadatatypes`. {issue}`555`

- **Behavior change:** a property that holds several values is now written in
  the container the specification requires, regardless of whether a `list` or a
  `set` was assigned. Reading such a property back returns a `list` for an
  ordered property and a `set` for an unordered one, as before.
- **Behavior change:** assigning a plain string to a property that holds several
  values now issues the new `pikepdf.XmpTypeWarning` and stores a single element
  array, rather than writing a bare string that other software discards. The
  `log.error` message pikepdf previously produced for `dc:creator` alone is
  replaced by this warning, which covers every such property.
- **Behavior change:** assigning a `list` or `set` to a property that holds one
  value now joins the values with `; ` (warning that it did so) instead of
  writing an array the specification does not allow there.
- `datetime.datetime` and `datetime.date` may now be assigned to date valued
  properties such as `xmp:CreateDate`, and are encoded as ISO 8601. A time zone
  offset that is not a whole number of minutes is rounded to the minute, since
  XMP allows only `+hh:mm` and `-hh:mm`. `int` may be assigned to `pdfaid:part`
  and `bool` to `xmpRights:Marked`.
- Assigning a `set` to an ordered property such as `dc:creator` now sorts the
  values, so the order written is the same on every run rather than whatever
  order the set happened to iterate in.
- `Pdf.open_metadata(strict=True)` now also raises `TypeError` for a value that
  does not match the type of the property, in addition to its existing effect of
  refusing to repair invalid XMP.
- Assigning to a property whose namespace prefix has not been registered now
  raises `KeyError` naming
  `pikepdf.models.metadata.XmpDocument.register_xml_namespace()`. Previously the
  prefix was silently dropped and the property written into no namespace.
- Properties pikepdf does not know about are unaffected: the container is still
  inferred from the Python type of the value.
- The new `pikepdf.models.metadata.XMP_SCHEMA` maps a property's qualified name
  to its `XmpProperty` type, for callers that want to check types themselves.

Fixes

- Iterating XMP metadata no longer produces keys that cannot be looked up. When
  XMP fails to parse and is recovered, an element whose namespace prefix was
  never declared survives under its literal name -- `xmp:MetadataDate` rather
  than `{http://ns.adobe.com/xap/1.0/}MetadataDate` -- so iteration yielded a
  name that `__getitem__` resolved to a different one, and any code that walked
  the metadata (such as `dict(meta.items())`) raised `KeyError` or, where the
  name was truncated, `ValueError: Invalid tag name`. pikepdf now rebinds such
  names to the namespace their prefix refers to when it parses XMP, and discards
  the ones it cannot resolve. This also means the XMP pikepdf writes back for
  these documents is well-formed XML; previously it contained undeclared
  prefixes that no strict parser would read. {issue}`634`
- `key in metadata` now reports whether the key is present rather than whether
  its value is truthy, so a property with an empty value is no longer reported
  as missing by `in` while `metadata[key]` returns its value. Iterating the
  metadata likewise now includes a property with an empty value that is stored
  as an attribute of `rdf:Description`.
- XMP dates are now parsed according to the XMP specification when updating
  DocumentInfo, rather than with `datetime.fromisoformat`. On Python 3.10 the
  latter rejects a fraction of a second that is not exactly 3 or 6 digits and
  a time zone offset without a colon, so a valid date such as
  `2024-06-01T12:00:00.5Z` in XMP caused `/ModDate` to be dropped from
  DocumentInfo with a warning. A date-only XMP value such as `2024-06-01` now
  becomes `D:20240601` in DocumentInfo, and back, without a spurious midnight
  time, matching the existing handling of year and year-month values.
- Looking up a malformed key such as `'xmp:'` now raises `KeyError` (and
  `metadata.get()` returns the default) instead of `ValueError` from lxml.
- `pikepdf._core._ObjectList`, the list of operands attached to a content stream
  instruction, now behaves like a list of pikepdf objects. Previously its
  methods only accepted `pikepdf.Object`, but the elements of an operand list
  are usually numbers, which pikepdf decodes to `int`/`bool`/`Decimal` on the
  way out -- so there was no value a caller could pass back in. `==`, `!=`,
  `in`, `count()`, `remove()`, `append()`, `insert()`, `extend()` and
  `__setitem__` now encode their argument the same way `pikepdf.Array` does, so
  `instruction.operands == [0]` is True and `0 in instruction.operands` works.
  {issue}`742`
- Comparisons on `_ObjectList` now compare objects by value, as the rest of
  pikepdf does. They previously used qpdf's C++ `operator==`, which reports only
  whether two handles refer to the same underlying object, so `==`, `in`,
  `count()` and `remove()` gave wrong answers even for operand lists made
  entirely of `pikepdf.Object`.
- `pikepdf._core._ObjectMapping`, returned by `Object.as_dict()` and
  `Page.get_images()`, had all of the same problems and received the same
  treatment: `__setitem__` and `update()` now encode their value, `==` and `!=`
  compare values rather than object identity, and comparing a mapping to a
  `dict` works instead of printing a nanobind conversion warning.
- `_ObjectMapping.__setitem__` and `__delitem__` now accept a `pikepdf.Name`
  key, which `__getitem__` and `__contains__` already did.
- Comparing an `_ObjectList` or `_ObjectMapping` to a list or dict no longer
  prints `nanobind: implicit conversion from type 'list' to type
  'pikepdf._core._ObjectList' failed!` to stderr.
- A warning raised from pikepdf's C++ layer -- `PageCopyWarning`, the
  `Page.rotate()` deprecation warning, and the several warnings issued while
  opening and saving -- is now raised as an exception when a warning filter asks
  for that, such as under `python -W error` or
  `warnings.simplefilter('error')`. Previously the exception was created and
  then discarded, and the call carried on as if the warning had been ignored.
- Decoding a JBIG2 image no longer holds a second copy of the compressed data
  after the decoder has run, and no longer copies the whole image out of an
  internal buffer to hand it to the decoder.
- `repr()` of a deeply nested object and `unparse_content_stream()` no longer
  copy their partial result repeatedly while building it. Output is unchanged.
- `pikepdf.StreamParser` is now exported from the top-level package and included
  in `__all__`. It was always the required argument type of the public
  `Page.parse_contents()`, but previously could only be imported from the
  private `pikepdf._core` module. {issue}`738`

Internals

- Moved `Page`'s box properties (`mediabox`, `cropbox`, `artbox`, `bleedbox`,
  `trimbox`), the `rotation` property and `rotate()`, and `_ObjectMapping`'s
  key-based methods (`get`, `__getitem__`, `__setitem__`, `__delitem__`,
  `__contains__`) from Python augmentations to C++. Each was a thin Python
  wrapper around a private C++ binding, so its implementation was split across
  two files for no benefit; they are now defined once, in C++, and the private
  `Page._get_mediabox()`, `_get_artbox()`, `_get_bleedbox()`, `_get_cropbox()`,
  `_get_trimbox()` and `_get_rotation()` bindings they delegated to are gone.
  Behavior is unchanged.
- Removed the `augment_override_cpp` decorator from `pikepdf._augments`. A
  Python augmentation may no longer replace a method that C++ already defines;
  where C++ behavior needs to change, change it in C++, so that each method has
  exactly one implementation. With it goes the `_cpp<name>` copy the decorator
  left behind on the augmented class, so private attributes such as
  `Page._cpp__repr__` no longer exist.
- Moved a second group of Python augmentations to C++ for the same reason: the
  `Attachments` mapping methods, `AttachedFileSpec.relationship` and its
  `__repr__`, `AttachedFile.read_bytes()`, `Page.form_xobjects`, `Rectangle`'s
  `__repr__`, `__hash__` and `to_bbox()`, `Token.__repr__`, and `Object`'s
  `as_int()`, `as_bool()`, `as_float()`, `as_decimal()` and
  `_ipython_key_completions_()`. `len(pdf.attachments)` and iterating it no
  longer build a `pikepdf.AttachedFileSpec` for every attached file merely to
  count or name them. The private bindings these delegated to --
  `Attachments._get_all_filespecs()`, `_get_filespec()`, `_attach_data()`,
  `_add_replace_filespec()`, `_remove_filespec()`, `Page._form_xobjects` and
  `Object._get_real_value()` -- are gone.
- A support class passed to `augments` may now subclass an abstract base class
  to pick up its mixin methods and leave the abstract methods to C++;
  previously the abstract stubs were installed over the C++ implementations.
  `pikepdf.Attachments` uses this to get the `MutableMapping` mixins.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 pkgsrc/print/py-pikepdf/Makefile
cvs rdiff -u -r1.8 -r1.9 pkgsrc/print/py-pikepdf/PLIST
cvs rdiff -u -r1.25 -r1.26 pkgsrc/print/py-pikepdf/distinfo

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

Modified files:

Index: pkgsrc/print/py-pikepdf/Makefile
diff -u pkgsrc/print/py-pikepdf/Makefile:1.31 pkgsrc/print/py-pikepdf/Makefile:1.32
--- pkgsrc/print/py-pikepdf/Makefile:1.31       Fri Sep  4 12:23:47 2026
+++ pkgsrc/print/py-pikepdf/Makefile    Sun Sep 13 07:02:33 2026
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.31 2026/09/04 12:23:47 adam Exp $
+# $NetBSD: Makefile,v 1.32 2026/09/13 07:02:33 adam Exp $
 
-DISTNAME=      pikepdf-10.12.0
+DISTNAME=      pikepdf-10.13.0.post1
 PKGNAME=       ${PYPKGPREFIX}-${DISTNAME}
 CATEGORIES=    print python
 MASTER_SITES=  ${MASTER_SITE_PYPI:=p/pikepdf/}
@@ -21,7 +21,7 @@ TEST_DEPENDS+=        ${PYPKGPREFIX}-test-xdist
 
 USE_CXX_FEATURES=      c++17
 USE_LANGUAGES=         c c++
-USE_TOOLS+=            pkg-config
+USE_TOOLS+=            cmake pkg-config
 
 PYTHON_VERSIONS_INCOMPATIBLE=  310 311
 

Index: pkgsrc/print/py-pikepdf/PLIST
diff -u pkgsrc/print/py-pikepdf/PLIST:1.8 pkgsrc/print/py-pikepdf/PLIST:1.9
--- pkgsrc/print/py-pikepdf/PLIST:1.8   Fri Sep  4 12:23:47 2026
+++ pkgsrc/print/py-pikepdf/PLIST       Sun Sep 13 07:02:33 2026
@@ -1,4 +1,4 @@
-@comment $NetBSD: PLIST,v 1.8 2026/09/04 12:23:47 adam Exp $
+@comment $NetBSD: PLIST,v 1.9 2026/09/13 07:02:33 adam Exp $
 ${PYSITELIB}/${WHEEL_INFODIR}/METADATA
 ${PYSITELIB}/${WHEEL_INFODIR}/RECORD
 ${PYSITELIB}/${WHEEL_INFODIR}/WHEEL
@@ -128,6 +128,9 @@ ${PYSITELIB}/pikepdf/models/metadata/_co
 ${PYSITELIB}/pikepdf/models/metadata/_docinfo.py
 ${PYSITELIB}/pikepdf/models/metadata/_docinfo.pyc
 ${PYSITELIB}/pikepdf/models/metadata/_docinfo.pyo
+${PYSITELIB}/pikepdf/models/metadata/_schema.py
+${PYSITELIB}/pikepdf/models/metadata/_schema.pyc
+${PYSITELIB}/pikepdf/models/metadata/_schema.pyo
 ${PYSITELIB}/pikepdf/models/metadata/_xmp.py
 ${PYSITELIB}/pikepdf/models/metadata/_xmp.pyc
 ${PYSITELIB}/pikepdf/models/metadata/_xmp.pyo

Index: pkgsrc/print/py-pikepdf/distinfo
diff -u pkgsrc/print/py-pikepdf/distinfo:1.25 pkgsrc/print/py-pikepdf/distinfo:1.26
--- pkgsrc/print/py-pikepdf/distinfo:1.25       Fri Sep  4 12:23:47 2026
+++ pkgsrc/print/py-pikepdf/distinfo    Sun Sep 13 07:02:33 2026
@@ -1,5 +1,5 @@
-$NetBSD: distinfo,v 1.25 2026/09/04 12:23:47 adam Exp $
+$NetBSD: distinfo,v 1.26 2026/09/13 07:02:33 adam Exp $
 
-BLAKE2s (pikepdf-10.12.0.tar.gz) = d4ca45e8cf9b79efa8deba14d0d709613952a7667dd072a87ce2d0d3fb677b4f
-SHA512 (pikepdf-10.12.0.tar.gz) = 337e4a93a50fec805d660a9660f90795b383fb291fbb9f65f9b0d8f198c01f1a48b54694e4915d2f53e0302e9f4c562620b134fa9848a95dcd6663683ec6e4b8
-Size (pikepdf-10.12.0.tar.gz) = 4950459 bytes
+BLAKE2s (pikepdf-10.13.0.post1.tar.gz) = a1d84bb98f401faf2c48494720e9b218470fa2ac83e24cdb0ac780a9e2823e0b
+SHA512 (pikepdf-10.13.0.post1.tar.gz) = 72bc3c2647026cd3621f7adbaa89e25db33ddc297aa1e52f222bd7b2e7f6a65aca497f94c8e6fffa2a241c66bbcd15921e6a0e8fde88ba5bd17da9815cb66cf3
+Size (pikepdf-10.13.0.post1.tar.gz) = 4973186 bytes



Home | Main Index | Thread Index | Old Index