pypa / build

A simple, correct Python build frontend

Home Page:https://build.pypa.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

build with dependencies in requirements.txt file

transfluxus opened this issue · comments

Hi,

is it possible to build with the dependencies in the requierments file instead of inside the pyproject.toml file?

the setuptools docs contain that feature as in BETA
https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html

dependencies file subset of the requirements.txt format (# comments and blank lines excluded) BETA

So it could be like this:
dependencies = {file="requirements.txt"}

however build get offended by that :):

configuration error: `project.dependencies` must be array
DESCRIPTION:
    Project (mandatory) dependencies.

GIVEN VALUE:
    {
        "file": "requirements.txt"
    }

OFFENDING RULE: 'type'

DEFINITION:
    {
        "type": "array",
        "items": {
            "$id": "#/definitions/dependency",
            "title": "Dependency",
            "type": "string",
            "description": "Project dependency specification according to PEP 508",
            "format": "pep508"
        }
    }

In addition. Currently what I do is a bash script that includes running build, read out the requirements.txt file and includes the requirements as a list into the pyproject.toml

build doesn't use JSON Schema for data validation; the error you are seeing is coming from setuptools. Passing a file in directly as a value to dependencies is not supported by the project metadata spec. Please read the section on "Dynamic Metadata" from setuptools' documentation on how to accomplish this using setuptools.