Problem description
When using a custom debugger pytask throws ValueError: too many values to unpack (expected 2) when entering the debugging mode (full error + reproducer below). The reason for the ValueError is that usepdb_cls is not a tuple but a string ("pdbp:Pdb", which is the custom debugger I specified via pdbcls in the pyproject.toml). I've had this issue for several weeks, if not months, in all projects that use pytask.
I have tried running pytask on MacOS both via pixi and uv, same issue with both package managers. Interestingly, when I use old pixi.lock files everything works fine. The bug comes up when I start with a fresh lock file.
I tried the following additional things:
- The standard python debugger works.
- Doesn't matter whether I use
pdbp or pdbpp
pdbp works perfectly fine when using pytest
- @timmens reproduced the error on his Linux machine using pixi
This is the full error message:
pixi run pytask -s
────────────────────────────────────────────────────────────── Start pytask session ───────────────────────────────────────────────────────────────
Platform: darwin -- Python 3.13.9, pytask 0.5.5, pluggy 1.6.0
Root: /Users/marvin/GitHub/pdbp_test
Configuration: /Users/marvin/GitHub/pdbp_test/pyproject.toml
Collected 1 task.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> PDB set_trace (IO-capturing turned off) >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
╭─────────────────────────────────────────┬─────────╮
│ Task │ Outcome │
├─────────────────────────────────────────┼─────────┤
│ task_do_something.py::task_do_something │ F │
╰─────────────────────────────────────────┴─────────╯
──────────────────────────────────────────────────────────────────── Failures ─────────────────────────────────────────────────────────────────────
─────────────────────────────────────────────── Task task_do_something.py::task_do_something failed ───────────────────────────────────────────────
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /Users/marvin/GitHub/pdbp_test/task_do_something.py:3 in task_do_something │
│ │
│ 1 def task_do_something(): │
│ 2 │ a = 1 + 1 │
│ ❱ 3 │ breakpoint() │
│ 4 │ b = 2 │
│ 5 │ return a * b │
│ 6 │
│ │
│ /Users/marvin/GitHub/pdbp_test/.pixi/envs/default/lib/python3.13/site-packages/_pytask/debugging │
│ .py:308 in set_trace │
│ │
│ 305 │ def set_trace(cls, *args: Any, **kwargs: Any) -> None: │
│ 306 │ │ """Invoke debugging via ``Pdb.set_trace``, dropping any IO capturing.""" │
│ 307 │ │ frame = sys._getframe().f_back │
│ ❱ 308 │ │ _pdb = cls._init_pdb("set_trace", *args, **kwargs) │
│ 309 │ │ _pdb.set_trace(frame) │
│ 310 │
│ 311 │
│ │
│ /Users/marvin/GitHub/pdbp_test/.pixi/envs/default/lib/python3.13/site-packages/_pytask/debugging │
│ .py:302 in _init_pdb │
│ │
│ 299 │ │ │ │ │ else: │
│ 300 │ │ │ │ │ │ console.rule(f"PDB {method}", characters=">", style="default") │
│ 301 │ │ │
│ ❱ 302 │ │ return cls._import_pdb_cls(capman, live_manager)(**kwargs) │
│ 303 │ │
│ 304 │ @classmethod │
│ 305 │ def set_trace(cls, *args: Any, **kwargs: Any) -> None: │
│ │
│ /Users/marvin/GitHub/pdbp_test/.pixi/envs/default/lib/python3.13/site-packages/_pytask/debugging │
│ .py:147 in _import_pdb_cls │
│ │
│ 144 │ │ │ return cls._wrapped_pdb_cls[1] │
│ 145 │ │ │
│ 146 │ │ if usepdb_cls: │
│ ❱ 147 │ │ │ modname, classname = usepdb_cls │
│ 148 │ │ │ │
│ 149 │ │ │ try: │
│ 150 │ │ │ │ __import__(modname) │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ValueError: too many values to unpack (expected 2)
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
╭─────────── Summary ───────────╮
│ 1 Collected task │
│ 1 Failed (100.0%) │
╰───────────────────────────────╯
───────────────────────────────────────────────────────────── Failed in 0.01 seconds
Code Sample, a copy-pastable example
Here is the code that reproduces the environment that I am using.
pyproject.toml when using pixi
# ======================================================================================
# Project metadata
# ======================================================================================
[project]
name = "ada_helper"
dependencies = ["pytest>=8.4.2,<9"]
version = "0.1.0"
# ======================================================================================
# Pixi
# ======================================================================================
[tool.pixi.project]
channels = ["conda-forge"]
platforms = ["linux-64", "osx-64", "osx-arm64", "win-64"]
# Development Dependencies (conda)
# --------------------------------------------------------------------------------------
[tool.pixi.dependencies]
python = "~=3.13.0" # without the .0 it will choose 3.14
[tool.pixi.pypi-dependencies]
pdbp = "~=1.7.0"
pytask = ">=0.5.0"
[tool.pytask.ini_options]
pdbcls = "pdbp:Pdb"
[tool.pytest.ini_options]
addopts = ["--pdbcls=pdbp:Pdb"]
pyproject.toml when using uv
[project]
name = "ada_helper"
version = "0.1.0"
requires-python = ">=3.13,<3.14"
dependencies = []
[dependency-groups]
# tools you use during dev
dev = [
"pytest>=8.4.2,<9",
"pdbp~=1.7.0",
"pytask>=0.5.0",
]
[tool.pytask.ini_options]
pdbcls = "pdbp:Pdb"
[tool.pytest.ini_options]
addopts = ["--pdbcls=pdbp:Pdb"]
task file
def task_do_something():
a = 1 + 1
breakpoint()
b = 2
return a * b
mainbranch of pytask.Problem description
When using a custom debugger pytask throws
ValueError: too many values to unpack (expected 2)when entering the debugging mode (full error + reproducer below). The reason for the ValueError is thatusepdb_clsis not a tuple but a string ("pdbp:Pdb", which is the custom debugger I specified viapdbclsin the pyproject.toml). I've had this issue for several weeks, if not months, in all projects that use pytask.I have tried running pytask on MacOS both via
pixianduv, same issue with both package managers. Interestingly, when I use oldpixi.lockfiles everything works fine. The bug comes up when I start with a fresh lock file.I tried the following additional things:
pdbporpdbpppdbpworks perfectly fine when using pytestThis is the full error message:
Code Sample, a copy-pastable example
Here is the code that reproduces the environment that I am using.
pyproject.toml when using pixi
pyproject.toml when using uv
task file