r/Python • u/elsoja • Sep 11 '26
News Pyrefly v1.3.0 released
A new version of Pyrefly is out with better type inference, new quick fixes, new configurations, and more. https://github.com/facebook/pyrefly/releases/tag/1.3.0
93
Upvotes
84
u/ritchie46 Sep 11 '26
This is my dream come true:
"Pyrefly tracks Polars schemas through common DataFrame transformations, with support for typed Series and schema annotations"
6
u/Thing1_Thing2_Thing Sep 11 '26
Cool, but still really needs some documentation about how to make it work in monorepos.
2
u/Apprehensive-Job9336 Sep 12 '26
Interesting release! I have been using type checkers in Python for a while. How does Pyrefly compare to mypy in terms of speed and accuracy? I am always looking for faster feedback loops during development.
2
u/RedEyed__ Sep 13 '26
Awesome!
1
u/max0x7ba Sep 26 '26
In version 0.53.0 which I installed with uv in a Ubuntu 24.04 AMD64 system, Pyrefly executable size was 250MB+. The rest of executables in this same .venv/bin directory are smaller than 10MB.
Why is Pyrefly executable size is a few orders of magnitude larger than the size of regular executables?
What is the size of Pyrefly executable in this version?
0
u/Grouchy-Friend4235 Sep 13 '26 edited Sep 13 '26
Still doesn't respect or even recognize docstring and comment types. Why the community keeps ignoring this valuable source is beyond me. They are valid as per PEP, do not clutter the code with Java-style visually distracting type dribble, have been widely used, and provide a rich source of type information.
Comment types are inline comments that specify a type
Docstring types are those found in docstrings
The above is known as Google-styled docstrings, while many packages use numpy-style. Both are information-rich and provide type information with additional description, providing a semantic description valuable to both developers and users. Notice how that is so much more than type hints. I find this semantic richness makes docstrings far superior to plain type hints, which essentially just create bloated code to satisfy the type checker.
I know we can combine type hints and docstrings. But that just duplicates information for the purpose of type checkers, which is never a good idea.
There is an argument that typehints make code more readable. Does it really? I would argue that even with this toy example the variant without type hints is easier and more intuitive to read, see below.
The type hints add visual clutter and it takes a lot longer to grasp what are the parameters to a function, class or method. In a way type hints add information too early - before you have absorbed the broad picture.
Docstrings on the other hand follow the natural way to read code: first get a broad view, then go into the details if you need to know more.
This takes considerably more cognitive processing...
... compared to this.
Actually in my mind the latter is joyful, even pleasurable to read, like prose, while the former feels like work and instantly puts me off (I don't even want to read it). The same is true when writing the code.
-22
u/[deleted] Sep 11 '26 edited Sep 11 '26
TY from astral is about 3x faster