Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Version compatibility check for optional dependencies

Open
#576 6 comments 0 reactions 0 assignees View on GitHub

@pranjalm37 is already working on this.

Since Aug 8, 2026.

  • #837 by @pranjalm37 — open

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
backend

Research direction

Start by reading the optional rich traceback integration and its dependency declarations; the issue does not name specific files or tests. Check how supported rich versions affect Traceback.from_exception, then consider how compatibility should be detected and communicated. Done means an incompatible optional dependency is handled safely and the behavior is covered by tests, including the reported rich versions.

Written by the indexing model from the issue text.

Description

Hi folks,

I recently ran into an issue with the rich integration, for traceback formatting.

With structlog version 23.2.0, and rich version 13.0.1, receiving a traceback results in a crash during error handling, as follows :

[...]
During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib64/python3.10/logging/__init__.py", line 1100, in emit
    msg = self.format(record)
  File "/usr/lib64/python3.10/logging/__init__.py", line 943, in format
    return fmt.format(record)
  File "<redacted>/.venv/lib/python3.10/site-packages/structlog/stdlib.py", line 1062, in format
    ed = p(logger, meth_name, ed)
  File "<redacted>/.venv/lib/python3.10/site-packages/structlog/dev.py", line 505, in __call__
    self._exception_formatter(sio, exc_info)
  File "<redacted>/.venv/lib/python3.10/site-packages/structlog/dev.py", line 218, in __call__
    Traceback.from_exception(
TypeError: Traceback.from_exception() got an unexpected keyword argument 'locals_hide_dunder'
[...]

Upgrading rich to version 13.7.0 solves the issue, stacktraces now appear normally.

I undersand that rich is entirely optional to structlog, but I was wondering if maybe we could add some kind of protection against using an incompatible version of it. On top of my head :

  • specifying version constraints. I'm unsure if the dependency constraint system permits to express "This is an optional dependency, so, please don't install it automatically with me ; but if it's present, ensure it validates those constraints, because I'm gonna use it". If that's possible, it would, in my opinion, be an ideal solution
  • checking, at some initialization step (I assume we're making some kind of presence check for rich during structlog init), that the installed version is indeed recent enough, and don't attempt to use it if not. Maybe log something indicating the minimum required version
  • checking version when attempting to use it. This sounds expensive at runtime though, so, probably not a good idea.
  • some heuristic checks might be possible too, like, checking the function signature before attempting to call it, for non-existing arguments, etc. This would be pretty brittle, could not deal with all kinds of incompatibilities or bugs, etc ; so, probably not great either.

Also, similar checks could make sense for other optional dependencies (like better-exceptions)

What do you think ? Does that seem reasonable ?

Dominant language
Python
Stars
5k
Forks
302
Avg merge
17m
Merged PRs (30d)
4

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from hynek/structlog

All issues in hynek/structlog

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.