Add typing support
See original GitHub issueSuggestion: add from __future__ import annotations to all your files (using isort or reorder_python_imports), make sure you are using mypy 0.800, make sure you have your minimum python version for mypy set to 3.7, and then use things like this in your types!
mixed_list: list[str | int] = [1, "hi", 2]
😃
_Originally posted by @henryiii in https://github.com/scikit-hep/pyhf/issues/1272#issuecomment-766285638_
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
typing — Support for type hints — Python 3.11.1 documentation
Source code: Lib/typing.py This module provides runtime support for type hints. The most fundamental support consists of the types Any, Union, Callable, ...
Read more >Using Typing.com — Support and Knowledge Base
Check out our knowledge base to find answers to all your questions about setting up and using Typing.com. If you still need help,...
Read more >Python Type Checking (Guide) - Real Python
In this guide, you'll look at Python type checking. Traditionally, types have been handled by the Python interpreter in a flexible but implicit...
Read more >Python typing module - Use type checkers effectively
Introduced since Python 3.5, Python's typing module attempts to provide a way of hinting types to help static type checkers and linters ...
Read more >Add support for external annotations in the typing module #600
We propose adding an Annotated type to the typing module to decorate existing types with context-specific metadata. Specifically, a type T ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I’m running this on
feat/typingnow and will rebase and update that branch.At SciPy 2021 @obi1kenobi and @ColCarroll gave a great talk in the maintainers track on
typing_copilot. This seems like the way forward forpyhf!We can incrementally ratchet down the strictness.
For reference, c.f. https://github.com/arviz-devs/arviz/pull/1528
I think though a great endorsement for it is Colin’s comment in the Q&A
Sounds like me. 😃
cc @alexander-held