-
-
Notifications
You must be signed in to change notification settings - Fork 75
poetry_hooks with switch tasks by named argument #193
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers
Description
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:
[tool.poetry.dependencies]
python = "^3.10"
...
poethepoet = "^0.24.4"
[tool.poetry.group.dev.dependencies]
...
pre-commit = "^3.2.0"
[tool.poetry.group.test.dependencies]
...I have a working solution for this purpose, which is always executed when entering the poetry install command.
[tool.poe.poetry_hooks]
post_install = "pre_commit_install"
[tool.poe.tasks.pre_commit_install]
help = "pre-commit pre install"
cmd = "pre-commit install"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:
[tool.poe.poetry_hooks]
post_install = "pre_commit_install"
[tool.poe.tasks.pre_commit_install]
help = "pre-commit pre install"
default = "pass"
control.expr = "with"
args = ["with"]
[[tool.poe.tasks.pre_commit_install.switch]]
case = "dev"
cmd = "pre-commit install"When I enter the command poetry install --with dev, I get the following error:
Please help me figure out what went wrong.
Thanks!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers