BUG: using `pytask.task()(func_defined_in_other_file)` doesn't work
还没有人认领这个 Issue。
评估
调研方向
Start with the pytask.task() decorator and trace how the function from lib.py is registered when called in task_bug.py. Inspect the COLLECTED_TASKS lookup path and the tasks.zip reproduction; done means the task is discovered under task_bug.py and executes with the expected output.
由索引模型根据 Issue 内容生成。
描述
- 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
mainbranch of pytask.
Code Sample, a copy-pastable example
zipped dir: tasks.zip
# lib.py
def get_name():
return "jane"
# task_bug.py
from pathlib import Path
import pytask
from .lib import get_name
task_get_name = pytask.task(produces=Path("name.txt"))(get_name)
Problem description
It appears that inpytask.task(), the created task is stored in COLLECTED_TASKS,
but is stored under COLLECTED_TASKS["lib.py"] (the place where the function was defined), not under COLLECTED_TASKS["task_bug.py"] (where the task was created). Then, when we actually go looking through COLLECTED_TASKS for tasks to execute, we miss it because we only look under "task_bug.py"
Expected Output
I think the created task should be stored under COLLECTED_TASKS["task_bug.py"] where the task was created.
- 主要语言
- Python
- 星标
- 146
- 派生
- 14
- 平均合并
- 3 天 16 小时
- 30 天内合并 PR
- 34
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
pytask-dev/pytask 的其他 Issue
-
enhancement
难度 5/5 一周以上 新手友好度 45/100
pytask-dev/pytask#985 ·
-
enhancement
难度 5/5 一周以上 新手友好度 30/100
pytask-dev/pytask#786 · 2 条评论 ·
-
enhancement
难度 5/5 一周以上 新手友好度 35/100
pytask-dev/pytask#503 · 1 条评论 · 1 个 reaction ·
-
enhancement
难度 5/5 一周以上 新手友好度 35/100
pytask-dev/pytask#403 ·
-
enhancement
难度 4/5 3-5 天 新手友好度 35/100
pytask-dev/pytask#320 · 1 条评论 ·
查看 pytask-dev/pytask 的全部 Issue
相似的 Issue
-
link-check link-check:sphinx-theme
难度 2/5 1-3 小时 新手友好度 72/100
-
难度 2/5 1-3 小时 新手友好度 65/100
qgis/QGIS-Documentation#11275 ·
-
bug priority:normal ready-for-dev
难度 2/5 1-3 小时 新手友好度 88/100
OpenHands/extensions#626 · 1 条评论 ·
-
难度 1/5 1 小时以内 新手友好度 90/100
CSCfi/sd-search-api#39 ·
-
难度 1/5 1 小时以内 新手友好度 90/100