Skip to content

Conversation

@averagehat
Copy link
Owner

@averagehat averagehat commented Jul 18, 2019

Unfortunately this PR includes python3 changes as well as the mypy changes, I think up to
a58386c

The version upgrade was necessitated for convenient mypy type annotations

A couple things:

  1. diff_ranks is going to be removed, as it is bugged and there is a correct implementation in summary.py
  2. MyPy has a generic(?) IO type. https://mypy.readthedocs.io/en/latest/cheat_sheet_py3.html#miscellaneous
  3. inline typing is supposed to look like x: int = 3
  4. mypy has a TypedDict, which is usual with argparse/docopt as well as the config file. However, we may be better of using pydantic or something similar (add py.typed marker file for PEP-561 support pydantic/pydantic#391) because we can hide the constructor behind assertions that enforce other guarantees about the type (like extant_file)
  5. Literals (only in latest version via dev/github): https://gist.github.com/averagehat/8aa433f85900559799c2896f19c985a7

@averagehat
Copy link
Owner Author

Maybe sh.py can be typed by typing the __getattr__ as returning a function which takes kwargs of values Union[int,str,Path]

It wold be good to use Path or an equivalent newtype exclusively (like in pipeline.py, but not the case in pathos_sheet.py). One consideration is that path.py does not work with pyfakefs which I will likely want to use for nice fast tests of the glue code. We may also want types like "OutPath" and "InPath."
Along these lines, use of IO[Any] may be useful in avoiding a leak on pyfakefs tests (where because pyfakefs doesn't capture all filesystem operations, and something unintended happens on the real file system.

@averagehat averagehat mentioned this pull request Jul 20, 2019
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

Successfully merging this pull request may close these issues.

3 participants