[Dev] use type hint and type checker
lisphilar opened this issue · comments
Hirokazu Takaya commented
Checkbox
- I agree to follow code of conduct and to engage in discussion actively.
- I have confirmed I will follow and update contribution guideline.
Issues of the current workflow
Type hints are documented in docstings and un-analyzable with type checker.
Action items
- use type hints in APIs users will call: downloading
- use type hints in APIs users will call: dynamics
- use type hints in APIs users will call: engineering
- use type hints in APIs users will call: gis
- use type hints in APIs users will call: science
- use type hints in APIs users will call: util
- use type hints in APIs users will call: metadata
- use type hints in internal classes and methods: downloading
- use type hints in internal classes and methods: dynamics
- use type hints in internal classes and methods: engineering
- use type hints in internal classes and methods: gis
- use type hints in internal classes and methods: science
- use type hints in internal classes and methods: util
- use type hints in internal classes and methods: metadata
- use type checker: e.g.
pyright
,mypy
,pytype
Additional Context
To keep backward compatibility, from __future__ import annotations
and typing_extension
library may be used.
Hirokazu Takaya commented
We may need the sphinx.ext.autodoc.typehints
extension to show types in documentation.
https://github.com/tox-dev/sphinx-autodoc-typehints
Hirokazu Takaya commented
sphinx.ext.autodoc.typehints
will be used in documentation workflow with #1285.
Hirokazu Takaya commented
With "1286,
- use type hints in APIs users will call: dynamics
- use
pyright
as type checker - fix/suppress errors of type hints found by
pyright
- update intersphinx mapping to link with numpy and matplotlib in docs/conf.py