-
-
Notifications
You must be signed in to change notification settings - Fork 61
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
poetry_hooks with switch tasks by named argument #193
Comments
Hi @StripedMiha,
I'm afraid limiting poetry hooks to invocations including specific arguments is not currently supported. Your workaround using a switch task is interesting, and might even work. I believe the error you're getting from the You should be able to avoid this particular error by mapping the argument to a different name with something like: control.expr = "deps_group"
args = [{ name = "deps_group", options = ["--with"] }] Please let me know if you get it working :) |
@nat-n But I'm afraid I don't quite understand how this should work, but this option does not catch the argument correctly and gives a default response. [tool.poe.tasks.pre_commit_install]
help = "pre-commit pre install"
control.expr = "deps_group"
args = [{ name = "deps_group", options = ["--with"] }]
[[tool.poe.tasks.pre_commit_install.switch]]
case = "dev"
cmd = "pre-commit install"
[[tool.poe.tasks.pre_commit_install.switch]]
cmd = "echo abc" The response from such a command now does not fall with an error, but the switcher does not catch the argument |
Hi @StripedMiha , Thanks for getting back. In that case I think what you want is not possible today, because the poetry plugin only passes the task name to poe: poethepoet/poethepoet/plugin.py Line 226 in 71fcdc7
However in principle I suspect it could be supported because that linked function in the plugin could inspect the arguments from the present Maybe this wouldn't too difficult to implement. I'll leave this issue open as an enhancement request. |
Hi! I was very interested in your tool and decided to implement it into the project.
In my project, I want to add a hook with a pre-commit install setup along with executing the poetry install --with dev command.
Here is my
puproject.toml
with dependencies divided into groups:I have a working solution for this purpose, which is always executed when entering the
poetry install
command.However, I need the hook to be executed only when entering the
poetry install
command with the--with dev
argument.Here is my vision of
pyproject.toml
, for such functionality:When I enter the command
poetry install --with dev
, I get the following error:Please help me figure out what went wrong.
Thanks!
The text was updated successfully, but these errors were encountered: