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

tool.poetry section should be optional #8110

Closed
2 tasks done
silverwind opened this issue Jun 17, 2023 · 8 comments
Closed
2 tasks done

tool.poetry section should be optional #8110

silverwind opened this issue Jun 17, 2023 · 8 comments
Labels
kind/feature Feature requests/implementations status/triage This issue needs to be triaged

Comments

@silverwind
Copy link

silverwind commented Jun 17, 2023

  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the FAQ and general documentation and believe that my question is not already covered.

Feature Request

The tool.poetry section and specifically the keys name, version, descriptions and authors of a pyproject.toml are mandatory for poetry, but they are just useless for projects that use poetry to run only command-line python tools and which do not intend to publish as a PyPi module. For comparison, for package.json the minimal format is

{
  "dependencies": {
    "module": "1.0.0"
  }
}

I would like to see poetry adapt a similar minimal syntax for the pyproject.toml:

[tool.poetry.dependencies]
python = "^3.11"
module= "1.0.0"
@silverwind silverwind added kind/feature Feature requests/implementations status/triage This issue needs to be triaged labels Jun 17, 2023
@dimbleby
Copy link
Contributor

build-system is not a thing that poetry cares about, if you're ok with pip install not working for your project then you can leave it out.

Since the things you want to omit are automatically filled in by poetry new or poetry init, it's hard to get excited about micro-optimisations around omitting them for some projects - and I'd bet on doing so causing more confusion than anything else.

@silverwind
Copy link
Author

silverwind commented Jun 17, 2023

True, it works without build-system (pip is not needed and in fact, I set no-pip already in poetry.toml), so I'll edit the description that this is only about the 4 fields name, version, descriptions and authors without which poetry refuses to run.

I prefer to keep things minimal. I initialize a npm package with echo '{}' > package.json, and it would be nice if I can init a poetry project with echo '[tool.poetry.dependencies]\npython = "^3.11"'.

@silverwind silverwind changed the title tool.poetry and build-system sections should be optional tool.poetry section should be optional Jun 17, 2023
@dimbleby
Copy link
Contributor

I see from the linked MR that you are using poetry in https://github.com/go-gitea/gitea/blob/3ee8970419bb62c6d508b37b02f8fcbacf2f8590/pyproject.toml, to install one dev dependency only. Frankly this seems an odd use of poetry - instead of asking people to install poetry, you might as well ask them to install djlint in the first place!

More broadly this is basically a duplicate of #1132 asking for non-package mode. Suggest you add further comments there and close this as a duplicate - though the great age of that one should be a hint as to how likely it is that anything will happen here.

@silverwind
Copy link
Author

Frankly this seems an odd use of poetry

What's so odd about it? I want to run a python tool in a non-python project, with the benefits of a virtualenv and a lockfile. I think this is a very common use case.

@dimbleby
Copy link
Contributor

we're getting off-topic, my fault, please close this as a duplicate of #1132

@silverwind
Copy link
Author

More broadly this is basically a duplicate of #1132 asking for non-package mode

Does it really warrant the complexity of a new "mode"? Why not just support such a minimal format?

@silverwind
Copy link
Author

Yeah I see #1132 is closely to what I'm requesting, will continue there.

@silverwind silverwind closed this as not planned Won't fix, can't repro, duplicate, stale Jun 17, 2023
silverwind added a commit to go-gitea/gitea that referenced this issue Jun 18, 2023
- Reduce `pyproject.toml` and `package.json` to the minimal required
format, removing unneeded properties. `build-system` is not needed as
per
[this](python-poetry/poetry#8110 (comment)).
- Fix `poetry.toml` options they were wrong previously.
- Add dependencies of poetry files to templates `files-changed`.

---------

Co-authored-by: Giteabot <teabot@gitea.io>
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/feature Feature requests/implementations status/triage This issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

2 participants