Skip to content

mypy checks fail on case-insensitive filesystem #47

Closed

Description

@SteVwonder

The case insensitivity means that an unintentional alias is created for the Job class since psi/j/Job.py and psi/j/job.py seemingly both exist.

(.venv-vscode-focal)  fluxuser@1f7fe27de5f4:/workspaces/psi-j-python$ make typecheck
mypy --config-file=.mypy --strict src tests
src/psi/j/Job.py:117: error: Argument 1 to "cancel" of "JobExecutor" has incompatible type "psi.j.Job.Job"; expected "psi.j.job.Job"
(.venv-vscode-focal)  fluxuser@1f7fe27de5f4:/workspaces/psi-j-python$ mypy --version
mypy 0.910

The impact here is that mypy checks will fail on any mac that has a case insensitive filesystem and windows machines. I also suspect that runtime can be impacted by this (e.g., import psi.j.Job - should that import the "Job.py" file or the Job class exposed by psi.j).

Activity

  1. SteVwonder commented on Aug 10, 2021

    @SteVwonder
    ContributorAuthor

    Two solutions that I'm aware of would be to either rename the Job class or rename psi/j/job.py to something else, maybe psi/j/job_class.py. If we rename the file, you can still import/reference the Job class as psi.j.Job since the psi/j/init.py exports it.

  2. hategan commented on Jan 18, 2023

    @hategan
    Collaborator

    There appear to be issues in general with python imports and mypy when running on code that is on case-insensitive file systems. Since the type correctness of the psi/j code can be verified on other systems, I do not believe that we gain much by adding workarounds to actual bugs (or regressions; see python/mypy#1961) in mypy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions