The 15 line limit seems like the weakest part of this. Line count isn't a good metric for anything. I think it's important that an author can explain the WHY of the change in detail, and the WHAT and HOW high level at least. That way we get the best of human and AI. How we measure that exactly not sure, but lines of code doesn't really do it justice.
I agree that lines of code is an invalid metric to use when programming, but a lot of the supposed productivity gains with generative AI use lines of code as a measurement. It kind of seems that some people have never taken this lesson to heart.
LoC is not a good metric for productivity. But, because you can’t measure the ability of an author to explain a change, LoC is what you’ve got.
If you don’t literally limit how big of a change an agent can make in one go, you are placing an asymmetric burden on OSS maintainers, who will more than likely end up spending more time reviewing your PR than anyone did writing it.
Tried it on a 10k loc project which never had a type checker: 0.5s, 450 results. More than 400 of them are one pattern, a dict of kwargs splatted into a call (`*kw`). ty infers the dict as `dict[str, str | int]` and flags every parameter against that. Is there any way to type the dict once, or is a TypedDict the way to go?
We do generally support this pattern for dictionary literals, but we can't track the precise types of arbitrary keys if the dictionary is created dynamically, you'd have to use a TypedDict in that case.
Summarizing, for something that is an argument with specific fields you'd use a Mapping or a MutableMapping as the annotation, and if that's a return value, then it should be a TypedDict. Sometimes TypedDict also makes sense as an argument annotation, e.g., if it has to be a dict strictly.
For a generic dictionary, like you know that you're drawing from a set of possible kwargs that are all string values, you can also just annotate them with an "anonymous" dict like what Ty is inferring on your codebase.
From my experience working with complicated python dicts in an established project and trying to rely on the automatic inference, putting off making a TypedDict, I'd say don't do it.
Just make the typed one immediately and save yourself the headache. Though in my case ty was actively updating and messing with the dicts, so a valid inference one day would be invalid the next time I updated dependencies (new rules would help in other places, so I would gain some and lose some from doing this).
For me the trigger isn't the model deciding something is valuable. It writes a note when I correct it, or when it disproves an assumption it was working from.
It is important that there is an index of some sort though that is kept up-to-date.
Some do go stale. Each note has a verified date, and a note that decays gets an expiry date. And I have a counter in there. If something doesn't get used, it gets sweeped again.
reply