Skip to content

v3.1.0

Latest

Choose a tag to compare

@github-actions github-actions released this 23 May 21:03
f66ba7e

What's Changed

Agent-friendly API additions, expanded test coverage, and a tooling refresh. No runtime dependencies (still zero). Python 3.10–3.14.

Features

  • atomic_write_text() / atomic_write_bytes() — one-call wrappers around atomic_output_file() for the common "write a whole string/bytes atomically" case, with make_parents and backup_suffix support.
  • __version__ is now exposed on the package (strif.__version__).
  • Insertion and Replacement are now NamedTuples with named fields (offset/text and start/end/text) for clearer construction and better editor/agent support.
  • HashAlgorithm Literal type on hash_string() / hash_file() for autocomplete of common algorithms (the default remains sha1; any name hashlib accepts still works).

Fixes

  • hash_file() now accepts every spelling hashlib accepts (e.g. "SHA1", "sha-1"). The previous algorithms_available precheck wrongly rejected valid spellings and was inconsistent with hash_string(); invalid algorithms still raise ValueError.
  • Published source distribution (sdist) is now clean — agent/tooling directories (.claude, .tbd, .github, .copier-answers.yml) are excluded. (The wheel was always clean.)

Removed

  • abbreviate_str / abbreviate_list deprecated aliases have been removed. Use abbrev_str() / abbrev_list(). These were never exported from the public strif package, so this only affects code importing them directly from the private strif.strif submodule.

Tooling

  • Bumped softprops/action-gh-release to v3.0.0 (Node 24 runtime) and astral-sh/setup-uv to v8.1.0; both pinned by commit SHA.

Tests

  • New tests for AtomicVar (including a real concurrency test), hash_file binary/large-file paths, new_uid length math, {timestamp} backups, and the new atomic-write helpers. Suite grew from 26 to 43 tests.

Note on backward compatibility

The NamedTuple change is runtime-compatible (positional construction, unpacking, and indexing all still work). Code that statically annotates values as list[Insertion] / list[Replacement] and assigns bare tuple literals should switch to the named constructors to satisfy type checkers.

Full Changelog

v3.0.2...v3.1.0