Skip to content

Releases: igormilovanovic/pyhosts

v0.3.1

25 Feb 22:52

Choose a tag to compare

v0.3.0

20 Feb 18:46

Choose a tag to compare

What's New in v0.3.0

Bug Fixes

  • Fix overly strict duplicate detectionHosts.add() now only checks hostname equality, allowing the common pattern of mapping the same IP to different hostnames (#24)
  • Fix whitespace-only hostname validation — Hostnames consisting only of whitespace are now correctly rejected (#25)
  • Fix comment validation — Comments containing carriage returns (\r) are now properly rejected (#26)

New Features

  • Context manager supportHosts can now be used as a context manager (with Hosts() as h: ...) that auto-saves on clean exit (#33)

Improvements

  • Modernized typing syntax — Uses Python 3.10+ X | Y union syntax via from __future__ import annotations (#27)
  • Slotted dataclassHost now uses @dataclass(frozen=True, slots=True) for better memory efficiency (#28)
  • match/case — Platform resolver uses structural pattern matching instead of if/elif chains (#29)

CI & Tooling

  • mypy in CI — Strict type checking is now enforced in the CI pipeline (#30)
  • ruff replaces pycodestyle — Faster, more comprehensive linting with ruff (#31)
  • Coverage threshold — CI now enforces a minimum 80% code coverage (#32)

Documentation

  • Thread-safety noteHosts class docstring and README now document that the class is not thread-safe (#34)

Testing

  • 25 new edge-case tests — Comprehensive coverage for empty files, IPv6, malformed lines, inline comments, backup, reload, slicing, and more (#35)

Full Changelog: v0.2.0...v0.3.0