pyre-check
typing
| pyre-check | typing | |
|---|---|---|
| 25 | 49 | |
| 7,165 | 1,760 | |
| 0.2% | 0.5% | |
| 9.8 | 8.9 | |
| 1 day ago | 5 days ago | |
| OCaml | Python | |
| MIT License | GNU General Public License v3.0 or later |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
pyre-check
-
Type hints in Python (1)
is used with the type checkers such as mypy, pyright, pyre-check, pytype, etc.
-
Pylyzer – A fast static code analyzer and language server for Python
Did you come across pyre in your search? MIT license and pretty fast.
https://github.com/facebook/pyre-check
-
Enhance Your Project Quality with These Top Python Libraries
Pyre is a performant type-checker developed by Facebook. Pyre can analyse codebases with millions of lines of code incrementally – providing instantaneous feedback to developers as they write code.
-
A Tale of Two Kitchens - Hypermodernizing Your Python Code Base
Pyre from Meta, pyright from Microsoft and PyType from Google provide additional assistance. They can 'infer' types based on code flow and existing types within the code.
-
Ruff v0.1.0
Have you seen Pyre[0]? Not Rust, OCaml, and pretty fast. Made by a team at Meta and open sourced on GitHub. If you use python-lsp, I wrote an extension[1] to enable integration (though I haven't tested it recently, been programming in rust; it is mostly a "for me" extension).
0: https://pyre-check.org/
1: https://github.com/cricalix/python-lsp-pyre
- Should I Rust or should I Go
- Writing Python like it's Rust
-
Buck2, a large scale build tool written in Rust by Meta, is now available
Internally we use Pyre for Python type checking: https://github.com/facebook/pyre-check
- Are there any sectors that use Haskell as a main programming language?
-
It is becoming difficult for me to be productive in Python
Before type hinting, work had intense rules and linters enforcing docstrings with types. Now, type hints and automatic pyre runs take care of all the heavy lifting.
typing
- Ty: An fast Python type checker and LSP
-
A "Frozen" Dictionary for Python
- https://github.com/python/typing/issues/242
-
Why Today's Python Developers Are Embracing Type Hints
Indeed.
IMO, the trick to really enjoying python typing is to understand it on its own terms and really get comfortable with generics and protocols.
That being said, especially for library developers, the not-yet-existant intersection type [1] can prove particularly frustrating. For example, a very frequent pattern for me is writing a decorator that adds an attribute to a function or class, and then returns the original function or class. This is impossible to type hint correctly, and as a result, anywhere I need to access the attribute I end up writing a separate "intersectable" class and writing either a typeguard or calling cast to temporarily transform the decorated object to the intersectable type.
Also, the second you start to try and implement a library that uses runtime types, you've come to the part of the map where someone should have written HERE BE DRAGONS in big scary letters. So there's that too.
So it's not without its rough edges, and protocols and overloads can be a bit verbose, but by and large once you really learn it and get used to it, I personally find that even just the value of the annotations as documentation is useful enough to justify the added work adding them.
[1] https://github.com/python/typing/issues/213
-
Ask HN: Which Open Source License to Choose for a Python Language Server
[1]: https://htmlpreview.github.io/?https://github.com/python/typing/blob/main/conformance/results/results.html
-
Ty: An fast Python type checker and language server, written in Rust
Two examples that come to mind are: https://discuss.python.org/t/pep-692-using-typeddict-for-mor...
and: https://github.com/python/typing/issues/1252
-
Python Type System Conformance Test Results
preview: <https://htmlpreview.github.io/?https://github.com/python/typ...>
-
Astral: Next-Gen Python Tooling
Pyright was itself a big improvement over Mypy. Just look at this for starters: https://htmlpreview.github.io/?https://github.com/python/typ...
If Astral can leapfrog pyright too, great. But I think it will be significantly harder than leapfrogging flake8 and black.
- Writing Python like it’s Rust
- Library for single dispatch on Generic subscript
-
Thoughts on nested / inner functions in Python for better encapsulation and clarity?
Iterable[str] is unfortunately evil as it matches str which is often unintended. (see: https://github.com/python/typing/issues/256) One would need both NOT-type and AND-type in order to properly handle these.
What are some alternatives?
typeshed - Collection of library stubs for Python, with static types
Telethon - Pure Python 3 MTProto API Telegram client library, for bots too!
pyright - Static Type Checker for Python
flask-parameter-validation - Get and validate all Flask input parameters with ease.
mypy - Optional static typing for Python