poetry icon indicating copy to clipboard operation
poetry copied to clipboard

feat: run tasks defined in [tool.poetry.tasks]

Open finswimmer opened this issue 1 year ago • 4 comments

Example pyproject.toml:

[tool.poetry]
name = "tasks"
version = "0.1.0"
description = ""
authors = ["finswimmer <[email protected]>"]
readme = "README.md"

[tool.poetry.tasks]
version = "python --version"
test = "pytest tests"

[tool.poetry.dependencies]
python = "^3.11"
pytest = "^7.3.1"


[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

Example usage:

poetry run version
poetry run test

Closes #2496

finswimmer avatar May 09 '23 18:05 finswimmer

Acknowledging that clearly this is a thing that you think would be useful, and also that there have been feature requests for this sort of thing so you are not alone - I would want to discourage poetry from going in this direction.

It seems to me that poetry already has more features (and bugs) than maintainers and contributors can keep up with - see the state of this issue tracker for evidence. Adding "be a task-runner" to the things that poetry does is likely to make that even more true, and dilute the available resource still further.

Being a task-runner is both no small matter, and already well-served by other solutions: poethepoet is the obvious example in the poetry ecosystem (lots of non-poetry based approaches are also possible). Duplicating the work of that plugin seems to me both to be quite a lot of work, and not necessary - it already exists!

Of course people will work on the things that interest them. When I occasionally wish for a better poetry project, "more features" is not what comes to mind. But, that's just one person's opinion...

dimbleby avatar May 14 '23 11:05 dimbleby

I completely agree with dimbleby, but I may be in the minority among maintainers.

radoering avatar May 14 '23 12:05 radoering

I certainly would use it, and would appreciate it being built in. Maybe in time there will be something like this upstream, but..that could be a long time in waiting.

clintonroy avatar May 23 '23 10:05 clintonroy

Maybe in time there will be something like this upstream

what do you mean by "upstream"?

Did you try poethepoet? why not, or what's wrong with it?

I've never used it myself so maybe there are good reasons to avoid it. But it sounds as though you are saying "I would use a solution if it existed"; while so far as I know a solution does exist!

dimbleby avatar May 23 '23 10:05 dimbleby