pytask-dev / pytask-dev/pytask
BUG: using `pytask.task()(func_defined_in_other_file)` doesn't work
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 146
- 派生
- 14
- 平均合并
- 3 天 16 小时
- 30 天内合并 PR
- 34
描述
- 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.
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 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 内容生成。
评估
- 技术栈
- python
- 领域
- devtools
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 42/100