Releases: igormilovanovic/pyhosts
Releases · igormilovanovic/pyhosts
v0.3.1
Full Changelog: v0.3.0...v0.3.1
v0.3.0
What's New in v0.3.0
Bug Fixes
- Fix overly strict duplicate detection —
Hosts.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 support —
Hostscan 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 | Yunion syntax viafrom __future__ import annotations(#27) - Slotted dataclass —
Hostnow 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 note —
Hostsclass 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