lisphilar / covid19-sir

CovsirPhy: Python library for COVID-19 analysis with phase-dependent SIR-derived ODE models.

Home Page:https://lisphilar.github.io/covid19-sir/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Dev] use type hint and type checker

lisphilar opened this issue · comments

Checkbox

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.

We may need the sphinx.ext.autodoc.typehints extension to show types in documentation.
https://github.com/tox-dev/sphinx-autodoc-typehints

sphinx.ext.autodoc.typehints will be used in documentation workflow with #1285.

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