-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
- Poetry version: 1.2.1
- Python version: 3.8.10
- OS version and name: Ubuntu 20.04 (running from a Docker container on macOS 12.4)
- pyproject.toml: https://gist.github.com/ekralc/c97f8880a94e54a901d7562b3eaebe92
- 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.
- If an exception occurs when executing a command, I executed it again in debug mode (
-vvv
option) and have included the output below.
Issue
According to the current documentation, you can add multiple entries for readme
in pyproject.toml
Lines 129 to 131 in 31ef8d7
[tool.poetry] | |
# ... | |
readme = ["docs/README1.md", "docs/README2.md"] |
The current example in README.md
also includes multiple files:
Lines 32 to 33 in 424ea0c
# README file(s) are used as the package description | |
readme = ["README.md", "LICENSE"] |
However poetry build
fails when using this pattern.
When using an array of readme entries, poetry build
throws the following error:
Building test (0.1.0)
- Building sdist
unhashable type: 'Array'
As a new user, this error was a bit confusing...so I had a look at the verbose output:
Building test (0.1.0)
- Building sdist
- Adding: /test/test/__init__.py
Stack trace:
10 /usr/local/lib/python3.8/dist-packages/cleo/application.py:329 in run
327│
328│ try:
→ 329│ exit_code = self._run(io)
330│ except Exception as e:
331│ if not self._catch_exceptions:
9 /usr/local/lib/python3.8/dist-packages/poetry/console/application.py:185 in _run
183│ self._load_plugins(io)
184│
→ 185│ exit_code: int = super()._run(io)
186│ return exit_code
187│
8 /usr/local/lib/python3.8/dist-packages/cleo/application.py:423 in _run
421│ io.input.set_stream(stream)
422│
→ 423│ exit_code = self._run_command(command, io)
424│ self._running_command = None
425│
7 /usr/local/lib/python3.8/dist-packages/cleo/application.py:465 in _run_command
463│
464│ if error is not None:
→ 465│ raise error
466│
467│ return event.exit_code
6 /usr/local/lib/python3.8/dist-packages/cleo/application.py:449 in _run_command
447│
448│ if event.command_should_run():
→ 449│ exit_code = command.run(io)
450│ else:
451│ exit_code = ConsoleCommandEvent.RETURN_CODE_DISABLED
5 /usr/local/lib/python3.8/dist-packages/cleo/commands/base_command.py:119 in run
117│ io.input.validate()
118│
→ 119│ status_code = self.execute(io)
120│
121│ if status_code is None:
4 /usr/local/lib/python3.8/dist-packages/cleo/commands/command.py:83 in execute
81│
82│ try:
→ 83│ return self.handle()
84│ except KeyboardInterrupt:
85│ return 1
3 /usr/local/lib/python3.8/dist-packages/poetry/console/commands/build.py:34 in handle
32│
33│ builder = Builder(self.poetry)
→ 34│ builder.build(fmt, executable=env.python)
35│
36│ return 0
2 /usr/local/lib/python3.8/dist-packages/poetry/core/masonry/builder.py:33 in build
31│
32│ for builder in builders:
→ 33│ builder(self._poetry, executable=executable).build()
34│
1 /usr/local/lib/python3.8/dist-packages/poetry/core/masonry/builders/sdist.py:77 in build
75│ tar_dir = f"{self._package.pretty_name}-{self._meta.version}"
76│
→ 77│ files_to_add = self.find_files_to_add(exclude_build=False)
78│
79│ for file in sorted(files_to_add, key=lambda x: x.relative_to_source_root()):
TypeError
unhashable type: 'Array'
at /usr/local/lib/python3.8/dist-packages/poetry/core/masonry/builders/sdist.py:333 in find_files_to_add
329│ additional_files.add(Path("pyproject.toml"))
330│
331│ # add readme if it is specified
332│ if "readme" in self._poetry.local_config:
→ 333│ additional_files.add(self._poetry.local_config["readme"])
334│
335│ for additional_file in additional_files:
336│ file = BuildIncludeFile(
337│ path=additional_file, project_root=self._path, source_root=self._path
Running poetry build --format=wheel
works as expected.
It seems like the issue is that the sdist
builder just doesn't support the case where readme
is an array. I assume this is yet to become a feature, I just thought it would be worth reporting this as it produces a rather confusing error.