Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dogweather/python-exhaustiveness-adts-monads
Demo code showing off the new true exhaustiveness checks with Python 3.10 + Pyright
https://github.com/dogweather/python-exhaustiveness-adts-monads
mypy pattern-matching pyright python-typing type-systems
Last synced: about 1 month ago
JSON representation
Demo code showing off the new true exhaustiveness checks with Python 3.10 + Pyright
- Host: GitHub
- URL: https://github.com/dogweather/python-exhaustiveness-adts-monads
- Owner: dogweather
- Created: 2022-10-03T05:03:04.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2023-02-11T02:05:48.000Z (almost 2 years ago)
- Last Synced: 2024-04-15T22:23:24.852Z (7 months ago)
- Topics: mypy, pattern-matching, pyright, python-typing, type-systems
- Language: Python
- Homepage:
- Size: 59.6 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Python Exhaustiveness Checking Demo
Demo code showing the new true exhaustiveness checking with Python 3.10 + Pyright.
I created this repo to support [my blog post](https://dogweather.dev/2022/10/03/i-discovered-that-python-now-can-do-true-match-exhaustiveness-checking/)
and make it easy to try out
this technique.## To set up
You'll need [Poetry](https://python-poetry.org) and Python 3.10. I used 3.10.6 and 3.10.7 to write this.
```
poetry install
poetry shell
```## Now you can run Pyright
To see the exhaustiveness checks for all the files:
```
pyright
```## VS Code
VS Code has **Pylance** checking built into its Python extension. This
brings the Pyright checking into the IDE. IMO it's an amazing experience.Pylance/Pyright should pick up
the settings from `pyproject.toml`. The settings in VS Code seem to mostly
be overridden by the file.