heroku / buildpacks-python

Heroku's Cloud Native Buildpack for Python applications.
BSD 3-Clause "New" or "Revised" License
26 stars 2 forks source link

Add more filetypes to the list recognised by buildpack detection #215

Closed edmorley closed 2 months ago

edmorley commented 2 months ago

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:

This means that for any project that is:

...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-L28

GUS-W-16148746.