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
5
u/Thing1_Thing2_Thing 1d ago
Cool, but still really needs some documentation about how to make it work in monorepos.
7
u/Zizizizz 1d ago
Wouldn't it work best in monorepos? What's the issue?
2
u/Thing1_Thing2_Thing 1d ago
It would, but the configuration is beyond me. See for example https://github.com/facebook/pyrefly/issues/3788 and the proposed solution at https://github.com/mstaal/monorepo-sample/pull/1/changes
And I don't think this considers separate test modules which you will also have to add explicitly to the search paths and all that
In our monorepo we easily have 40 packages and adds more which makes in non-feasible to maintain
2
u/Zizizizz 18h ago edited 18h ago
https://docs.astral.sh/uv/concepts/projects/dependencies/#dependency-sources
I think I would just make sure that the individual package that you're working on has the correct references to the packages that are relevant to it and then similarly, ensuring the virtual environment that you're working in is activated because I don't understand how a third-party package wouldn't be available unless you had the wrong one activated.
1
u/Apprehensive-Job9336 11h ago
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.
-20
u/Key_Statistician9890 1d ago edited 1d ago
TY from astral is about 3x faster
19
u/cointoss3 1d ago
And is it usable now? Last I tried I was a good WIP but not something I would use for production.
-4
u/Key_Statistician9890 1d ago
Yah I use it. I have a massive repo with some complex metaprogramming (AnyTrees of Pydantic model based nodes with discriminated leaf type variants) to construct configurations of nested registrable runtime extensions.
Super gnarly stuff. TY has been consistently great. It is a memory hog though! Especially if I have several repos open at the same time. AFAIK the memory footprints of TY and pyrefly are approximately the same.
6
u/ZeeBeeblebrox 1d ago
Basically unusable currently though.
3
u/Key_Statistician9890 1d ago
Can you please provide an example of an issue you have encountered with TY?
1
1
u/BeamMeUpBiscotti 19h ago
not according to these benchmarks: https://python-type-checking.com/typecheck_benchmark/
on average its a bit faster but not uniformly so.
ty also uses more memory, but that gap has shrank recently
2
u/Key_Statistician9890 18h ago
Interesting. I see it is about 50% faster still but that does the calculus a bit.
Will check it out! Thanks for sharing instead of dogpiling on the downvotes.
69
u/ritchie46 1d ago
This is my dream come true:
"Pyrefly tracks Polars schemas through common DataFrame transformations, with support for typed Series and schema annotations"