Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #416 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 42 44 +2
Lines 2990 3092 +102
Branches 457 459 +2
==========================================
+ Hits 2990 3092 +102 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Move runtime dependencies into optional extras (zim, image, video, download, filesystem, html, rewriting, i18n, all), keep beartype as the only base dependency, and raise actionable ImportErrors when an extra is missing. Resolve cross-feature imports at call time so each extra stands alone. Add metadata/import tests, a CI matrix, docs, and changelog entries. Fixes openzim#244
7b9c16e to
f41e9c1
Compare
benoit74
left a comment
There was a problem hiding this comment.
I do not have experience with Python extras, but this looks good to me.
Merging this probably means we need to make a major release, but this is already in the pipe for Python 3.15 which in turns introduce breaking changes with libzim 4.
@rgaudin any feedback to share for something I might have missed?
- Move to ubuntu-26.04 and drop unnecessary explicit x64 architecture. - Move the missing_extra import into image conversion's except block. - Make path_from dependency-free so video can import it without filesystem. - Restore conftest imports and install download in the focused extras job. - Mark the extras change as breaking and clarify the README download row. - Keep DEFAULT_DEV_ZIM_METADATA explicit and eager without requiring i18n or image.
FFmpeg on ubuntu-26.04 reports the MP3 fixture bitrate about 1.9% higher than the expected value. Widen the existing test tolerance from 1% to 5%.
What would be the alternative? I felt like this was the price to pay to be able to split. Did I misunderstood something? |
Well there's a big difference between module-import ImportError and function-call ImportError. The second one was introduced here as a shortcut IMO. |
- Expose path_from from a public zimscraperlib.paths module instead of the hidden _paths module, with its tests alongside the other top-level modules. - Drop the legacy zimscraperlib.filesystem.path_from import path for this major release and document the move in the changelog. - Give the release a dedicated Breaking Changes section at the top of the Unreleased notes.
Fixes #244, building on the import-boundary work in #403.
changes
zim,image,video,download,filesystem,html,rewriting,i18n, plusall.pip install zimscraperlibnow only requiresbeartype.allcovers every runtime extra;videohas no Python dependencies (FFmpeg remains a system dependency).tinycss2is declared explicitly inrewritingbecauserewriting/css.pyimports it directly.ImportErrornaming the extra and the exact install command.filesystem,download,i18n,image) are resolved where they are used, so each extra stands on its own. Public APIs are preserved, includingDEFAULT_DEV_ZIM_METADATA.Tests and CI
all.ruff check,ruff format --check, strictpyright, pytest, package build, and fresh virtual environments for the core install and every extra.