Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage of type hints #316

Open
SofianChay opened this issue Sep 14, 2022 · 1 comment
Open

Usage of type hints #316

SofianChay opened this issue Sep 14, 2022 · 1 comment

Comments

@SofianChay
Copy link

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
Copy link
Collaborator

rth commented Sep 14, 2022

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
  1. Add the following to .pre-commit-config.yaml
  - repo: https://github.com/pre-commit/mirrors-mypy
    rev: "v0.971"
    hooks:
      - id: mypy
  1. 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.
  2. Update the documentation.

(I had to do this for another repository recently)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants