Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
2 tasks
roger-duthie-pivotal opened this issue Jul 26, 2023 · 4 comments
Closed
2 tasks

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

roger-duthie-pivotal opened this issue Jul 26, 2023 · 4 comments

Comments

@roger-duthie-pivotal
Copy link

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:

  • Real
  • A good enough fix
@rjaduthie
Copy link
Contributor

Added PR: #159

@nat-n
Copy link
Owner

nat-n commented Jul 26, 2023

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
Copy link
Author

roger-duthie-pivotal commented Jul 26, 2023 via email

nat-n added a commit to rjaduthie/poethepoet that referenced this issue Aug 5, 2023
nat-n added a commit to rjaduthie/poethepoet that referenced this issue Aug 5, 2023
nat-n added a commit that referenced this issue Aug 5, 2023
Fixes #158

Poe no longer crashes if a included task file is configured with `cwd` and includes string task declarations.

Included task files may now include the following global options which will be respected for associated tasks:
- default_task_type
- default_array_task_type
- default_array_item_task_type

---------

Co-authored-by: Nat Noordanus <[email protected]>
@nat-n
Copy link
Owner

nat-n commented Aug 5, 2023

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

@nat-n nat-n closed this as completed Aug 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants