|6 days ago||6 days ago|
|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.
You Should Compile Your Python and Here’s Why
3 projects | news.ycombinator.com | 29 Apr 2022
how, when mypy itself has only "type: ignore" as a workaround for many scenarios?
here's a list of 41 issues where either the user or the mypy devs are saying "use type: ignore as a workaround for now":
4 projects | reddit.com/r/neoliberal | 25 Apr 2022
Python’s “Type Hints” are a bit of a disappointment to me
It reminds me of this 5 year old bug in mypy: "int is not a Number?" .
Creating A Modern Python Development Environment
14 projects | dev.to | 12 Apr 2022
Mypy is an optional static type checker that aims to combine the benefits of dynamic (or “duck”) typing and static typing. The benefits of statically typed code are increased readability and maintainability. For an existing code base here's a guide on how to implement Mypy.
This Week In Python
5 projects | dev.to | 8 Apr 2022
mypy – Optional static typing for Python
Mypy won't detect instance attribute access
1 project | reddit.com/r/learnpython | 27 Mar 2022
You might get some luck by asking it on the mypy repo.
Type Hinting - Constrain metaclass of typing.Type
2 projects | reddit.com/r/learnpython | 25 Mar 2022
Been looking into it a bit more. I think you're right, it's not supported. Turns out mypy only has very limited support for type hinting metaclasses. This page suggests it may be possible to support this with a mypy plugin, but I'm really not looking to do something that involved. Just wanting to hint an existing API :/ I suppose I could look into tweaking the API to be more hint-able, but I think I'll just accept this piece isn't perfect.
From Python to Dart - Day 2, Meet the dart CLI
7 projects | dev.to | 7 Mar 2022
When working with several people on one project, it is very often necessary to use a single style of code design, writing comments, using variable names, etc. In the Python world, we use linters flake8, various formatters (black, yapf, autopep8) and mypy for type checking. How can Dart help meet these challenges?
What is Python?
2 projects | dev.to | 16 Feb 2022
Since Python 3.5, type annotations can be used for possible static analysis, refactoring, runtime type checking and code generation. An optional static type checker named mypy supports compile-time type checking.
High Performance subset of python
6 projects | reddit.com/r/Python | 14 Feb 2022
Also, there’s Mypyc.
pylsp with VSCode?
2 projects | reddit.com/r/vscode | 29 Apr 2022
I'm using VSCodium (VSCode without Microsoft's telemetry) which doesn't work with pylance, Microsoft's Python language server. It seems like the two main alternative contenders are pyright and pylsp. I've been trying pyright, which has an extension, but it doesn't seem to support docstrings on all packages. I couldn't find any configuration options for setting an alternative language server in VSCode. Anyone have some tips on how to set up pylsp?
How do I configure a linter to check if method signatures are type hinted?
1 project | reddit.com/r/learnpython | 28 Apr 2022
While mypy is the (and also my) go-to solution, I recently found pyright but haven't used it yet.
Python’s “Type Hints” are a bit of a disappointment to me
Every point in this blog post strikes me as either (1) unaware of the tooling around python typing other than mypy, or (2) a criticism of static-typing-bolted-on-to-a-dynamically-typed-language, rather than Python's hints. Regarding (1), my advise to OP is to try out Pyright, Pydantic, and Typeguard. Pyright, especailly, is amazing and makes the process of working with type hints 2 or 3 times smoother IMO. And, I don't think points that fall under (2) are fair criticisms of type *hints*. They are called hints for a reason.
Otherwise, here's a point-by-point response, either recommending OP checks out tooling, or showing that the point being made is not specific to Python.
> type hints are not binding.
There are projects  that allow you to enforce type hints at runtime if you so choose.
It's worth mentioning that this is very analogous to how Typescript does it, in that type info is erased completely at runtime.
> Type checking is your job after all, ...[and that] requires maintenance.
There are LSPs like Pyright (pyright specifically is the absolute best, IMO) that report type errors as you code. Again, this is very very similar to typescript.
> There is an Any type and it renders everything useless
I have never seen a static-typing tool that was bolted on to a dynamically typed language, without an `Any` type, including typescript.
> Duck type compatibility of int and float
The author admits that they cannot state why this behavior is problematic, except for saying that it's "ambiguous".
> Most projects need third-party type hints
Again, this is a criticism of all cases where static types are bolted on dynamically typed languages, not Python's implementation specifically.
> Sadly, dataclasses ignore type hints as well
Pydantic is an amazing data parsing library that takes advantage of type hints, and it's interface is a superset of that of dataclasses. What's more, it underpins FastAPI, an amazing API-backend framework (with 44K Github stars).
> Type inference and lazy programmers
The argument of this section boils down to using `Any` as a generic argument not being an error by default. This is configurable to be an error both in Pyright, and mypy.
> Exceptions are not covered [like Java]
I can't find the interview/presentation, but Guido Van Rossum specifically calls out Java's implementation of "exception annotations" as a demonstration of why that is a bad idea, and that it would never happen in Python. I'm not saying Guido's opinion is the absolute truth, but just letting you know that this is an explicit decision, not an unwanted shortcoming.
MyPy isn’t the only checker of course, there’s also Microsoft’s Pyright, among others. Pyright is fast and natively integrated in Microsoft’s Pylance VSCode extension, so these days I use Pyright’s type checking in real time even when I can’t be bothered to set up MyPy (no difficult, just not important for, say, <1000 line scripts).
pyright is a command line program https://github.com/microsoft/pyright
in my experience it's a far better type checker than mypy, which tends to silently not check things without you ever realising
Language server protocol choice
1 project | reddit.com/r/neovim | 21 Mar 2022
There's nothing to trust, pyright is entirely open source and you can check it yourself: https://github.com/Microsoft/pyright
Help with type hints and higher order functions
2 projects | reddit.com/r/learnpython | 17 Mar 2022
Turns out it was a bug in pyright - the first example never type checked with mypy. :/
Disabling virtual text for only some LSP messages
2 projects | reddit.com/r/neovim | 3 Mar 2022
From: https://github.com/microsoft/pyright/blob/main/docs/configuration.md2 projects | reddit.com/r/neovim | 3 Mar 2022
This discussion probably gives more context than I ever could: https://github.com/microsoft/pyright/issues/1118
Pyright – Static type checker for Python
1 project | news.ycombinator.com | 20 Feb 2022
What are some alternatives?
jedi-language-server - A Python language server exclusively for Jedi. If Jedi supports it well, this language server should too.
pylance-release - Documentation and issues for Pylance
python-language-server - Microsoft Language Server for Python
coc-jedi - coc.nvim wrapper for https://github.com/pappasam/jedi-language-server
lsp-pyright - lsp-mode :heart: pyright
pyre-check - Performant type-checking for python.
Poetry - Python dependency management and packaging made easy.
black - The uncompromising Python code formatter
coc-pyright - Pyright extension for coc.nvim
Flake8 - flake8 is a python tool that glues together pycodestyle, pyflakes, mccabe, and third-party plugins to check the style and quality of some python code.