Skip to content

Add type hints to core modules - #6

Merged
vijaxx merged 1 commit into
mainfrom
add-type-hints
Jul 11, 2026
Merged

Add type hints to core modules#6
vijaxx merged 1 commit into
mainfrom
add-type-hints

Conversation

@vijaxx

@vijaxx vijaxx commented Jul 11, 2026

Copy link
Copy Markdown
Owner

Closes #2.

Adds parameter/return type annotations to factory.py, pack.py, and pins.py -- the three modules the issue named. A Palette type alias makes the 4-tuple color scheme shape explicit instead of an anonymous tuple.

Along the way, mypy caught two real (if minor) issues in pins.py that predate this PR:

  • Image.LANCZOS is the old Pillow constant spelling; switched to Image.Resampling.LANCZOS, the current one. The old one still works on the installed Pillow version, but the new one is what current Pillow actually documents.
  • A coordinate variable (y) was implicitly narrowed to int by its first assignment, then had a float added to it a few lines later -- harmless at runtime (Python doesn't care), but needed an explicit float annotation to be honest about what the variable actually holds.

Verified: mypy --ignore-missing-imports clean on all three files, existing test suite passes unchanged, and I ran factory.py --theme nature end-to-end (real pack PDF + 5 real pins + manifest, including the LANCZOS resize path) to confirm actual output is unaffected.

@vijaxx
vijaxx merged commit df45036 into main Jul 11, 2026
1 check passed
@vijaxx
vijaxx deleted the add-type-hints branch July 11, 2026 04:49
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.

Add type hints to core modules

1 participant