This buildpack's detection logic is intentionally lenient about what files are required in order to pass detection - so that projects missing required files (such as requirements.txt) correctly get marked as being a Python app. Stricter validation then occurs later during the build phase, as part of deciding which package manager to use.
This change adds the following to the known Python files list:
app.py - filename that's autodetected by the Flask CLI and used in Flask docs/examples
Pipfile.lock - Pipenv's lockfile (whilst Pipfile was already in the known files list, it makes sense to have the lockfile there too for completeness)
setup.cfg - configuration file used with setuptools (as a successor to setup.py and predecessor of pyproject.toml) and also used as the config location for a number of Python tools such as linters (whilst it's mostly been replaced by pyproject.toml, quite a few projects will still be using the old file)
This buildpack's detection logic is intentionally lenient about what files are required in order to pass detection - so that projects missing required files (such as
requirements.txt
) correctly get marked as being a Python app. Stricter validation then occurs later during the build phase, as part of deciding which package manager to use.This change adds the following to the known Python files list:
app.py
- filename that's autodetected by the Flask CLI and used in Flask docs/examplespdm.lock
- the lockfile for https://pdm-project.orgPipfile.lock
- Pipenv's lockfile (whilstPipfile
was already in the known files list, it makes sense to have the lockfile there too for completeness)setup.cfg
- configuration file used with setuptools (as a successor tosetup.py
and predecessor ofpyproject.toml
) and also used as the config location for a number of Python tools such as linters (whilst it's mostly been replaced bypyproject.toml
, quite a few projects will still be using the old file)uv.lock
- the lockfile for https://github.com/astral-sh/uvThis means that for any project that is:
requirements.txt
...then detection will now pass (when it would have failed before) and the build will proceed to the build phase, where this clearer error message will be shown: https://github.com/heroku/buildpacks-python/blob/ae439b223afc7fa1160ee38b687ce4ad77a798d6/src/errors.rs#L70-L82
I've not added any new tests since this codepath is well tested, and it's pointless to have a test for every entry in the
KNOWN_PYTHON_PROJECT_FILES
constant. See: https://github.com/heroku/buildpacks-python/blob/ae439b223afc7fa1160ee38b687ce4ad77a798d6/src/detect.rs#L42-L46 https://github.com/heroku/buildpacks-python/blob/ae439b223afc7fa1160ee38b687ce4ad77a798d6/tests/package_manager_test.rs#L5-L28GUS-W-16148746.