nat-n / poethepoet

A task runner that works well with poetry.
https://poethepoet.natn.io/
MIT License
1.4k stars 58 forks source link

Can't in-lined tasks from another file with cwd #158

Closed roger-duthie-pivotal closed 1 year ago

roger-duthie-pivotal commented 1 year ago

Summary

If trying to use the syntax documented here:

[[tool.poe.include]]
path = "my_subproject/pyproject.toml"
cwd  = "my_subproject"

... there is an exception if any tasks are defined "in-line" like:

[tool.poe.tasks]
mytask = "mycooltask"
myothertask = "myothertask"

The issue is that these tasks are loaded as strings so that on line 291 config.py the task_def is a string and on line 305 there is a type error when task_def["cwd"] is attempted.

Possible solution

To convert any string tasks to objects like:

for task_name, task_def in tasks.items():
    if isinstance(task_def, str):
        task_def = {
            "cmd": task_def
        }
        tasks[task_name] = task_def  # Not sure if this is necessary or if the dictionary will be updated...
    [...]

I can create a PR at some point if you think this is:

rjaduthie commented 1 year ago

Added PR: https://github.com/nat-n/poethepoet/pull/159

nat-n commented 1 year ago

Hi @rjaduthie, thanks for the issue! I'm out of the office the next week, but I'll look at this when I get back :)

roger-duthie-pivotal commented 1 year ago

[like] Roger Duthie reacted to your message:


From: Nat Noordanus @.> Sent: Wednesday, July 26, 2023 7:09:31 PM To: nat-n/poethepoet @.> Cc: Roger Duthie @.>; Author @.> Subject: Re: [nat-n/poethepoet] Can't in-lined tasks from another file with cwd (Issue #158)

Hi @rjaduthiehttps://github.com/rjaduthie, thanks for the issue! I'm out of the office the next week, but I'll look at this when I get back :)

— Reply to this email directly, view it on GitHubhttps://github.com/nat-n/poethepoet/issues/158#issuecomment-1652346351, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BBFLMSUVNT6DOUWER3572QTXSFTOXANCNFSM6AAAAAA2YXHYIE. You are receiving this because you authored the thread.Message ID: @.***>

nat-n commented 1 year ago

159 is merged, this will be fixed in the next release.