Skip to content

BUG: Missing node causes sqlite3.IntegrityError #693

Description

@timmens
  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of pytask.
  • (optional) I have confirmed this bug exists on the main branch 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.

  • 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

uv run pytask

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions