diff --git a/backend/src/hatchling/metadata/core.py b/backend/src/hatchling/metadata/core.py index d05ff114d..d9787b176 100644 --- a/backend/src/hatchling/metadata/core.py +++ b/backend/src/hatchling/metadata/core.py @@ -462,8 +462,7 @@ def description(self) -> str: if not isinstance(description, str): message = 'Field `project.description` must be a string' raise TypeError(message) - - self._description = description + self._description = ' '.join(description.splitlines()) return self._description diff --git a/tests/backend/metadata/test_core.py b/tests/backend/metadata/test_core.py index 84e13f2b8..3ba39af9d 100644 --- a/tests/backend/metadata/test_core.py +++ b/tests/backend/metadata/test_core.py @@ -338,6 +338,11 @@ def test_custom(self, isolation): assert metadata.core.description == metadata.core.description == 'foo' + def test_normaliza(self, isolation): + metadata = ProjectMetadata(str(isolation), None, {'project': {'description': '\nfirst line.\r\nsecond line'}}) + + assert metadata.core.description == metadata.core.description == ' first line. second line' + class TestReadme: def test_dynamic(self, isolation):