Modern Python packaging is quite flexible and arguably un-pythonic in that there is no longer one obvious way to do it. For many of my projects I have chosen to use Hatchling as a more reliable build backend than setuptools. One of the benefits of Hatchling is that it consolidates configuration into a pyproject.toml file including project dependencies.
Toolforge build seems to be using https://github.com/heroku/buildpacks-python/tree/v0.8.0 as its Python buildpack. This buildpack detects that it should be used when a pyproject.toml file is present, but when the builder runs it fails the build if it cannot also find a requirements.txt file:
[step-build] 2023-12-19T23:04:07.119771032Z [Error: No Python package manager files were found] [step-build] 2023-12-19T23:04:07.119780610Z A Pip requirements file was not found in your application's source code. [step-build] 2023-12-19T23:04:07.119787689Z This file is required so that your application's dependencies can be installed. [step-build] 2023-12-19T23:04:07.119794349Z [step-build] 2023-12-19T23:04:07.119800469Z Please add a file named exactly 'requirements.txt' to the root directory of your [step-build] 2023-12-19T23:04:07.119807049Z application, containing a list of the packages required by your application. [step-build] 2023-12-19T23:04:07.119813382Z [step-build] 2023-12-19T23:04:07.119819439Z For more information on what this file should contain, see: [step-build] 2023-12-19T23:04:07.119826013Z https://pip.pypa.io/en/stable/reference/requirements-file-format/ [step-build] 2023-12-19T23:04:07.119832378Z [step-build] 2023-12-19T23:04:07.120630642Z ERROR: failed to build: exit status 1