Skip to content

Chore/type hinting - #25

Merged
AndyEveritt merged 19 commits into
v3.7-devfrom
chore/type-hinting
Sep 30, 2026
Merged

AndyEveritt merged 19 commits into
v3.7-devfrom
chore/type-hinting

Conversation

@AndyEveritt

Copy link
Copy Markdown
Collaborator

Library now passes strict pyright type checking enforced by CI

- 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
@AndyEveritt
AndyEveritt merged commit 3e1d3fd into v3.7-dev Sep 30, 2026
5 checks passed
@AndyEveritt
AndyEveritt deleted the chore/type-hinting branch September 30, 2026 08:25
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 30, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant