-
Notifications
You must be signed in to change notification settings - Fork 349
Open
Labels
Description
Problem
- The mypy type checks for jupyter_server are currently *nix only. E.g. it will fail when trying to access
socket.AF_UNIX
when on windows. Usingassert sys.platform != 'win32'
as recommended for platform specific code doesn't seem to work? - For the Windows specific code, we have
type: ignore
comments on them. Since we use a strict config, this will fail witherror: Unused "type: ignore" comment
on Windows. Note that it is not currently possible to ignore "unused ignore" errors: Cannot silence "unused 'type: ignore'" in version specific code python/mypy#8823 The out-of-the-box pre-commit integrations with git do not work on Windows: Add sys.executable escapes on Windows pre-commit/pre-commit#2613 (this can be fixed manually by each user by editing the git hooks file)- If you use the
core.autocrlf=true
setting, some linters (e.g. mdformat) will aggressively "fix" line endings, although git will subsequently fix it back when you dogit add
.
Proposed Solution
For 1. and 2.:
- Add
type: ignore
comments on all OS-specific bits, and use flagwarn_unused_ignores = False
. - Run mypy on Windows CI as well to avoid future breakages.
For 3., hopefully the PR gets accepted and released. If not, we can maybe add a separate instruction to the docs.
For 4., we can maybe add another run of end-of-line-fixer to the end of the pre-commit config? That way any mess that e.g. the mdformat extension makes will be rectified again. Not really critical, but nice-to-have.