paris-saclay-cds / ramp-workflow

Toolkit for building predictive workflows on top of pydata (pandas, scikit-learn, pytorch, keras, etc.).
https://paris-saclay-cds.github.io/ramp-docs/
BSD 3-Clause "New" or "Revised" License
68 stars 43 forks source link

Usage of type hints #316

Open SofianChay opened 2 years ago

SofianChay commented 2 years ago

Hi everyone, we were wondering with @albertcthomas and @kegl if it was a good idea to use type hints since I wanted to start using them on the time series workflow. Is it ok for everyone?

@rth @agramfort

rth commented 2 years ago

Yes, I would be very strongly in favor of adding mypy with type annotations. I think the easiest would be something like,

  1. Put the following in pyproject.toml
    [tool.mypy]
    python_version = "3.8"
    show_error_codes = true
    ignore_missing_imports = true
  2. Add the following to .pre-commit-config.yaml
    - repo: https://github.com/pre-commit/mirrors-mypy
    rev: "v0.971"
    hooks:
      - id: mypy
  3. Enable https://pre-commit.ci/ to run on this repo, which will then also run the mypy checks in CI. Or you can configure it manually in the existing CI as you prefer.
  4. Update the documentation.

(I had to do this for another repository recently)