Highlights
Given how long this release took, it's pretty thicc with nice things all over the board! Apologies for the long release cycle; it's been a victim of the slopocalypse and me trying to navigate my way thru the new normal. Extra big thanks to my sponsors for not abandoning me in these unironically trying times. ❤️
Full changelog below!
Special Thanks
This release would not be possible without my generous sponsors! Thank you to all of you making sustainable maintenance possible! If you would like to join them, go to https://github.com/sponsors/hynek and check out the sweet perks!
Above and Beyond
Variomedia AG (@variomedia), Tidelift (@tidelift), Kraken Tech (@kraken-tech), Klaviyo (@klaviyo), Privacy Solutions GmbH (@privacy-solutions), FilePreviews (@filepreviews), Ecosystems (@ecosyste-ms), TestMu AI Open Source Office (Formerly LambdaTest) (@LambdaTest-Inc), GitHub (@github), Doist (@Doist), Daniel Fortunov (@asqui), and Kevin P. Fleming (@kpfleming).
Maintenance Sustainers
Buttondown (@buttondown), Christopher Dignam (@chdsbd), Magnus Watn (@magnuswatn), David Cramer (@dcramer), Rivo Laks (@rivol), Polar (@polarsource), Mike Fiedler (@miketheman), Duncan Hill (@cricalix), Colin Marquardt (@cmarqu), Pieter Swinkels (@swinkels), Nick Libertini (@libertininick), Brian M. Dennis (@crossjam), Al Sweigart (@asweigart), Celebrity News AG (@celebritynewsag), The Westervelt Company (@westerveltco), Sławomir Ehlert (@slafs), Mostafa Khalil (@khadrawy), Filip Mularczyk (@mukiblejlok), Thomas Klinger (@thmsklngr), Andreas Poehlmann (@ap--), August Trapper Bigelow (@atbigelow), Carlton Gibson (@carltongibson), and Roboflow (@roboflow).
Full Changelog
Removed
- Python 3.8 and 3.9 support.
Deprecated
- Support for better-exceptions is deprecated and will be removed within a year. Use our Rich integration or copy-paste the one line of code you need. #802
Added
-
Python 3.15 support. #813
-
structlog.dev.rich_monochrome_tracebackfor Rich-based monochrome exception rendering and add support for it throughoutstructlog.dev.ConsoleRendererwhen the user asks for no colors. #794 -
structlog.BytesLoggernow has anameattribute which allows you to use it with thestructlog.stdlib.add_logger_name()processor without using the standard library integration. #786 -
structlog.processors.CallsiteParameterAddernow supportsCallsiteParameter.QUAL_MODULEthat adds the qualified import name of the module of the callsite, or__main__if the module is the entry point. This is only available for structlog-originated events since the standard library has no equivalent (except for the convention of setting the logger's name to__name__). #812 -
structlog.stdlib.BoundLoggernow hasis_enabled_for()andget_effective_level()methods that are snake_case aliases for itsisEnabledFor()andgetEffectiveLevel()methods. This makes it more compatible with the nativestructlog.typing.FilteringBoundLogger, so you can swap configurations without changing your call sites. #818
Changed
structlog.dev.ConsoleRendererdoes not warn anymore when theexceptionkey has a rendered value despite having a fancy formatter configured. #790
Fixed
-
structlog.BytesLogger,structlog.PrintLogger, andstructlog.WriteLoggernow hold weak references to the files they use for output. This prevents their leakage in long-running processes that open many logfiles, such as task executors that create a per-taskBytesLoggerorWriteLogger. #807 -
structlog.WriteLoggeris usable after unpickling. #787 -
structlog.processors.CallsiteParameterAddernow reports the calling thread's id and name for async log methods, instead of the thread from the executor pool that runs the underlying sync logger. #710 #805
This release contains contributions from @ashb, @BlocksecPHD, @funkyfuture, @hynek, @JiwaniZakir, @sirosen, and @veeceey.
Artifact Attestations
You can verify this release's artifact attestions using GitHub's CLI tool by downloading the sdist and wheel from PyPI and running:
$ gh attestation verify --owner hynek structlog-26.1.0.tar.gzand
$ gh attestation verify --owner hynek structlog-26.1.0-py3-none-any.whl