Skip to content

4.0.0

Latest
Compare
Choose a tag to compare
@benoit74 benoit74 released this 05 Aug 09:33
· 40 commits to main since this release
6489f2a

Added

  • Add utility function to compute ZIM Tags #164, including deduplication #156
  • Metadata does not automatically drops control characters #159
  • New indexing.IndexData class to hold title, content and keywords to pass to libzim to index an item
  • Automatically index PDF documents content #167
  • Automatically set proper title on PDF documents #168
  • Expose new optimization.get_optimization_method to get the proper optimization method to call for a given image format
  • Add optimization.get_optimization_method to get the proper optimization method to call for a given image format
  • New creator.Creator.convert_and_check_metadata to convert metadata to bytes or str for known use cases and check proper type is passed to libzim
  • Add svg2png image conversion function #113
  • Add conversion.convert_svg2png image conversion function + support for SVG in probing.format_for #113
  • Add i18n.Lang class used as typed result of i18n operations #151

Changed

  • BREAKING Renamed zimscraperlib.image.convertion to zimscraperlib.image.conversion to fix typo
  • BREAKING Many changes in type hints to match the real underlying code
  • BREAKING Force all boolean arguments (and some other non-obvious parameters) to be keyword-only in function calls for clarity / disambiguation (see ruff rule FBT002)
  • Prefer to use IO[bytes] to io.BytesIO when possible since it is more generic
  • BREAKING i18n.NotFound renamed i18n.NotFoundError
  • BREAKING types.get_mime_for_name now returns str | None
  • BREAKING creator.Creator.add_metadata and creator.Creator.validate_metadata now only accepts bytes | str as value (it must have been converted before call)
  • BREAKING second argument of creator.Creator.add_metadata has been renamed to value instead of content to align with other methods
  • When a type issue arises in metadata checks, wrong value type is displayed in exception
  • BREAKING i18n.get_language_details(), i18n.get_iso_lang_data(), i18n.find_language_names() and i18n.update_with_macro now process / return a new typed Lang class #151
  • BREAKING Rename i18.NotFound to i18n.NotFoundError

Removed

  • BREAKING Remove translation features in i18n: Locale class + _ and setlocale functions #134

Fixed

  • Metadata length validation is buggy for unicode strings #158
  • Pillow 10.4.0 reveals improper type hints for image probing functions #177
  • Enhance error when locale fails to setup #157