Oh man. For internal calls to user-facing APIs that may invoke a warning, I've been doing things like `warnings.catch_warnings` and re-emitting warnings to correct the stack level. This seems a lot more convenient.
@eliottwillis78429 күн бұрын
Nice! I wonder why `skip_file_prefixes` parameter has not been added to the new `warnings.deprecated` decorator in Python 3.13.
@SQADIqw29 күн бұрын
Does it have the same issue pointing on library code instead of library user calls?
@anthonywritescode29 күн бұрын
weird that they didn't add the api there too -- even more confusing they have `stacklevel=1` as the default... but it acts as `stacklevel=2` (so at least they got that part right?)
@aditya_marathe29 күн бұрын
Finally installed 3.12 looking forward to daily driving it for the foreseeable future.
@mrswats29 күн бұрын
Never skip profecies
@ruroruro25 күн бұрын
Btw, I wonder, how would one use this feature if your python package provides both the libary code and an executable entrypoint (via __main__.py or via console_scripts or similar).
@anthonywritescode25 күн бұрын
imo the warning system doesn't really make sense for cli tools -- it's more for programmatic warnings
@CooperE1628 күн бұрын
You mentioned you mainly write tools as opposed to libraries. What’s the distinction? I understand libraries v applications? Are tools just applications for developers? eg CLI
@AcuteAangle28 күн бұрын
I usually understand a ‘tool’ to be a program with a single primary purpose. I would describe the Coreutils as ‘tools’, as well as single-purpose GUI utilities like balenaEtcher. The CLI programs provided by ImageMagick, `ffmpeg`, or `btrfs-progs` as well. I wouldn’t call Firefox, Emacs, or KDE tools, however, as they have an expansive scope, being more like long-lived workspaces you perform a variety of tasks in, rather than narrowly-scoped utilities for a specific class of uses. Daemons and games are also not usually called ‘tools’.
@anthonywritescode25 күн бұрын
for me libraries are imported and used by other software. tools are kinda everything else (self contained, don't provide programmatic apis) and for me they are almost all in the form of command line applications
@ln1138928 күн бұрын
I have been working with 3.12 for a while and this was very informative. Thanks for the video.