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

Doesn't work with Poetry 2.0 if pyproject doesn't have [tool.poetry] #59

Open
taconi opened this issue Jan 16, 2025 · 1 comment · May be fixed by #60
Open

Doesn't work with Poetry 2.0 if pyproject doesn't have [tool.poetry] #59

taconi opened this issue Jan 16, 2025 · 1 comment · May be fixed by #60

Comments

@taconi
Copy link

taconi commented Jan 16, 2025

In the latest version of poetry, the [tool.poetry] table is no longer mandatory.

Now it also reads the [proejct] table.

So, these two configurations are valid:

[project]
name = "test"
version = "0.1.0"

requires-python = ">=3.13,<4.0"
dependencies = [
    "numpy (>=2.2.1,<3.0.0)"
]
[tool.poetry]
package-mode = false

[tool.poetry.dependencies]
python = "^3.13"
numpy = "^2.2.1"

poetry.el/poetry.el

Lines 893 to 901 in 1dff0d4

(defun poetry-find-project-root ()
"Return the poetry project root if any."
(or poetry-project-root
(when-let* ((root (locate-dominating-file default-directory "pyproject.toml"))
(pyproject-contents
(with-temp-buffer
(insert-file-contents-literally (concat (file-name-as-directory root) "pyproject.toml"))
(buffer-string)))
(_ (string-match "^\\[tool\\.poetry\\]" pyproject-contents)))

The poetry-find-project-root function only searches for [tool.poetry], I believe the adjustment should be in this function, but I don't have enough context of the project to know what it would be.

Maybe turn the poetry check command?

@taconi taconi linked a pull request Jan 17, 2025 that will close this issue
@elvinzeng
Copy link

elvinzeng commented Jan 25, 2025

I encountered the same problem. I am currently adding an empty [tool.poetry] node to pyproject.toml to temporarily solve the problem. Waiting for maintainers to adjust the regular expression

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

Successfully merging a pull request may close this issue.

2 participants