Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new installer does not respect get_requires_for_build_editable #7574

Closed
4 tasks done
onerandomusername opened this issue Feb 28, 2023 · 2 comments · Fixed by #7579
Closed
4 tasks done

new installer does not respect get_requires_for_build_editable #7574

onerandomusername opened this issue Feb 28, 2023 · 2 comments · Fixed by #7579
Labels
area/installer Related to the dependency installer kind/bug Something isn't working as expected

Comments

@onerandomusername
Copy link
Contributor

  • 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

Simply put, the new installer never calls get_requires_for_build_editable.

That's an issue with this code:

env.install(
builder.build_system_requires
| builder.get_requires_for_build("wheel")
)
path = Path(
builder.build(
"wheel" if not editable else "editable",
destination.as_posix(),
)
)

I've fixed it by changing it to the following snippet, and I'm willing to make a pr after this gets triaged 😄

                    dist_format = "wheel" if not editable else "editable"
                    env.install(
                        builder.build_system_requires
                        | builder.get_requires_for_build(dist_format)
                    )
                    path = Path(
                        builder.build(
                            dist_format,
                            destination.as_posix(),
                        )
                    )

This was tested by running poetry install with the dependency from the above pyproject.toml

The full traceback for completeness, but I'm afraid this may not be helpful.

  Stack trace:

  7  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/installation/executor.py:271 in _execute_operation
      269270try:
    → 271result = self._do_execute_operation(operation)
      272except EnvCommandError as e:
      273if e.e.returncode == -2:

  6  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/installation/executor.py:357 in _do_execute_operation
      355return 0
      356│ 
    → 357result: int = getattr(self, f"_execute_{method}")(operation)
      358359if result != 0:

  5  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/installation/executor.py:477 in _execute_install
      475476def _execute_install(self, operation: Install | Update) -> int:
    → 477status_code = self._install(operation)
      478479self._save_url_reference(operation)

  4  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/installation/executor.py:509 in _install
      507archive = self._prepare_archive(operation)
      508elif package.source_type == "directory":
    → 509archive = self._prepare_directory_archive(operation)
      510cleanup_archive = True
      511elif package.source_type == "url":

  3  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/installation/executor.py:598 in _prepare_directory_archive
      596req /= package.source_subdirectory
      597│ 
    → 598return self._prepare_archive(operation)
      599600def _prepare_git_archive(self, operation: Install | Update) -> Path:

  2  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/installation/executor.py:577 in _prepare_archive
      575self._populate_hashes_dict(archive, package)
      576│ 
    → 577return self._chef.prepare(archive, editable=package.develop)
      578579def _prepare_directory_archive(self, operation: Install | Update) -> Path:

  1  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/installation/chef.py:105 in prepare
      103tmp_dir = tempfile.mkdtemp(prefix="poetry-chef-")
      104│ 
    → 105return self._prepare(archive, Path(tmp_dir), editable=editable)
      106107return self._prepare_sdist(archive, destination=output_dir)

  ChefBuildError

  Backend subprocess exited when trying to invoke build_editable
  
  Traceback (most recent call last):
    File "/home/xxx/.local/share/pypoetry/venv/lib/python3.10/site-packages/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
      main()
    File "/home/xxx/.local/share/pypoetry/venv/lib/python3.10/site-packages/pyproject_hooks/_in_process/_in_process.py", line 335, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/home/xxx/.local/share/pypoetry/venv/lib/python3.10/site-packages/pyproject_hooks/_in_process/_in_process.py", line 273, in build_editable
      return hook(wheel_directory, config_settings, metadata_directory)
    File "/tmp/tmpjpmsdln2/.venv/lib/python3.8/site-packages/pdm/backend/__init__.py", line 97, in build_editable
      from pdm.backend.editable import EditableBuilder
    File "/tmp/tmpjpmsdln2/.venv/lib/python3.8/site-packages/pdm/backend/editable.py", line 7, in <module>
      from editables import EditableProject
  ModuleNotFoundError: No module named 'editables'
  

  at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/installation/chef.py:152 in _prepare
      148149error = ChefBuildError("\n\n".join(message_parts))
      150151if error is not None:
    → 152raise error from None
      153154return path
      155156def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path:

Note: This error originates from the build backend, and is likely not a problem with poetry but with disnake (2.9.0a4522+g8a2a4ef7 /home/xxx/gh/disnake/disnake) not supporting PEP 517 builds. You can verify this by running 'pip wheel --use-pep517 "disnake @ file:///home/xxx/gh/disnake/disnake ; python_version >= "3.8""'.
@onerandomusername onerandomusername added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Feb 28, 2023
@radoering radoering added area/installer Related to the dependency installer and removed status/triage This issue needs to be triaged labels Feb 28, 2023
@radoering
Copy link
Member

LGTM, PR welcome. 😄

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/installer Related to the dependency installer kind/bug Something isn't working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants