Skip to content

Commit 3ee8584

Browse files
Allow any file extension for README file (#5357)
Co-authored-by: Bjorn Neergaard <[email protected]>
1 parent 27034d6 commit 3ee8584

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

docs/cli.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ my-package
103103

104104
* `--name`: Set the resulting package name.
105105
* `--src`: Use the src layout for the project.
106-
* `--readme`: Specify the readme file format. One of `md` (default) or `rst`.
106+
* `--readme`: Specify the readme file extension. Default is `md`. If you intend to publish to PyPI
107+
keep the [recommendations for a PyPI-friendly README](https://packaging.python.org/en/latest/guides/making-a-pypi-friendly-readme/)
108+
in mind.
107109

108110

109111
## init

src/poetry/layouts/layout.py

-8
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@
4141

4242

4343
class Layout:
44-
ACCEPTED_README_FORMATS = {"md", "rst"}
45-
4644
def __init__(
4745
self,
4846
project: str,
@@ -64,12 +62,6 @@ def __init__(
6462
self._description = description
6563

6664
self._readme_format = readme_format.lower()
67-
if self._readme_format not in self.ACCEPTED_README_FORMATS:
68-
accepted_readme_formats = ", ".join(self.ACCEPTED_README_FORMATS)
69-
raise ValueError(
70-
f"Invalid readme format '{readme_format}', use one of"
71-
f" {accepted_readme_formats}."
72-
)
7365

7466
self._license = license
7567
self._python = python

tests/console/commands/test_new.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def test_command_new(
157157
verify_project_directory(path, package_name, package_path, include_from)
158158

159159

160-
@pytest.mark.parametrize(("fmt",), [(None,), ("md",), ("rst",)])
160+
@pytest.mark.parametrize(("fmt",), [(None,), ("md",), ("rst",), ("adoc",), ("creole",)])
161161
def test_command_new_with_readme(fmt: str | None, tester: CommandTester, tmp_dir: str):
162162
package = "package"
163163
path = Path(tmp_dir) / package

0 commit comments

Comments
 (0)