Improve deprecation warning

Those are two requests I’d be willing to implement myself if you accept it.

I would love the warning for deprecated name to indicate the full file name of where the deprecated name was used. Right now it start the path with the add-on folder name, which make it not clicable in terminal. It’s not that hard to find with grep or other tool, but still would save some time, especially if anki runs in a terminal where filenames are clicable.

I would love to get a limit of one warning by deprecation. Or if we do as I suggest above, one warning by usage of the deprecated function. This would ensure that my terminal is not spammed by deprecation notice. I’ll still get them, but I’ll also have some other useful information I’m looking for.

Admittedly, that did force me to update all of my .model()to .note_type() pretty quickly, so I guess the spam ensured deprecated method where not used anymore; but I would have preferred to have the choice to postpone those corrections and keep my terminal usable

(On the longer term, I’m really thankful you did the change of name. That’s really great. I can’t wait to see changed or ModelsDictProxy changed, and to have no models anymore at all.)

I don’t have strong feelings here, though I do think it may make the messages flood the terminal a bit more with full paths in them. :slight_smile: Rather than fixing them one at a time like that, why don’t you load the entire add-on folder into an editor, then use the search&replace tool to locate & fix all references to the deprecated string at once?

I don’t really think it makes sense to be limiting them by warning, but limiting warnings to once per ‘file:line number’ in the calling code seems reasonable.