Skip to content

Rename WriteTiff16 / ReadTiff16 to snake_case #22

@rfrenchseti

Description

@rfrenchseti

src/picmaker/tiff16.py exposes two public functions whose PascalCase names violate the project's N802 ruff rule:

  • WriteTiff16(filename, array, …)
  • ReadTiff16(filename, …)

These are the only entries in [tool.ruff.lint.per-file-ignores] — the rest of the per-file ignores were eliminated in #8. Renaming them is the last step to drop the file-level ignore entirely.

Why this is deferred

The names are part of the documented public surface. They are:

  • Re-exported from src/picmaker/picmaker.py (BC import path) and pinned by tests/test_api_compat.py.
  • Called from src/picmaker/pil_utils.py:150,157 on the 16-bit TIFF write path.
  • Used by tests/fixture_recipes/small_tiff16.recipe.py and tests/test_tiff16_branches.py.

A rename is a behavioural change: any downstream caller using from picmaker.tiff16 import WriteTiff16 (or from picmaker.picmaker import WriteTiff16) breaks at import.

Suggested approach

  1. Add write_tiff16 and read_tiff16 as the new canonical names in src/picmaker/tiff16.py.
  2. Keep WriteTiff16 = write_tiff16 and ReadTiff16 = read_tiff16 as deprecated aliases that emit a DeprecationWarning on call. Add them to __all__ so the BC shim picks them up.
  3. Update internal callers (pil_utils.py, the fixture recipe, the test file) to use the new names.
  4. Update tests/test_api_compat.py to verify both the legacy and new names resolve to the same callable.
  5. Remove "src/picmaker/tiff16.py" = ["N802"] from [tool.ruff.lint.per-file-ignores] in pyproject.toml — the whole table goes away.
  6. Document the deprecation in the next release notes; remove the aliases in a later release (e.g. 1.0 or 2.0).

Effort

Medium. ~5 files to edit, two tests to update, and a deprecation cycle to plan around the next release.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions