PEP 517 method to specify build requirements is not working in poetry

6.7k views Asked by At

How can I specify the "build system" requirements in poetry? I think PEP517 deals with this, but I can't get it to work.

I am using poetry to manage my project. One of my project's dependencies is built from source, and building the dependency fails because the tools needed during the build are not available.

The dependency has as setup.py, but no setup.cfg or pyproject.toml. Following the discussion in this poetry issue, I have tried adding:

[build-system]
build-backend = 'setuptools.build_meta'
requires = [
    "packaging",
    "Cython",
    "setuptools",
]

to:

  • the pyproject.toml file in my project (where the poetry install is initiated)
  • a new pyproject.toml file in dependency's source tree.

i.e. building the dependency requires Cython, packaging and setuptools, as you can see from the first few lines in the dependency's setup.py.

Adding the [build-system] section doesn't seem to do anything The build appears to be done in a temporary virtual env, and that env does not have the required tools (Cython, packaging and setuptools).

BTW - I don't know if the build-backend = 'setuptools.build_meta' is correct (I think that means setuptools is being used to handle the dependency packaging, but I don't really know).

What do I need to do to fix this?

1

There are 1 answers

1
finswimmer On BEST ANSWER

The dependency itself must provide a pyproject.toml according to PEP-518 and list their build dependencies. There's nothing you can do in your project.