Chore/type hinting - #25
Merged
Merged
Conversation
- Kinematics: fall back to a plain Kinematics instance for unhandled names instead of returning the enum value - FilamentMonitor: only switch monitor type when a string type is given - DriverId: default board to 0 when parsing a port-only string, raise TypeError when updating from a non-string, type __eq__/__ne__ - ObjectModel: raise TypeError when "global" is neither a dict nor null - ProbeType: remove trailing commas that made member values tuples - ModelCollection: accept JSON elements as initial values
- Add [tool.pyright] config to pyproject.toml (standard mode) - Run pyright in tox and in the CI test workflow - Pin pyright in requirements.txt - Remove the VS Code typeCheckingMode override, pyproject.toml now applies - Fix type errors in tests by narrowing optional and subclass values
- Resolve SOCKET_FILE once via a typed helper instead of reassigning it - Type subscription callbacks with a KeySubscriptionCallback protocol - Remove dead isinstance checks and an unreachable constructor fallback - Keep the runtime list check in ModelCollection.update_from_json for untyped nested JSON, with a targeted pyright ignore - Fix the subscribe example callback annotation: indices may be None - Annotate test helpers and cast untyped JSON in tests
- Add py.typed so installed packages expose their type hints - Include py.typed in the wheel (package_data) and sdist (MANIFEST.in) - Update tox envlist to the supported Python versions (3.11-3.14)
receive_json kept retrying on EOF until the timeout, then raised a misleading TimeoutError. It now raises ConnectionError straight away. This also fixes the flaky subscribe tests: the mock DCS server now keeps the connection open until the client closes it, and the data-available wait uses a monotonic clock with a 5 s timeout.
- DriverId() now defaults to board 0, port 0 and hashes by board and port, matching upstream DSF - Move the get_kinematics_type docstring to the top of the function - Let _read_socket_file take the config path so it can be tested - Add tests for DriverId, kinematics and filament monitor type resolution, invalid global values, ModelDictionary.from_json and SOCKET_FILE lookup - Replace the star import in test_object_model with explicit imports
Wrap long __all__ lists and function signatures to satisfy flake8's 120 character limit.
Mechanical reformat with black 26.5.1 (line length 120). No functional changes. - Configure black's line length in pyproject.toml - Pin black in tox.ini
- Wrap long comments, docstrings and error messages - Replace a bare except with except BaseException (same behaviour) - Replace the star import in object_model/directories - Mark AxisLetter.l as an intentional E741 exception - Exempt deliberate late imports (E402) in dsf/__init__.py and connections/__init__.py, and embedded JSON payloads in tests (E501)
- Run black --check and the full flake8 config in CI, matching tox - Pin black in requirements.txt - Move the check-manifest ignore list to setup.cfg and ignore development-only files so tox passes - Add .git-blame-ignore-revs for the black reformat commit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Library now passes strict pyright type checking enforced by CI