pytask-dev / pytask-dev/pytask
BUG: using `pytask.task()(func_defined_in_other_file)` doesn't work
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 146
- Fork
- 14
- Merge trung bình
- 3 ngày 16 giờ
- Pull request đã merge (30 ngày)
- 34
Mô tả
- 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.
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- devtools
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 42/100