Skip to content

Fix TypeError on missing fps metadata; run CI on pull requests - #63

Open
jankoslavic wants to merge 1 commit into
masterfrom
fix/fps-metadata-and-pr-ci
Open

Fix TypeError on missing fps metadata; run CI on pull requests#63
jankoslavic wants to merge 1 commit into
masterfrom
fix/fps-metadata-and-pr-ci

Conversation

@jankoslavic

Copy link
Copy Markdown
Contributor

Two follow-ups to #62.

1. TypeError when a multi-image file has no fps metadata

_initalise_image_files passed the result of image_meta.get("fps", None) straight into configure:

if not getattr(self, "fps", False):
    self.configure(fps=image_meta.get("fps", None))

configure gates on "fps" in kwargs and then does float(kwargs["fps"]), so a missing fps key becomes float(None) — a TypeError raised during VideoReader construction, for every multi-image file (e.g. a multi-page TIFF) whose metadata does not report a frame rate. The , None) default suggests the missing case was anticipated; it just was not guarded. Now configure is only called when an fps was actually reported.

Not covered by the current test data: the PNG sequence takes the n_images is None branch, and the gif does report fps. Adding a fixture without fps metadata would be worth doing separately.

2. Pull requests never ran CI

python_package_testing.yaml triggered on push only, so a PR from a fork produced no checks at all — #62 was reviewed and merged with nothing green to look at. This adds the pull_request trigger and scopes the push trigger to master, so in-repo branches do not run the 3-version matrix twice on every push.

Note that this PR is itself the first one that should show checks.

Still open

The root cause behind the #62 test bug — VideoReader.configure(**kwargs) silently ignoring unknown keywords, which is how use_channel= sat in the tests testing nothing — is deliberately left out of this PR. Per @itomac's comment, worth handling separately; an explicit keyword signature (as _dic.py and the other methods already use) would raise TypeError for free, which catches more than a warning does.

🤖 Generated with Claude Code

`_initalise_image_files` passed `image_meta.get("fps", None)` straight to
`configure`, which does `float(kwargs["fps"])` whenever the key is present.
For a multi-image file whose metadata carries no fps this raised
`TypeError: float() argument must be ...` during `VideoReader` construction.
Only call `configure` when an fps was actually reported.

The testing workflow triggered on `push` only, so pull requests from forks
never ran any checks (#62 was merged without CI). Trigger on `pull_request`
as well, and limit the push trigger to `master` so in-repo branches do not
run the matrix twice per push.
@jankoslavic
jankoslavic force-pushed the fix/fps-metadata-and-pr-ci branch from 7932f52 to c09a05a Compare August 10, 2026 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant