Code Sample, a copy-pastable example
Unfortunately, I have only managed to reproduce this in a package structure. Following the tasks outlined below should result in the error.
- Python version: 3.13
- OS: Ubuntu, 22.04
Run the following in a terminal:
mkdir pytask-bug
cd pytask-bug
uv init --package
uv add pytask==0.5.4 # or git+https://github.com/pytask-dev/pytask@main
touch src/pytask_bug/existing_module.py
touch src/pytask_bug/task_file.py
Then edit the task_file.py:
# src/pytask_bug/task_file.py
from pathlib import Path
ROOT = Path(__file__).parent
existing_nodes = [
ROOT / "existing_module.py",
]
missing_nodes = [
ROOT / "missing_module.py"
]
def task_function(
_script: list[Path] = existing_nodes + missing_nodes,
produces: Path = Path("output.txt"),
) -> None:
produces.write_text("Hello, World!")
Now run
This results in a sqlite3.IntegrityError.
Importantly:
- If you run
uv run pytask again, you get the expected --and helpful-- NodeNotFoundError!
- It seems to be important for the error that the deps are constructed as the list concatenation of two lists, one with valid paths and the other without.
Problem description
The sqlite3.IntegrityError gives you no hint on how to fix the bug.
Expected Output
A pytask NodeNotFoundError.
mainbranch of pytask.Code Sample, a copy-pastable example
Unfortunately, I have only managed to reproduce this in a package structure. Following the tasks outlined below should result in the error.
Run the following in a terminal:
Then edit the
task_file.py:Now run
uv run pytaskThis results in a
sqlite3.IntegrityError.Importantly:
uv run pytaskagain, you get the expected --and helpful--NodeNotFoundError!Problem description
The
sqlite3.IntegrityErrorgives you no hint on how to fix the bug.Expected Output
A pytask
NodeNotFoundError.