Strict typing, more coverage, updated fmd public server#12
Conversation
https://fmd.nulide.de/ has moved to https://server.fmd-foss.org/. See https://fmd-foss.org/blog/2025/11/08/new-server The old URL will continue to work for the foreseeable future
This release focuses on code quality, type safety, and test coverage improvements following the v2.0.4 feature release. Strict Typing (Phase 1): - Enabled strict mypy configuration in pyproject.toml (disallow untyped defs, no implicit optional, etc.). - Fixed all type errors in md_api/client.py and md_api/device.py. - Added precise return types and generic type hints (e.g., List[Dict[str, Any]]) throughout the core library. - Created docs/strict_typing_enforcement_plan.md outlining the roadmap for type safety. Test Coverage: - Increased overall test coverage to 99%. - Added ests/unit/test_deprecated.py to verify deprecated wrappers in Device class. - Added test cases for Location.from_json edge cases (missing dates, invalid inputs) in ests/unit/test_models.py. - Added validation tests for Device.lock() message truncation and sanitization. Documentation: - Updated docs/mypy_baseline_errors.md to track progress (now resolved). chore: enforce strict typing and improve test coverage for v2.0.5 This release focuses on code quality, type safety, and test coverage improvements following the v2.0.4 feature release. Strict Typing (Phase 1): - Enabled strict mypy configuration in pyproject.toml (disallow untyped defs, no implicit optional, etc.). - Fixed all type errors in md_api/client.py and md_api/device.py. - Added precise return types and generic type hints (e.g., List[Dict[str, Any]]) throughout the core library. - Created docs/strict_typing_enforcement_plan.md outlining the roadmap for type safety. Test Coverage: - Increased overall test coverage to 99%. - Added ests/unit/test_deprecated.py to verify deprecated wrappers in Device class. - Added test cases for Location.from_json edge cases (missing dates, invalid inputs) in ests/unit/test_models.py. - Added validation tests for Device.lock() message truncation and sanitization. Documentation: - Updated docs/mypy_baseline_errors.md to track progress (now resolved).
…into ThoreFeedback
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull Request Overview
This PR enforces strict typing and improves test coverage as part of the v2.0.5 release, focusing on code quality and type safety improvements.
Key Changes
- Enabled strict mypy configuration with comprehensive type checking rules
- Added type hints throughout core modules (
fmd_api/client.py,fmd_api/device.py) and test files - Increased test coverage to 99% with new tests for deprecated methods, lock message validation, and edge cases
- Updated FMD public server URL to the official community instance
Reviewed Changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
pyproject.toml |
Version bump to 2.0.5 and strict mypy configuration added |
fmd_api/client.py |
Added return type annotations, type hints for variables, and typed __aexit__ parameters |
fmd_api/device.py |
Added return type annotations and type parameters for generic Dict types |
tests/unit/test_models.py |
Added type hints and new test for Location.from_json with missing date field |
tests/unit/test_lock_message.py |
Added test for long message truncation validation |
tests/unit/test_deprecated.py |
New test file covering all deprecated Device wrapper methods |
fmd_api/_version.py |
Version string updated to 2.0.5 |
docs/strict_typing_enforcement_plan.md |
New documentation outlining typing roadmap |
docs/mypy_baseline_errors.md |
New documentation tracking resolved mypy errors |
docs/release/v2.0.4.md |
New release notes for v2.0.4 |
README.md |
Updated public server URL to official community instance |
.pre-commit-config.yaml |
Added strict mode flags to mypy pre-commit hook |
.coverage |
SQLite coverage database file (should not be committed) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| async def __aexit__(self, exc_type, exc, tb) -> None: | ||
| async def __aexit__( | ||
| self, | ||
| exc_type: Optional[type[BaseException]], |
There was a problem hiding this comment.
The type annotation type[BaseException] uses Python 3.10+ syntax. Since this project supports Python 3.8+ (per requires-python = ">=3.8" in pyproject.toml), this will cause a TypeError at import time in Python 3.8 and 3.9.
For compatibility, you should use Optional[Type[BaseException]] and import Type from typing:
from typing import Optional, Type
...
async def __aexit__(
self,
exc_type: Optional[Type[BaseException]],
exc: Optional[BaseException],
tb: Optional[TracebackType],
) -> None:
chore: enforce strict typing and improve test coverage for v2.0.5
This release focuses on code quality, type safety, and test coverage improvements following the v2.0.4 feature release.
Strict Typing (Phase 1):
mypyconfiguration inpyproject.toml(disallow untyped defs, no implicit optional, etc.).fmd_api/client.pyandfmd_api/device.py.List[Dict[str, Any]]) throughout the core library.docs/strict_typing_enforcement_plan.mdoutlining the roadmap for type safety.Test Coverage:
tests/unit/test_deprecated.pyto verify deprecated wrappers inDeviceclass.Location.from_jsonedge cases (missing dates, invalid inputs) intests/unit/test_models.py.Device.lock()message truncation and sanitization.Documentation:
docs/mypy_baseline_errors.mdto track progress (now resolved).chore: enforce strict typing and improve test coverage for v2.0.5
This release focuses on code quality, type safety, and test coverage improvements following the v2.0.4 feature release.
Strict Typing (Phase 1):
mypyconfiguration inpyproject.toml(disallow untyped defs, no implicit optional, etc.).fmd_api/client.pyandfmd_api/device.py.List[Dict[str, Any]]) throughout the core library.docs/strict_typing_enforcement_plan.mdoutlining the roadmap for type safety.Test Coverage:
tests/unit/test_deprecated.pyto verify deprecated wrappers inDeviceclass.Location.from_jsonedge cases (missing dates, invalid inputs) intests/unit/test_models.py.Device.lock()message truncation and sanitization.Documentation:
docs/mypy_baseline_errors.mdto track progress (now resolved).