python-poetry / poetry

Python packaging and dependency management made easy
https://python-poetry.org
MIT License
31.14k stars 2.25k forks source link

License field in pyproject.toml should accept table value (e.g., `{ file = "LICENSE.txt"}`) #8712

Closed todofixthis closed 9 months ago

todofixthis commented 10 months ago

Feature Request

I'm updating a project to use poetry, and in my pyproject.toml file I previously had this:

[project]
license = { file = "LICENCE.txt" }

Python Packaging User Guide supports this syntax for license:

The table may have one of two keys. The file key has a string value that is a file path relative to pyproject.toml to the file which contains the license for the project. Tools MUST assume the file’s encoding is UTF-8. The text key has a string value which is the license of the project. These keys are mutually exclusive, so a tool MUST raise an error if the metadata specifies both keys.

Following the poetry documentation, I have changed it to this:

[tool.poetry]
license = { file = "LICENCE.txt" }

When I run poetry check, however, I get the following error:

The Poetry configuration is invalid:

  • data.license must be string

As a workaround I can change it to this:

[tool.poetry]
license = "MIT"

From the perspective of a dev who is new to poetry, it would be nice if poetry supported the same format as the PyPA spec — or at least update the documentation to acknowledge the difference and explain why poetry doesn't follow the PyPA spec 😇

dimbleby commented 10 months ago

what part of the poetry documentation makes you think that the table is a valid format?

(PEP621 support is well covered elsewhere in this tracker, no need to duplicate that here. But if there is wrong documentation then that should be fixed)

Secrus commented 9 months ago

This is part of PEP 621 spec, which Poetry doesn't currently support. Duplicate #3332

github-actions[bot] commented 6 months ago

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.