scipp / sciline

Build scientific pipelines for your data
https://scipp.github.io/sciline/
BSD 3-Clause "New" or "Revised" License
10 stars 2 forks source link

MAINT: Error out gracefully with an unsupported scheduler #162

Closed MridulS closed 6 months ago

SimonHeybrock commented 7 months ago

mypy is failing.

MridulS commented 7 months ago

Yeah, runtime checks conflicts with mypy.

I don't know what's the best practice here. If there is type annotated code already should there be no unit test for isinstance checks? Or should mypy just be silenced there? mypy here will also complain about the code being unreachable as the variable scheduler is already type annoated as Scheduler so there shouldn't be a case where scheduler is not an instance of something that follows the Scheduler protocol according to the type information. But this requires the user to write their code in a type checking enabled IDE (I was doing this is in a vanilla jupyter notebook and hence tripping up on this)

SimonHeybrock commented 7 months ago

Yeah, runtime checks conflicts with mypy.

I don't know what's the best practice here. If there is type annotated code already should there be no unit test for isinstance checks? Or should mypy just be silenced there?

I do not know either, we have selectively ignored mypy in other places as well, so maybe go with that?