Skip to content

Commit

Permalink
Allow any file extension for README file (#5357)
Browse files Browse the repository at this point in the history
Co-authored-by: Bjorn Neergaard <bjorn@neersighted.com>
  • Loading branch information
s-spindler and neersighted authored May 29, 2022
1 parent 27034d6 commit 3ee8584
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
4 changes: 3 additions & 1 deletion docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ my-package

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


## init
Expand Down
8 changes: 0 additions & 8 deletions src/poetry/layouts/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@


class Layout:
ACCEPTED_README_FORMATS = {"md", "rst"}

def __init__(
self,
project: str,
Expand All @@ -64,12 +62,6 @@ def __init__(
self._description = description

self._readme_format = readme_format.lower()
if self._readme_format not in self.ACCEPTED_README_FORMATS:
accepted_readme_formats = ", ".join(self.ACCEPTED_README_FORMATS)
raise ValueError(
f"Invalid readme format '{readme_format}', use one of"
f" {accepted_readme_formats}."
)

self._license = license
self._python = python
Expand Down
2 changes: 1 addition & 1 deletion tests/console/commands/test_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def test_command_new(
verify_project_directory(path, package_name, package_path, include_from)


@pytest.mark.parametrize(("fmt",), [(None,), ("md",), ("rst",)])
@pytest.mark.parametrize(("fmt",), [(None,), ("md",), ("rst",), ("adoc",), ("creole",)])
def test_command_new_with_readme(fmt: str | None, tester: CommandTester, tmp_dir: str):
package = "package"
path = Path(tmp_dir) / package
Expand Down

0 comments on commit 3ee8584

Please sign in to comment.