python-poetry / python-poetry/poetry

`poetry install` is unusable when `tool.poetry.build` is used

Open
#3,576 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

kind/bug status/triage
Dominant language
Python
Stars
34.3k
Forks
2.5k
Avg merge
2d 19h
Merged PRs (30d)
30

Description

  • I am on the latest Poetry version.

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

  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

  • OS version and name: Fedora 33

  • Poetry version: 1.1.4

  • Contents of your pyproject.toml file:

[build-system]
requires = ["poetry-core>=1.0.0", "Cython>=0.29"]
build-backend = "poetry.core.masonry.api"

[tool.poetry]
[...]
build = "build.py"

where build.py contains something like this:

from distutils.command.build_ext import build_ext

def get_modules():
    # Some build logic (eg. cython)
    pass

def build(setup_kwargs):
    setup_kwargs.update({
        'ext_modules': get_modules(),
        'cmdclass': {'build_ext': build_ext}
    })

Issue

When running poetry install, poetry doesn't run the build script to install its output, resulting in missing files and a broken installed package 😢

Workaround
poetry build -f wheel
poetry run pip install dist/*.whl

Solution

poetry install should produce usable installs, even when a build script is used.

If that's not possible (or until then, if the fix will take a while), an error should be printed explaining why poetry install is unusable.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the pyproject.toml configuration and build.py example, then reproduce the issue with poetry install using a project that defines tool.poetry.build. Compare the result with poetry build -f wheel followed by poetry run pip install dist/*.whl; done means poetry install includes the build output, or clearly explains why it cannot.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.