Skip to content

poetry install checks README.md, but poetry check does not. #6937

@YDX-2147483647

Description

@YDX-2147483647
  • Poetry version: 1.2.2

  • Python version: 3.10.8

  • OS version and name: Windows 10 (21H1) and Raspberry Pi OS (based on Debian 11 Bullseye)

  • pyproject.toml: default – poetry new <package_name> can fire this issue.

  • I am on the latest stable Poetry version, installed using a recommended method.

  • I have searched the issues of this repo and believe that this is not a duplicate.

  • I have consulted the FAQ and blog for any relevant entries or release notes. (Note: I’ve only checked FAQ and blog 1.2.x)

  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option) and have included the output below.

Issue

poetry install checks README.md, but poetry check does not.

To be rigorous, it checks tool.poetry.readme in pyproject.toml.

Is it an issue?

  • All commands work: poetry install raises a FileNotFoundError, but it works.

  • Doc: The install command reads pyproject.toml, resolves the dependencies, and installs them.

    It should not care about README.

  • Doc: The check command validates the structure of pyproject.toml.

    Although README is absent, the TOML structure is valid. So this might be expected.

To Reproduce

TL; DR:

  1. Create a project.
  2. rm README.md.
  3. poetry install: No such file or directory: README.md.

1. Create a project

$ poetry new why-read-me
$ cd why-read-me

$ cat pyproject.toml
# There's a default `README.md`.
[tool.poetry]
name = "why-read-me"
……
readme = "README.md"
……

2. poetry install checks README.md

$ mv .\README.md read-me-whatever.md
# Let's steal the README.

$ poetry install
# The `install` command checks the README, and raises an error.
# However, it successfully installs packages. (If I add some packages in pyproject.toml, it will be installed here.)
Using virtualenv: ……
Installing dependencies from lock file

Finding the necessary packages for the current system

  FileNotFoundError

  [Errno 2] No such file or directory: '……/why-read-me/README.md'

  at ……\Python310\lib\pathlib.py:1119 in open
      1115│         the built-in open() function does.
      1116│         """
      1117│         if "b" not in mode:
      1118│             encoding = io.text_encoding(encoding)
    → 1119│         return self._accessor.open(self, mode, buffering, encoding, errors,
      1120│                                    newline)
      1121│

3. Other commands work

$ poetry check
# It ignores the absence of README.
All set!

$ poetry add any-package
Using version …… for ……
Updating dependencies
Writing lock file
Package operations: …… installs, ……
  - Installing …… (……)
……
# Nothing broken and No error raised.

4. Updatetool.poetry.readme

$ nano pyproject.toml
# Change `tool.poetry.readme` to `read-me-whatever.md`.

$ poetry install
# Everthing is OK now.
Installing dependencies from lock file
Installing the current project: why-read-me (0.1.0)

Full output with -vv

Output of `poetry install -vv` Using virtualenv: ……\temp\why-read-me\.venv Installing dependencies from lock file

Finding the necessary packages for the current system

Stack trace:

11 ~\AppData\Roaming\pypoetry\venv\lib\site-packages\cleo\application.py:329 in run
exit_code = self._run(io)

10 ~\AppData\Roaming\pypoetry\venv\lib\site-packages\poetry\console\application.py:185 in _run
exit_code: int = super()._run(io)

9 ~\AppData\Roaming\pypoetry\venv\lib\site-packages\cleo\application.py:423 in _run
exit_code = self._run_command(command, io)

8 ~\AppData\Roaming\pypoetry\venv\lib\site-packages\cleo\application.py:465 in _run_command
raise error

7 ~\AppData\Roaming\pypoetry\venv\lib\site-packages\cleo\application.py:449 in _run_command
exit_code = command.run(io)

6 ~\AppData\Roaming\pypoetry\venv\lib\site-packages\cleo\commands\base_command.py:119 in run
status_code = self.execute(io)

5 ~\AppData\Roaming\pypoetry\venv\lib\site-packages\cleo\commands\command.py:83 in execute
return self.handle()

4 ~\AppData\Roaming\pypoetry\venv\lib\site-packages\poetry\console\commands\install.py:155 in handle
builder = EditableBuilder(self.poetry, self.env, self.io)

3 ~\AppData\Roaming\pypoetry\venv\lib\site-packages\poetry\masonry\builders\editable.py:47 in init
super().init(poetry)

2 ~\AppData\Roaming\pypoetry\venv\lib\site-packages\poetry\core\masonry\builders\builder.py:90 in init
self._meta = Metadata.from_package(self._package)

1 ~\AppData\Roaming\pypoetry\venv\lib\site-packages\poetry\core\masonry\metadata.py:60 in from_package
with readme.open(encoding="utf-8") as f:

FileNotFoundError

[Errno 2] No such file or directory: '……\temp\why-read-me\README.md'

at C:\Program Files\Python310\lib\pathlib.py:1119 in open
1115│ the built-in open() function does.
1116│ """
1117│ if "b" not in mode:
1118│ encoding = io.text_encoding(encoding)
→ 1119│ return self._accessor.open(self, mode, buffering, encoding, errors,
1120│ newline)
1121│
1122│ def read_bytes(self):
1123│ """

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working as expectedstatus/triageThis issue needs to be triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions